[LAD] RME madi latency

Adrian Knoth adi at drcomp.erfurt.thur.de
Sat Feb 6 18:18:15 UTC 2016


On 02/06/16 18:54, Fons Adriaensen wrote:

>> Ok, just to be clear: I *am* able to get the expected latency using
>> jack (around 3.5ms with a period=32 and nperiods=256).
>> but using my own alsa wrapper (and also using zita-alsa-pcmi) the
>> latency is >170ms
> You probably mean nperiods = 2 ???

Well, that's what's happening under the hood. The MADIFX, AIO and RayDAT
cards have a fixed-size hw buffer. The HW pointer always operates on the
entire buffer, the question is how many interrupts are generated on its
way from start to end.

On my RayDAT card:

creating alsa driver ... 
hw:HDSPMxf1cd85|hw:HDSPMxf1cd85|1024|2|48000|0|0|nomon|swmeter|-|32bit
configuring for 48000Hz, period = 1024 frames (21.3 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: use 16 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 16 periods for playback

Note the "2 periods" but then later "use 16 periods", because it's a
16kSample buffer for each channel.

With a lower period size, the number of periods goes up:

creating alsa driver ... 
hw:HDSPMxf1cd85|hw:HDSPMxf1cd85|512|2|48000|0|0|nomon|swmeter|-|32bit
configuring for 48000Hz, period = 512 frames (10.7 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: use 32 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 32 periods for playback

1024*16 == 512 * 32. The invariant is the same for every latency you
choose:

configuring for 48000Hz, period = 32 frames (0.7 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: use 512 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 512 periods for playback

The MADIFX has an 8kSamples-per-channel HW buffer, which is why Fokke
reported 32*256 == 8k initially.


HTH


More information about the Linux-audio-dev mailing list