Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

From squeeze to wheezy, latency 5ms to 30ms

4 views
Skip to first unread message

Peter Billam

unread,
May 15, 2013, 5:32:30 AM5/15/13
to
Greetings again. As part of the test script for my modules
http://www.pjb.com.au/comp/lua/midialsa.html
http://search.cpan.org/perldoc?MIDI::ALSA
there's a test for reasonable latency. The test client sends itself
an event, and subtracts the times; this is the perl version:
@correct = (11, 1, 0, 1, 2.5, [$id,2], [$id,1], [0, 0, 0, 0, 0, 99] );
$rc = MIDI::ALSA::output(@correct);
$rc = MIDI::ALSA::inputpending();
@alsaevent = MIDI::ALSA::input();
$latency = int(0.5 + 1000 * ($alsaevent[4]-$correct[4]));
ok($latency < 20, "latency was $latency ms");

(within these modules, time is expressed in floating point sec)

From debian squeeze to wheezy, on the same machine,
the measured latency has increased from 5ms to 30ms :-(
That's from good to almost unuseable, a terrible result.
It's quite consistent. Is this a known phenomenon ?

On wheezy, I now (unwillingly) have pulseaudio installed
(and disabled) and I hear that has a pretty bad audio latency,
but that doesn't affect midi does it ?
I was running 2.6.32-5-686, now 3.2.0-4-686-pae ...

Regards, Peter

--
Peter Billam www.pjb.com.au www.pjb.com.au/comp/contact.html

Clemens Ladisch

unread,
May 15, 2013, 2:44:59 PM5/15/13
to
Peter Billam wrote:
> Greetings again. As part of the test script for my modules
> http://www.pjb.com.au/comp/lua/midialsa.html
> http://search.cpan.org/perldoc?MIDI::ALSA
> there's a test for reasonable latency. The test client sends itself
> an event, and subtracts the times; this is the perl version:
> @correct = (11, 1, 0, 1, 2.5, [$id,2], [$id,1], [0, 0, 0, 0, 0, 99] );
> $rc = MIDI::ALSA::output(@correct);
> $rc = MIDI::ALSA::inputpending();
> @alsaevent = MIDI::ALSA::input();
> $latency = int(0.5 + 1000 * ($alsaevent[4]-$correct[4]));
> ok($latency < 20, "latency was $latency ms");
>
> From debian squeeze to wheezy, on the same machine,
> the measured latency has increased from 5ms to 30ms :-(

Strange. Nothing should have changed.

How is the input timestamp measured?
What are the contents of /proc/asound/seq/timer while the queue is running?


Regards,
Clemens

Peter Billam

unread,
May 15, 2013, 9:28:28 PM5/15/13
to
I wrote:
> an event, and subtracts the times; this is the perl version:
> @correct = (11, 1, 0, 1, 2.5, [$id,2], [$id,1], [0, 0, 0, 0, 0, 99] );
> $rc = MIDI::ALSA::output(@correct);
> $rc = MIDI::ALSA::inputpending();
> @alsaevent = MIDI::ALSA::input();
> $latency = int(0.5 + 1000 * ($alsaevent[4]-$correct[4]));
> ok($latency < 20, "latency was $latency ms");

Sorry Clemens: a false alarm...

On 2013-05-15, Clemens Ladisch <cle...@ladisch.de> wrote:
> Strange. Nothing should have changed.
> How is the input timestamp measured?

Ah, well, erm, 2.5 was intended to be Sometime In The Future,
but I must have introduced an extra test which happened at 2.5 sec
and forgotten to increment the time for the latency test :-(
so what my latency test had been measuring was the perl
execution speed, not the alsa midi latency...

(These numbers are a bit hard-coded, I agree, but specifying
nice round numbers makes some comparisons-for-equality easier
later on in the test script.)

You'll be glad to know that the alsa latency now measures 0 ms :-)
in fact 5 microseconds ! (which seems amazing to me, now that
I've been looking at figures like 4 ms and 5 ms for so long)

Thanks for your help,
0 new messages