Another day, another "interesting" bug .
First the good news. Using the setup described in my previous post does indeed seem to work fine in terms of USB bandwidth. The ultimate test will come when I actually have 3 incoming streams and one outgoing one simultaneously over USB, but that will be for another day .
The other snippet of good news is that ALSA and jackd seem to work fine with 16-bit word length at both 441.KHz and 48KHz in Raspbian on my Pi 4
However, if I try outputting anything at 24-bit/44.1KHz , I get static with some barely audible music in the background . If I choose any other sample rate (32KHz, 48KHz, 96KHz) at 24 bits, everything works fine . If I force 16-bit mode in jackd , 44.1KHz works fine too . So it is only the 24-bit/44.1KHz combination that does not work properly . I have reproduced this with 2 different USB sound cards (Fiio E10K and Roland UA4FX). My initial testing was with VLC using the jack plugin and with resampling disabled . Format is S24_3LE in all 24-bit modes, if anyone is interested . EDIT : I used audio files with appropriate word length an sample rate for all tests .
I then moved on testing with aplay and was able to reproduce the issue immediately , so it is not a jack issue, but an ALSA related one . Finally, I decided to try the E10K with aplay on a current Debian x64 machine running the same version of ALSA as the Pi 4 and it worked fine on the first try ! EDIT: at 24-bit and 44.1KHz .
Next step is to try it on Ubuntu running on the Pi 4 . If that does not work, I will have to stick to 48KHz at 24 bits for output .
The reason I want 24-bit output is the avoid clipping on the off chance the 3 S/PDIF inputs were to peak at the same time . If my math is correct, 3 16-bit sources at peak, added together, would require a bit less than 18 bits in order to avoid clipping .
If anyone is curious, I plan to get around the fact that the input clocks and the output will not be in sync and not necessarily have the same sample rate by using zita-ajbridge between a jackd output device and ALSA hardware inputs . The plan is then to use a software mixer like jackmix (or something similar) .
EDIT : Same problem in Ubuntu 64-bit on Pi 4 . Using ALSA, S24_3LE at 44.1KHz is broken, but S24_3LE at 96 KHz, for example, works fine . Again, S16_LE works fine at 44.1KHz .
EDIT2 : Corrected typos, I meant S24_3LE not S24_LE
EDIT3 : The USB bandwidth issue and workaround (using the integrated USB 2.0 controller) are described here https://github.com/raspberrypi/linux/issues/3962