[LAD] ALSA MIDI latency test results are far away from reality

Ralf Mardorf ralf.mardorf at alice-dsl.net
Wed Jul 14 15:10:59 UTC 2010


On Wed, 2010-07-14 at 15:52 +0200, Clemens Ladisch wrote: 
> Ralf Mardorf wrote:
> > 1.
> > 
> > I disconnected all audio connections for JACK and connected hw MIDI in
> > to hw MIDI out.
> 
> Is this connection through JACK or through ALSA, i.e., does it show up
> in the output of "aconnect -l"?  From what I understand, JACK's sample-
> synchronous timing always adds latency, and might add period-related
> jitter depending on the implementation.

Qtractor at the moment is ALSA MIDI only and I even didn't use the -Xseq
bridge.


> > Yamaha DX7 --> Alesis D4 results in a 100% musical groove.
> > Yamaha DX7 --> PC --> Alesis D4 results in extreme latency,
> 
> With a single MIDI loopback cable, the latency test program tests
> a "PC --> PC" connection.  A more realistic test would be
> "PC1 --> PC2 --> PC1" (or just one PC if it has two inputs and two
> outputs).

I've got 1 USB MIDI and two PCI MIDI by 2 Terratec EWX 24/96 Envy24
based sound cards. I'll avoid to ever connect the USB MIDI to my machine
again (as I'll avoid to install ever a Windows to it again ;).

Next month I could buy another MIDI adaptor cable and run
alsa-midi-latency-test by using both PCI cards.

I bring myself to connect the USB MIDI one more time ;).



64 Studio 3.3 alpha

$ su -c "poff dsl-provider"
$ su -c "cpufreq-selector -g performance"
$ uname -a
Linux 64studio 2.6.31-2-multimedia-amd64 #1 SMP PREEMPT RT Thu Oct 1
16:14:20 BST 2009 x86_64 GNU/Linux.

$ alsa-midi-latency-test -l
 Port    Client name                      Port name
 14:0    Midi Through                     Midi Through Port-0
 16:0    TerraTec EWX24/96                TerraTec EWX24/96 MIDI
 20:0    USB Device 0x170b:0x11           USB Device 0x170b:0x11 MIDI 1
 24:0    TerraTec EWX24/96                TerraTec EWX24/96 MIDI



########################################################################
### ONE OF THE PCI CARDS
########################################################################



$ alsa-midi-latency-test -Rrw=5 -i16:0 -o16:0
> alsa-midi-latency-test 0.0.3
> set_realtime_priority(SCHED_FIFO, 99).. done.
> clock resolution: 0.000000001 s

> sampling 10000 midi latency values - please wait ...
> press Ctrl+C to abort test

sample; latency_ms; latency_ms_worst
     0;       1.05;       1.05     
   787;       1.06;       1.06     
  1227;       1.06;       1.06     
  8738;       1.07;       1.07     
  9999;       1.00;       1.07     
> done.

> latency distribution:
...
  1.0 -  1.1 ms:     9992
##################################################
  1.1 -  1.2 ms:        8 #

> SUCCESS

 best latency was 0.99 ms
 worst latency was 1.07 ms, which is great.



########################################################################
### THE USB MIDI WITH AN UNLUCKY ENTRY FOR THE RTIRQ SCRIPT
########################################################################



Usually I keep Rui's entries for the script.

$ cat /etc/default/rtirq | grep RTIRQ
RTIRQ_NAME_LIST="rtc snd i8042"
RTIRQ_PRIO_HIGH=98
RTIRQ_PRIO_DECR=5
RTIRQ_RESET_ALL=0
RTIRQ_NON_THREADED="rtc snd"
# RTIRQ_HIGH_LIST="timer"

$ alsa-midi-latency-test -Rrw=5 -i20:0 -o20:0
> alsa-midi-latency-test 0.0.3
> set_realtime_priority(SCHED_FIFO, 99).. done.
> clock resolution: 0.000000001 s

> sampling 10000 midi latency values - please wait ...
> press Ctrl+C to abort test

sample; latency_ms; latency_ms_worst
     0;       2.21;       2.21     
  9999;       1.99;       2.21     
> done.

> latency distribution:
...
  1.9 -  2.0 ms:        2 #
  2.0 -  2.1 ms:     9997
##################################################
...
  2.2 -  2.3 ms:        1 #

> SUCCESS

 best latency was 1.95 ms
 worst latency was 2.21 ms, which is great.



########################################################################
### PCI MIDI out --> USB MIDI in
########################################################################



$ alsa-midi-latency-test -Rrw=5 -i20:0 -o16:0
> alsa-midi-latency-test 0.0.3
> set_realtime_priority(SCHED_FIFO, 99).. done.
> clock resolution: 0.000000001 s

