back to list

Midi relaying speed test

🔗Robert Walker <robertwalker@...>

6/19/2003 7:14:55 PM

Hi there,

I've just been improving my midi relaying speed test in FTS (found a few
bugs - mainly that if the relaying app changed the channel then it wouldn't
find the note again after it got relayed around).

With a 14 note cluster, Scala averages a bit over 0.4 milliseconds for
the note on and a bit under 0.3 for the note off, you'll be glad to know!

That's not much more than direct relaying from in to out which is 0.2 to 0.3 ms
here for the round trip. There seems to be an overhead of about 0.1 milliseconds to send
a midi note on via midi out (if I time how long the Windows function call takes),
and then if it gets relayed by another app. and sent back again, that timing overhead
is incurred twice, and maybe there is another fraction of a millisecond involved
somewhere else in the relaying process. It seems a little over 0.25 milliseconds is
about as fast as it can go. (That's just for my particular machine of course).
SCALA would be sending pitch bend messages as well which probably accounts for
most of the extra time for the note on.

(BTW in Windows programming you can only time things to the nearest millisecond - but
if you make hundreds of identical calls and then average the times then you get
accurate values for the time taken to a fraction of a millisecond)

FTS averages about 1.7 ms for the note on and about 0.7 ms
for the note off. So SCALA is faster. When FTS relays directly from
Midi in to Midi out it is approximately the same speed as SCALA.

So I think all the midi relaying features in FTS are slowing things
down a bit. I did a timing check in FTS to find out where the
delays are happening, and there is no one place
that is particularly delaying it. Rather, it is a case of
0.1 milliseconds or so here, another 0.1 here, and it all adds up.

I've got a tiny retuning sequencer that I did that relays
its notes using a single instrument (which simplifies the channel remapping),
and that one is as fast as SCALA.

So, I need to work on this. I think 1.7 ms is large enough to
be occasionally noticeable e.g. in a very fast glissando or dense chords.

I'll maybe work from the top down and see if I can make faster tests
to skip the various sections that are only needed occasionally.

Or - I suppose I might work the other way and start with the code from the
tiny retuning sequencer which is already as fast as it can possibly
go, and add all the FTS features to it gradually, carefully checking
the latency at each stage.

Anyway more later. But I think one would be hard pressed to notice
anything here in a chord of say six notes (six notes = one hundredth
of a second latency at 1.7 ms per note which is the same as the minimum
latency setting for the FM7). With SCALA you would need a 25 note
chord to get this much latency.

Anyone know what is the smallest variation in note onset that
leads to perception of a chord as ragged? I suppose like
most of these things it probably depends a lot on ones experiences
or training.

(Of course real life music nearly always has perceptibly slightly
ragged chords anyway if you listen for them - sometimes
deliberately with a soloist either ahead or behind
the accompaniment by a tiny fraction of a second for effect
- before is incisive, after is laid back and dreamy).

Cheers,

Robert

🔗Robert Walker <robertwalker@...>

6/19/2003 7:30:20 PM

Hi there,

Just another note on the test.

It uses midi relaying twice - to send the note to the
midi in of the other app and to receive it back again.

Test -> SCALA -> Test

0.1 ms 0.1 ms

+ 0.5 ms or so somewhere, not known yet where it happens.

If relaying from midi in it would be

Midi In -> SCALA -> Midi Out.

?? 0.1 ms

where ?? is the time it takes to get
from your midi keyboard to SCALA.

Thanks,

Robert

🔗Robert Walker <robertwalker@...>

6/19/2003 9:21:48 PM

Hi Jeff,

Thanks!

Robert