Audio passthrough using alsaloop

 

Audio passthrough using alsaloop

To offer a good audio quality on both input and outputs our DAC+ ADC cards do not use a so-called “Codec” chip with input and output functionality, but completely independent DAC and ADC sections. One minor disadvantage of this design is that there is no “pass-through” functionality that just passes input audio to the output. However it can be easily implemented in software. A simple tool for this use case is alsaloop.

alsaloop -r 48000 -C hw:0 -P hw:0 -l 256 -s 0 -U

This starts a process that copies data from the input to the output. The requested latency is 256 samples which corresponds to about 5ms. Smaller buffer sizes (the “-l” option) will reduce latency, but tend to create problems with buffer underruns. To understand latency and what you can do about it, have a look at our TechTelk about latency.

Another important parameter is the “-s 0” option. This tells alsaloop to just copy samples from the input to the output without processing them. This works with the DAC+ ADC (Pro) as input and output always run completely synchronously. You won’t be able to do this when using alsaloop with independent sound cards (e.g. a HiFiBerry DAC and a USB sound card).

alsaloop seems to work best with 44.1/48kHz sample rate, but you can also try to use higher sample rates. We have seen some crashes of alsaloop with 192kHz, but using different options might help. Just have a look at the manual page to understand all options of this tool.

Please note that this guide comes “as-is”. We do not offer support for it. Some options might change in future software versions. Therefore, you should consult the manual page if something isn’t working as expected.

Last updated: July 13, 2022