To find out the delay introduced by the sound card, jack has a nice tool installed by default: jack_iodelay
Start it and jack_connect the in to hw-out and vice versa, and read every second the frames and ms on the command line.
Needs a cable from the output to the input of the sound card!
For starting and connection jack a gui like qjackctl works nicely.
aplay -L # find your correct hw:xxx sound card name for -dXXX below. plughw introduces bad sample rate conversion, find something with hw:CARD= and USB.
jackd -t 2000 -R -P 95 -d alsa -d hw:pisound -r 48000 -p 64 -n 2 -X seq -s
jack_iodelay
jack_connect jack_iodelay:out system:playback_1
jack_connect jack_iodelay:in system:capture_1
The async mode uses one extra buffer to conceal glitches, but is only needed under heavy load or many plugins.
Some cheap dongles have only mic and speaker out on mini TRS that cannot be shortcut-looped together without external circutry. That is thankfully very easy, see jack_latency_tests
[ 45.199157] usb 1-1: new full-speed USB device number 5 using xhci_hcd
[ 45.349650] usb 1-1: New USB device found, idVendor=0d8c, idProduct=0014, bcdDevice= 1.00
[ 45.349655] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 45.349659] usb 1-1: Product: USB Audio Device
[ 45.349662] usb 1-1: Manufacturer: C-Media Electronics Inc.
[ 45.352410] input: C-Media Electronics Inc. USB Audio Device as /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.3/0003:0D8C:0014.0003/input/input32
[ 45.411462] hid-generic 0003:0D8C:0014.0003: input,hidraw2: USB HID v1.00 Device [C-Media Electronics Inc. USB Audio Device] on usb-0000:00:14.0-1/input3
[ 45.456775] usbcore: registered new interface driver snd-usb-audio
Hab 5 Stück im Dauereinsatz, von amazon.de (externe Soundkarten #1)
gelistet auch bei anderen Raspberry audio-Projekten. Leider sieht man oft erst was drin ist wenn man unter Linux auf der Kommandozeile nachschaut;-)
Der kann Klanglich bei perfekten Kopfhörern nicht mit >100Eur AudioInterfaces mithalten, und sie haben letztes Jahr die Mikrofonspannung von 5V auf 3V reduziert so dass laut Bewertungen nicht mehr alle Mic gehen. Die Headphones die ich Zuhause hab sind alle OK, mehrere Stunden getestet.
Vorsicht beim Kauf, gut Testen - Den USB von CreativeLabs kann ich z.B. nicht empfehlen, der verzerrt sehr schmerzhaft.
Hi…Regardless of whether there were a genuine detour this wouldn’t be important for the sound preparing impacts, since they need to go through the sound chain. Consequently the ‚delicate‘ sidestep is the significant one. I concur that the 5ms seem as though the buffering delay. Presumably the 128 examples ping pong at 48kHz. Anyway 3ms for ADC and DAC appears a lot to me and would mean the mystical number of 2ms would never be accomplished.
@DellyRosen thanks for you thoughts!
I do DSP and low-level real time since 2003 and you’re right, the pure conversion does not take several milisecs - its less than one. I don’t want to go into the single steps from sigma-delta to Jack but state that there is time buffering involved wherever something is copied, and between ADC and USB, DMA and linux kernelspace and userspace alsa, and then to jack, you can’t make it without copy.
Since a regular OS scheduler might take a lot of time, worst case 100ms is happening, you must tune a real time OS scheduler to e.g 1ms, that is about the best you can get. That is precisely the reason digital-stage-box uses a RT Linux on Raspi, and the CPU does nothing but audio.
Once your OS is nicely tuned, it might be worth using a Thunderbolt or I2S audio interface to cut down another ms of USB latency and jitter.
I always have <10ms acoustic latency in LAN with all my USB sound cards, and need to increase the buffers a little for real Internet.
But if you’re experiencing >40ms ping, it’s all for nothing.