Lowest possible latency
Moderator: flatmax
Re: Lowest possible latency
It busy writes... i.e. it loops on the write till all is written.
One idea is to increase the thread priority in a similar way to jackd :
https://github.com/jackaudio/jack2/blob ... d.cpp#L113
There they up the thread priority and enable FIFO scheduling :
#define JACK_SCHED_POLICY SCHED_FIFO
The latency you see is most likely two periods totaling 667 us (about half a millisecond).
Matt
One idea is to increase the thread priority in a similar way to jackd :
https://github.com/jackaudio/jack2/blob ... d.cpp#L113
There they up the thread priority and enable FIFO scheduling :
#define JACK_SCHED_POLICY SCHED_FIFO
The latency you see is most likely two periods totaling 667 us (about half a millisecond).
Matt
Check out our audiophile quality crossovers : https://bit.ly/2kb1nzZ
Please review the Zero sound card on Amazon USA : https://www.amazon.com/dp/B075V1VNDD
---
Check out our new forum on github : https://github.com/Audio-Injector
Please review the Zero sound card on Amazon USA : https://www.amazon.com/dp/B075V1VNDD
---
Check out our new forum on github : https://github.com/Audio-Injector
Re: Lowest possible latency
Well, if 64 is the latency, then it is pretty good. I'd definitely settle for < 1ms throughput latency.
Anyway, I tried to setup an asymmetric alsa device, like so:
and tried to use "default" as device name, but the full duplex test fails to open the device, however the patest_wire app does manage to open it though. This is pretty much the last "ground work" I need for my application.
Anyway, I tried to setup an asymmetric alsa device, like so:
Code: Select all
/etc/asound.conf:
pcm.ladspa {
type ladspa
slave.pcm "plughw:0"
path "/usr/lib/ladspa"
plugins [{
# Reverb plugin from the CAPS LADSPA plugin collection
# (http://quitte.de/dsp/caps.html)
label PlateX2
input {
controls [0.75 0.5 0.25 0.5]
}
}]
}
and in ~/.asoundrc:
pcm.!default {
type asym
playback.pcm "plug:ladspa"
capture.pcm "plughw:0"
}
Re: Lowest possible latency
Sweet ... let us know how it goes ... perhaps if you can take a picture, video or sound or something ?!?!
Also a block diagram would be nice But no sweat, I am sure that you are very busy with your projects and may not have time to do that.
Also a block diagram would be nice But no sweat, I am sure that you are very busy with your projects and may not have time to do that.
Check out our audiophile quality crossovers : https://bit.ly/2kb1nzZ
Please review the Zero sound card on Amazon USA : https://www.amazon.com/dp/B075V1VNDD
---
Check out our new forum on github : https://github.com/Audio-Injector
Please review the Zero sound card on Amazon USA : https://www.amazon.com/dp/B075V1VNDD
---
Check out our new forum on github : https://github.com/Audio-Injector
Re: Lowest possible latency
Actually, I now been able to run alsaloop with a latency of 48 frames @ 48 kHz, which means a total of 1ms SW latency. Awesome! I had to use chrt to heighten process to realtime status though. But now it works without a glitch, running the LADSPA reverb
True, I might not have the time to write that up, but it actually was pretty easy:
1. Setup a LADSPA plugin within ALSA:
2. Use alsaloop to pipe from capture to playback (optionally with chrt to heighten priority of process):
Now, of course, is the job to fix the actual filtering plugin
True, I might not have the time to write that up, but it actually was pretty easy:
1. Setup a LADSPA plugin within ALSA:
Code: Select all
pcm.ladspa {
type ladspa
slave.pcm "plughw:0"
path "/usr/lib/ladspa"
plugins [{
# Reverb plugin from the CAPS LADSPA plugin collection
# (http://quitte.de/dsp/caps.html)
label PlateX2
input {
controls [0.75 0.5 0.25 0.5]
}
}]
}
Code: Select all
>[chrt -rr 70] alsaloop -C plughw:0 -P plug:ladspa --latency <latency in frames>
Re: Lowest possible latency
Matt, I've measured the latency in/out to about 2.5 ms, so a part of that must be the analog <-> I2S latencies. I've tried to find info about that in the Wolfson datasheets but could not find anything. Do you have the possibility to short circuit I2S so that you can measure the ADC -> I2S -> DAC path (i.e. eliminating ALSA) ?
Re: Lowest possible latency
I'd be very interested in any progress in this venue.
I've got a third party input device (USB) that ALSA allows us to set a buffer (at 48k) of as low as 8frames (less than 200 microseconds), so I know it's really not ALSA per se..
I'm more interested in the input (not using the output portion as this is a streaming engine for me).
has anybody been able to get sub 32 frame length?
I've got a third party input device (USB) that ALSA allows us to set a buffer (at 48k) of as low as 8frames (less than 200 microseconds), so I know it's really not ALSA per se..
I'm more interested in the input (not using the output portion as this is a streaming engine for me).
has anybody been able to get sub 32 frame length?
Re: Lowest possible latency
I have not anyway. Looking at the I2S spec of the RPi, it should be possible to get really low latency by lowering the FIFO IRQ threshold of the I2S subsystem, but I have no idea if it is possible to config the current I2S driver for this.
Btw, which USB unit are you using for the 8 frame setup ?
Btw, which USB unit are you using for the 8 frame setup ?
Re: Lowest possible latency
thx.
i've tried several different preamps - Tascam, Focusrite,and Presonus...
they vary, but all could get well below 24 frames without issue.
i've tried several different preamps - Tascam, Focusrite,and Presonus...
they vary, but all could get well below 24 frames without issue.
Re: Lowest possible latency
USB can't have a latency which is low because of the UAC2 or UAC protocol which is used over USB. Typically packets of audio are transmitted over USB which doesn't allow for much less then 3 ms (from memory) of latency. The concept of getting true latency of 8 frames (167 us @48kHz) over USB would be incredible !
The latencies we are talking about here are typically within the DMA process in ALSA. Typically Codecs have 1 sample of latency. I imagine that the incoming audio bits get fed directly to the sigma delta converters in some way.
You can set the number of periods and the size of the period in am audio buffer with ALSA. That is the means to tuning the latency. With zero computational load and only memory copies and heightened scheduling priority, you can probably get reliable latencies down to 0.5 ms.
Matt
The latencies we are talking about here are typically within the DMA process in ALSA. Typically Codecs have 1 sample of latency. I imagine that the incoming audio bits get fed directly to the sigma delta converters in some way.
You can set the number of periods and the size of the period in am audio buffer with ALSA. That is the means to tuning the latency. With zero computational load and only memory copies and heightened scheduling priority, you can probably get reliable latencies down to 0.5 ms.
Matt
Check out our audiophile quality crossovers : https://bit.ly/2kb1nzZ
Please review the Zero sound card on Amazon USA : https://www.amazon.com/dp/B075V1VNDD
---
Check out our new forum on github : https://github.com/Audio-Injector
Please review the Zero sound card on Amazon USA : https://www.amazon.com/dp/B075V1VNDD
---
Check out our new forum on github : https://github.com/Audio-Injector
Re: Lowest possible latency
Yes, I've tried to query Cirrus for the analog<->digital latency of the WM8731 codec, haven't got any response so far. ADI has a "low-latency" codec which they say have about 150us analog<->digital latency (@48KHz), so I imagine the WM8731 will have the same or more than that. So just the HW of the codec will add at least 0.3 ms of latency. Then there's the FIFO in the RPi I2S subsystem, which will have at maximum 32 frames (stereo) in/out latency (the FIFOs are 64 samples long).
So, because the FIFOs are fixed in length, I suspect the Octocard to have a lot less latency since 8 channels will fill up the FIFOs much faster.
Who is online
Users browsing this forum: No registered users and 4 guests