> sampling 10000 midi latency values - please wait ...
> press Ctrl+C to abort test

sample; latency_ms; latency_ms_worst
     0;       2.03;       2.03     
   186;       2.04;       2.04     
  2726;       2.04;       2.04     
  9999;       1.99;       2.04     
> done.

> latency distribution:
...
  1.9 -  2.0 ms:        2 #
  2.0 -  2.1 ms:     9998
##################################################

> SUCCESS

 best latency was 1.92 ms
 worst latency was 2.04 ms, which is great.



########################################################################
### USB MIDI out --> PCI MIDI in
########################################################################



$ alsa-midi-latency-test -Rrw=5 -i16:0 -o20:0
> alsa-midi-latency-test 0.0.3
> set_realtime_priority(SCHED_FIFO, 99).. done.
> clock resolution: 0.000000001 s

> sampling 10000 midi latency values - please wait ...
> press Ctrl+C to abort test

sample; latency_ms; latency_ms_worst
     0;       1.14;       1.14     
     1;       1.93;       1.93     
     2;       1.99;       1.99     
     5;       2.00;       2.00     
     6;       2.00;       2.00     
    13;       2.01;       2.01     
    22;       2.03;       2.03     
    36;       2.03;       2.03     
    51;       2.03;       2.03     
    65;       2.03;       2.03     
   265;       2.04;       2.04     
  1160;       2.04;       2.04     
  2267;       2.07;       2.07     
  9999;       1.96;       2.07     
> done.

> latency distribution:
...
  1.1 -  1.2 ms:        1 #
...
  1.9 -  2.0 ms:       31 #
  2.0 -  2.1 ms:     9967
##################################################
  2.1 -  2.2 ms:        1 #

> SUCCESS

 best latency was 1.14 ms
 worst latency was 2.07 ms, which is great.



$ cd /etc/init.d
$ ./rtirq status

  PID CLS RTPRIO  NI PRI %CPU STAT COMMAND	
  388 FF      95   - 135  0.0 S<   irq/8-rtc0	
 1119 FF      90   - 130  0.0 S<   irq/21-ICE1712	
 1115 FF      89   - 129  0.0 S<   irq/20-ICE1712	
  381 FF      85   - 125  0.0 S<   irq/1-i8042	
  380 FF      84   - 124  0.0 S<   irq/12-i8042	
  102 FF      50   -  90  0.0 S<   irq/9-acpi	
  539 FF      50   -  90  0.0 S<   irq/16-ohci_hcd	
  588 FF      50   -  90  0.0 S<   irq/19-ehci_hcd	
  590 FF      50   -  90  0.0 S<   irq/22-ahci	
  601 FF      50   -  90  0.0 S<   irq/14-ide0	
  603 FF      50   -  90  0.0 S<   irq/17-ohci_hcd	
  604 FF      50   -  90  0.0 S<   irq/22-ohci1394	
  608 FF      50   -  90  0.0 S<   irq/18-ohci_hcd	
  611 FF      50   -  90  0.0 S<   irq/17-ohci_hcd	
  614 FF      50   -  90  0.0 S<   irq/18-ohci_hcd	
  943 FF      50   -  90  0.0 S<   irq/7-parport0	
 1670 FF      50   -  90  0.2 S<   irq/18-nvidia	
 1984 FF      50   -  90  0.0 S<   irq/26-eth0	
    4 FF      49   -  89  0.0 S<   sirq-high/0	
    5 FF      49   -  89  0.0 S<   sirq-timer/0	
    6 FF      49   -  89  0.0 S<   sirq-net-tx/0	
    7 FF      49   -  89  0.0 S<   sirq-net-rx/0	
    8 FF      49   -  89  0.0 S<   sirq-block/0	
    9 FF      49   -  89  0.0 S<   sirq-tasklet/0	
   10 FF      49   -  89  0.0 S<   sirq-sched/0	
   11 FF      49   -  89  0.0 S<   sirq-hrtimer/0	
   12 FF      49   -  89  0.0 S<   sirq-rcu/0	
   18 FF      49   -  89  0.0 S<   sirq-high/1	
   19 FF      49   -  89  0.0 S<   sirq-timer/1	
   20 FF      49   -  89  0.0 S<   sirq-net-tx/1	
   21 FF      49   -  89  0.0 S<   sirq-net-rx/1	
   22 FF      49   -  89  0.0 S<   sirq-block/1	
   23 FF      49   -  89  0.2 S<   sirq-tasklet/1	
   24 FF      49   -  89  0.0 S<   sirq-sched/1	
   25 FF      49   -  89  0.0 S<   sirq-hrtimer/1	
   26 FF      49   -  89  0.0 S<   sirq-rcu/1

- Ralf


> 
> 
> Regards,
> Clemens






More information about the Linux-audio-dev mailing list