Subject: Re: [linux-audio-dev] Re: Latency test (RTcmix/Linux)
From: Benno Senoner (sbenno_AT_gardena.net)
Date: Sun Jul 30 2000 - 00:43:01 EEST
On Sat, 29 Jul 2000, Gary Scavone wrote:
> OK, I have a "duplex-mode" class that opens the device for operation.
> In some APIs, that means you open one device and read/write to that
> (OSS). In ALSA, you actually open two separate devices, though it
> might be doing something else below the API that I don't know about.
> In the class, I fill buffers and offset the read and write routines by
> BUFFER_SIZE/2. This is all single-threaded. My routines block at
> reads and writes until the audio device(s) are ready.
>
> In ALSA, there's a "params.buf.block.frags_max" parameter. I normally
> set that to 3, but in my tests I found that I could go to 2 and
> improve latency. So, the best case latency results were with 2
> fragments (again, I don't know exactly what is happening under the API
> layer). At 22050 Hz, I was able to take my BUFFER_SIZE down to 64
> sample frames without audible problems (which gave me about 18 ms
> latency). At 44100 Hz, I was able to use 32 sample frame buffers
> (which gave me about 10 ms latency).
what version o ALSA did you use ?
CVS or 0.5.x ?
In ALSA 0.5.x params.buf.block.frags_max = 3 means 4 effective fragments
so in theory 10msec would be 2 x 4 fragments of 64 frames each at 44.1kHz,
but the latency is influenced by DAC preloading too , and if you use an
external API or prebuilt class, you would need to track it down to the lowest
level that means look where the audio device is opened and what parameters
are passed and if there is an initial write() after before the read() / write()
loop starts.
Someday I will write a simple passthru app for OSS and ALSA so that users can
test the input-to-output latencies on their systems using the scope trick.
I do not know much about your card, but I guess you can achieve 5msec
input-to-output latency provided that you run a lowlatency kernel.
Benno.
This archive was generated by hypermail 2b28 : Sun Jul 30 2000 - 00:22:15 EEST