[Gta04-owner] Low latency audio routing

Jonas Smedegaard dr at jones.dk
Thu Jan 19 22:18:50 CET 2012

On 12-01-19 at 10:05pm, Jonas Smedegaard wrote:
> On 12-01-19 at 09:39pm, Radek Polak wrote:
> > 
> > I think i made some progress. Here are my current scripts:
> > 
> > arecord -B 4 -fS16_LE | aplay -B 4 -Dhw:1,0 &
> > arecord -Dhw:1,0 -B 4 -fS16_LE | aplay -B 150000 &
> > 
> > Basically i am trying to get the buffers as small as possible with 
> > the -B parameter.
> [snip]
> > There is one thing i am still not understanding. If you try to use 
> > small buffer in the second command (e.g. 100000 instead of 150000), 
> > you will get underruns but with 150000 you don't get them. To me it 
> > looks like the soundcard does not like small buffers, but we need 
> > them for low latencies. Any ideas?
> Perhaps try experiment with --buffer-size option instead of 
> --buffer-time (a.k.a. -B) for aplay.  Both because that might be more 
> exact, and because - judging from its manpage - there may be some 
> internal fallback defaults when arguments are outside of acceptable 
> range, so you may not be testing your actual values.
> ...but I am just guessing here - not experienced in this field.

Update: Try _generally_ play with --buffer-size instead of -B as I 
notice now that arecord and aplay share options.

The point is that I suspect that the key to succesfully use small 
buffers is to use _exact_ buffers.  Possibly you need to also set the 
frame size explicitly: Sounds likely that the default buffersize/4 won't 
hold for very small buffers.

Maybe play with jackd and very low buffers to learn the limits of the 
soundcard (because jackd may have better debug info and more detailed 
documentation and discussions about buffersizes vs. framesizes), and 
then apply that gained knowledge to the simpler ALSA tools.

 - Jonas

 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.goldelico.com/pipermail/gta04-owner/attachments/20120119/e41b44a9/attachment.bin>

More information about the Gta04-owner mailing list