For the previous post of setup Karaoke with Sonos Beam, there’s a Raspberry with Behringer USB audio interface to do the ADC job. Because the digital Toslink only outputs signal when it’s driven to do so, some high level audio stack would be some prerequisite. Otherwise, the optical sends out no sound by default.
PulseAudio is the simplest option. Just install it and add a loopback module, which will automatically direct audio from input ports into output ports. But the audio latency is non-negligible, up to almost 600ms or more, causing some quite annoying echo effect. After some googling, there’s a startup param “latency_msec” to reduce it a bit. But the delay of the sound is still audible, as PA is stream based, so some stream buffer is always there, causing the latency.
Therefore, Jack audio system will be the final choice, which claims to be realtime. However, the qjackctl config app for Jack is QT based, requiring X window to display the UI properly. This article guides how to autostart qjackctl with LXDE. And this one will auto run graph with patchbay upon qjackctl’s running.
With Jack system, the latency is much better. Although no direct measurement is found, the hearing experience is acceptable that the voice from microphone seems almost instantly played together with the TV audio.