[LAD] Tests directly routing pc's midi-in to midi-out (was: Re: ALSA MIDI latency test results are far away from reality)

Ralf Mardorf ralf.mardorf at alice-dsl.net
Wed Jul 14 21:21:36 UTC 2010


On Wed, 2010-07-14 at 21:37 +0200, Arnout Engelen wrote:
> On Wed, Jul 14, 2010 at 08:09:29PM +0200, Ralf Mardorf wrote:
> > On Wed, 2010-07-14 at 19:56 +0200, Arnout Engelen wrote:
> > > On Wed, Jul 14, 2010 at 03:23:03PM +0200, Ralf Mardorf wrote:
> > > > I disconnected all audio connections for JACK and connected hw MIDI in
> > > > to hw MIDI out. connected the DX7 MIDI out directly to the D4 MIDI in and
> > > > then I reconnected to the PCI card.
> > > > 
> > > > The difference is alarming :(.
> > > > 
> > > > Yamaha DX7 --> Alesis D4 results in a 100% musical groove.
> > > > Yamaha DX7 --> PC --> Alesis D4 results in extreme latency
> > > 
> > > So here you're directly routing the MIDI IN to the MIDI OUT, and 
> > > experiencing latency. Are you using JACK here, or directly ALSA? In other 
> > > words, are you connecting 'in' to 'out' in the qjackctl 'MIDI' tab or in 
> > > the 'ALSA' tab?
> > 
> > I'm connecting MIDI in the Qtractor (quasi QjackCtl) ALSA MIDI tab.
> 
> OK, if that's causing noticable latency, there's something odd going on - and 
> we should first see if we can fix this: layering more stuff (jack, a2j, 
> fluidsynth, qtractor etc) on top of this (apparently) weak foundation will 
> just confuse us.
> 
> Before finding out how to prevent 'noticable latency' for this use case, I'd 
> say it would be good to try and quantify this for a bit. 
> 
> I took a MIDI Keyboard (m-audio keystation) and a Synth (Yamaha VL70-m), 
> connected them to each other directly, put a mic close to the keyboard, and
> hit a key repeatedly with my nail.

Hahaha, because the keys of my old metal case DX7 are very loud, I was
able to halfway go on grooving ;). I'm neither a keyboarder nor a
drummer, but a guitarist, anyway, playing with the right hand a ride
cymbal and with the left hand kick and snare is ok for me.
I don't need to record it, the sound of the keys came before the sound
of the sound module and there definitive never was played a sound,
before I touched the keys ;) ... for the sequencer I'm not sure if
events wont be played before they should be played ... and only for the
hw MIDI, internal the studio in the box everything is ok.

> The recording has a nice plastic 'tick' of me hitting the key with my nail,
> and the softsynth sound starting a fraction of a second later. Looking with 
> audacity, the total nail-to-synthsound latency is about 20-26ms.

I did something similar for my USB MIDI interface. I recorded short
sinus audio impulses and watched the waveforms by completely zooming in
using Audacity, but there's still the ambient noise level that makes it
impossible to see the absolut beginning of a signal. Jitter was around
+- 4 ms as far as I was able to interpret the waveforms. A short and
loud sinus impulse is the best signal I could produce to see a
difference to the ambient nose level. I didn't do this test for the PCI
MIDI.

> Then I plugged the synth into my USB audio/MIDI card (Edirol UA-25EX) and 
> connected the MIDI keyboard to my laptop (directly with USB). 
> 
> Did the same test again, recorded it, and the nail-to-synthsound latency now
> seems to be rougly in the 23-26ms range.
> 
> To *me*, this doesn't really seem to be a very noticable/problematic latency

That's right, it will become an issue when you will record HiHat, Snare,
Kick, Bass etc., the rhythm group one after the other or if you wish to
double a kick by two sounds etc..

> -
> but I'm not a keyboard player, I might not be so sensitive. I remember playing
> a MIDI wind controller at different latencies (I'm a saxophone player) - I'm 
> not sure if I could *hear* it, but I could sure *feel* the difference.

exactly, as soo as you play an instrument while there is latency and/or
jitter the feeling gets lost.

> 
> The wavs are at http://arnout.engelen.eu/files/dev/linuxmusicians/latencytests/
> for your enjoyment. Such beautiful music!
> 
> It might be interesting if you could make similar recordings - see what kind 
> of latency gets unacceptable, if the latency is mostly constant or very 
> jittery, if it's much bigger than here or that you're just more sensitive than
> me, etc.

At least I could record FluidSynth + external MIDI devices in unsion or
do the finger-nail-microphone test ...

> 
> 
> Arnout
> 
> (the laptop used in these tests is a 2ghz single-core debian machine without
> much tuning - the kernel doesn't even have preemption enabled, let alone the
> -rt patch)

I've got a long todo list :( now. If I should forget something I should
do, aske me again to do it ;).

- Ralf





More information about the Linux-audio-dev mailing list