W3C home > Mailing lists > Public > public-media-capture@w3.org > May 2015

Re: Specifying the audio buffer size

From: Joe Berkovitz <joe@noteflight.com>
Date: Fri, 15 May 2015 09:12:57 -0400
Message-ID: <CA+ojG-Z8hQ9a1=Uk_1scAaT=mCXFz44sH22nzU85cv71q1GCSA@mail.gmail.com>
To: Harald Alvestrand <harald@alvestrand.no>
Cc: public-media-capture@w3.org
A few points with respect to the recent additions to this thread:

1. Use seconds. Otherwise constraint queries will return results that are
not comparable in terms of user experience, due to sample rate differences
between devices. I already pointed out that sample rates in other parts of
an audio application may not be equal to the native sample rate of a device.

2. I agree that something like minimum or "typical" latency is of more
interest than a maximum or guarantee. The idea is for applications to
understand that a particular device may have high latency that is imposed
by the stack, not that it might have some unknown potential for high
latency.

3. Some devices may impose latency that has nothing to do with buffering in
the UA stack or its host OS, but are external in nature. For instance
remote-cast audio output devices like Chromecast and AppleTV have a very
long lag. I don't see that it makes sense to think of such latency in terms
of sample frames. That isn't like the latency values one sees in, say, ASIO
driver configuration (which are typically expressed in terms of buffer
size, but only because they reflect a world entirely internal to the
driver).

...Joe


On Fri, May 15, 2015 at 6:33 AM, Harald Alvestrand <harald@alvestrand.no>
wrote:

> Interesting - I'd completely forgotten about sampleRate and sampleSize.
>
> sampleSize is in bits and defined only on linear-sampling devices, so
> it's likely to be 8, 16 or 24.
>
> sampleRate is usually 8000, 16000, 44100 or 48000 (192000 at the extreme).
>
> So both these refer to a single audio sample; latency and sampleCount
> would be completely equivalent:
>
>   latency = sampleCount / sampleRate
>   sampleCount = latency * sampleRate
>
> But if the user specifies sampleCount without specifying sampleRate, he
> might get a completely different latency from what he wanted; it seems
> unlikely that the user's tolerance for latency would increase with worse
> sound quality.
>
> What does the user care about?
>
> Den 14. mai 2015 03:41, skrev Jonathan Raoult:
> > Sorry guys I just jumped in this thread.
> >
> > I'm very interested in this discussion specially on the low latency
> > side. I recently hit the "optimum buffer size for everyone" wall with
> > getUserMedia  and I would need something to adjust latency on capable
> > platform at least.
> >
> > What I noticed in music creation softwares (and other audio API as well)
> > is the use of frame count as input to adjust latency. Then the result in
> > ms calculated but only for display purposes. It would fit well with
> > sampleRate and sampleSize from MediaTrackSettings which are already low
> > level enough for the user to infer the latency in ms. It also have the
> > advantage of being precise, there not rounding or calculation to make
> > for the implementation.
> >
> > So to come back to the example, something like that is another solution:
> >
> > { sampleCount: { max: 20 } }
> >
> > Jonathan
> >
> >
> >
>
>
>


-- 
.            .       .    .  . ...Joe

*Joe Berkovitz*
President

*Noteflight LLC*
49R Day Street / Somerville, MA 02144 / USA
phone: +1 978 314 6271
www.noteflight.com
"Your music, everywhere"
Received on Friday, 15 May 2015 13:13:26 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:26:33 UTC