1 (edited by etluxperpetuam 2012-12-06 11:42:53)

Topic: MIDI Speed PCI/PCIe v. USB

Hello.

I've been an RME user for only a short while - 7-8 months. I own a UFX unit and am very impressed.

I am planning to build myself an ultra low latency (ULLI anyone? smile MIDI performance station. Now once you realize that MIDI is a very quirky thing, you start looking for a combination of LL performace items; the DAW has to run with the lowest possible buffer so that real time timing errors are minimized and then the speed of the MIDI interface itself has to be as low as possible so that you get an immediate real time feel for your instrument. Of course, that's not all; you have to factor in the speed of the keyboard or whatever triggering device you are using too! So getting a true real time feel for a virtual instrument is no simple thing. It's not like plugging in your fastest audio interface (by RME) and starting recording audio and living happily everafter.

In any case, the faster you can get each individual item in the chain the better off you will be. I've been experimenting with processing my guitar performance in real time in the DAW and I seem to have a cutoff at around 4,5 to 5 ms for when I really start feeling the latency and losing the immediate / intimate feel of the acoustic instrument. The UFX has been serving me great in that department. However, I'm only now beginning with my MIDI performance station build and have only conducted a few MIDI tests with my existing equipment: the UFX and an M-Audio Axiom 61, using Mac OS. I've done some performance tests where I recorded the audio of my keypress and compared that to the appearance of the MIDI note at the DAW, and the appearance of the Audio output at the DAW. I've measured keypress to audio output at 32 samples buffer setting at 96K to be around 7,5ms (10 measurements, max 8.85ms, min 5.78ms, and that’s a jitter range of 3.07ms; oi!). Think about that for a moment. 32 samples of buffer means that once the DAW receives the MIDI input, the audio output will happen in about 2,3ms with the UFX @USB. So the keyboard and the MIDI interface have to account for the 5,2ms.

How can I get a lower overall output latency for MIDI then? Well, I could go PCIe for audio and lower my output latency even further. But there is only about 1 ms of margin in there. The fastest PCIe / converter combos (RME or Lynx) seem to perform at around 1 to 1,3 ms (32 samples 96K). OK. Next step; make the MIDI interface faster and third step get a faster triggering device as well. This is where my question comes in. I am willing to invest in an RME PCI or PCIe solution if that would make the MIDI interface part of this chain faster by at least 1 ms compared to the UFX.

So what gives? Do you have hard and fast numbers for comparing the MIDI interface performance of your PCI/PCIe gear v. your USB gear?

I know the quirks of MIDI don't end there. There is also the problem of the amount of simultaneous MIDI data in transit and that MIDI is a serial interface etc. etc.

Nevertheless, any ballpark figures for how much more juice I could get from PCI/PCIe MIDI compared to USB MIDI?

Thanks!
Derin.

Re: MIDI Speed PCI/PCIe v. USB

I realize I've made an error in my above post re latency figures.

UFX-USB-Mac: 32 samples buffer: 96K SRate > Output Latency: 1,3ms.

So the calculation for the MIDI portion of the 7,5ms latency has to be 6,2ms (not 5,2ms) for MIDI Keyboard + MIDI Interface.

This also makes my point about latency gains via a reduction of audio output latency pretty moot. How much faster than 1,3ms can you go and how much difference will that make anyways?

But this makes the question re the performance of the MIDI keyboard and interface even more important…

In any case; how about it? Should I expect more than 1ms difference in the MIDI interface performance of your PCI/PCIe products in comparison with the Fireface line?

I'd really appreciate an answer to this question from RME staff - that would make my life much easier...

3

Re: MIDI Speed PCI/PCIe v. USB

The difference between PCI/PCIe and USB/FireWire MIDI is below 0.5 ms with RME products. We do a special transfer for MIDI data that gives unusually low values for USB/FireWire.

Regards
Matthias Carstens
RME

Re: MIDI Speed PCI/PCIe v. USB

Thanks Matthias!

Do you have a ballpark number as to what the actual MIDI interface latency is for either HDSP or Fireface systems?

Do my measurements make sense to you; 6,2ms for MIDI keyboard and the interface?

Re: MIDI Speed PCI/PCIe v. USB

Just make sure to use the "High Performance" power-profile on Windows, because the other profiles (including the default "Balanced") affect MIDI performance negatively!

6 (edited by vinark 2012-12-09 12:59:46)

Re: MIDI Speed PCI/PCIe v. USB

Did you use the M-audio midi driver or did you connect the midi out of the axiom to the ufx? The ufx midi might be better. And what did you use for midi sound generation. Not all VSTi´s are equally fast.

BTW I noticed I´m more sensitive to latency playing guitar then a piano vsti. Makes sense. Even on a real piano there is latency from the hammer travelling to the string.

Vincent, Amsterdam
https://soundcloud.com/thesecretworld
Babyface pro fs, HDSP9652+ADI-8AE, HDSP9632

Re: MIDI Speed PCI/PCIe v. USB

Timur - thanks for the tip. I'll keep it in mind for my Windows tests - if I eventually get to that. I've actually conducted all of this under Mac OS and plan to keep doing so. But I will be curious about how W7 performs in this department. I'd typically expect W7 to have a slight edge over Mac OS *after a lot of tweaking*. But by all means, please let me know if you know that preformance edge to be significant! That might completely change my testing schedule...

vinark - thank you too for the tips! My test setup is down, and has been so for a long time. I had conducted these tests around March 2012. But I have detailed data and I did preliminarily compare the UFX MIDI ins v. the Axiom USB. My initial results are a vastly mixed bag. There are sooo many variables here and I had to end my spring testing sessions prematurely so I only have limited data ATM. The initial data suggests that not only VIs but DAWs may matter too:

1. Axiom USB > Logic 9.1.6 @ UFX 32 Buffer 96K > Klopfgeist > Keypress to Audio :: 7.83ms AVG | 1.71ms jitter range
2. Axiom USB > PTHD 10.1.1 @ UFX 64 Buffer 96K > Structure > Keypress to Audio ::  8.65ms AVG | 3.33ms jitter range

The buffer setting bump from 32 (Logic) to 64 (UFX) only makes a difference of about 0.33ms in audio output latency. So Logic + Klopfgeist seems to have a slight edge in AVG at 0.49ms (0.82-0.33), but a more significant edge in jiiter: 1.62ms drop. From a preformance standpoint jitter might be at least as important as average latency; the more the jitter, the less consistent the response to real time performance!

OK. Now, let's compare result (2) with the results below:

3. Axiom MIDI > MOTU micro xpress USB > PTHD 10.1.1 @ UFX 64 Buffer 96K > Structure > Keypress to Audio :: 11.24ms AVG | 2.54ms jitter range
4. Axiom MIDI > UFX USB > PTHD 10.1.1 @ UFX 64 Buffer 96K > Structure > Keypress to Audio :: 11.82ms AVG | 3.93ms jitter range

Wow. So maybe PTHD is giving some special access to the Axiom since M-Audio is Avid? That's unlikely though as the Axiom uses vanilla Core MIDI AFAIK. Go figure No.1!

Now, let's compare result (1) with the result below!
5. Axiom MIDI > UFX USB > Logic 9.1.6 @ UFX 32 Buffer 96K > Klopfgeist > Keypress to Audio :: 7.34ms AVG | 3.07ms jitter range

OK. So with Logic, UFX MIDI inputs perform slightly faster (0.49ms) than Axiom USB, but the jitter range is almost doubled! Go figure No.2!

Oiiii.

This is all so messed up. I will have to put my testing setup back up and conduct many more tests before I will be able to get a grip on this issue really.

This is why, before I resumed my tests, I wanted to hear from RME staff whether PCI MIDI makes a substantial difference. I need to minimize and optimize the variables as much as I can…

Any ideas / thoughts / comments re these results?

vinark - I see what you're saying re guitar v. keys performances. I might actually be in agreement with that but I'll have to see for myself…

Thanks all!
Derin.

8 (edited by Timur Born 2012-12-09 19:46:59)

Re: MIDI Speed PCI/PCIe v. USB

Did a quick search for my last results and found some from testing a HDSPe using the MME MIDI API over a loop-back cable (MIDI out to in on the RME Multiface 2).

Message latency:        0.89 ms   
Message jitter:            0.52 ms
Message max deviation: 1.82 ms

Here is an UFX via USB using the DirectMusic MIDI API over loop-back (tested in 2011):

Message latency:        1.06 ms   
Message jitter:            0.22 ms
Message max deviation: 0.69 ms

Of course this is only a artificial benchmark result with no other load (especially no audio) whatsoever, but it gives an idea.

9 (edited by etluxperpetuam 2012-12-11 21:39:02)

Re: MIDI Speed PCI/PCIe v. USB

Timur, thanks for posting these.

As far as I understand, these are pure interface latency numbers. This would be a nice piece of puzzle to have. If I had this for my systems, I would be able to subtract both this and audio latencies to arrive at a ballpark triggering latency figure...

What tool did you use to do the testing? I would want to try it here for my setup too under W7. I vaguely remember that there might be a similar testing tool on the Mac side but I might be wrong. Actually, I'm thinking, wouldn't I be testing a similar thing if I were to use a loopback cable and trigger a VI MIDI channel in a DAW with another VI MIDI channel, and measure the difference between the source and the target?

Now, had I also the theoretical latencies measured via a tool like what you used, I could then start comparing DAW performances too maybe; by comparing actual in-the-DAW MIDI loopback latency to the theoretical one measured outside...

Does that make sense?

Do you happen to have a similar set of measurements for the Fireface line too? (Not trying to second guess MC here; just curious about actual numbers! smile

---! Oi, just realized that Timur actually did already provide measurements for UFX-USB in his above post - sorry about that!

10

Re: MIDI Speed PCI/PCIe v. USB

All our interfaces have latency and jitter values of around 1 ms, as tested with MIDI Test under Windows. And these are the only values where we have control of. The tests that you do produce values outside of our hardware MIDI interface.

I also did not understand your 'Wow' comment. The values between both are nearly identical, so what...

Please note that what I tried to say above is that the MIDI interfaces within our audio interfaces (and we do have only such) perform better than most other audio interfaces. Dedicated MIDI interfaces are (of course) expected to have (at least) similar values.

Regards
Matthias Carstens
RME

Re: MIDI Speed PCI/PCIe v. USB

Matthias, I can see why the wow comment may have seemed odd. I think I haven't made it clear enough.

The wow was not about the comparison between results (3) and (4). Those are, as you pointed out, very close. The wow was about the comparison between them and result (2), where Axiom USB does 8,65ms; whereas the MOTU and the UFX cluster around 11,5ms. That's why I speculated that the Axiom may have had some special access to PTHD.

It is plenty clear to me that a lot is happening outside of the interface. What I am trying to do is, disect the whole thing and arrive at its pieces, so I can get a better grip on what I'm dealing with.

Speaking of which, when you say 1ms with Windows MIDI test, I presume that that value includes a Windows MIDI driver, right? If so, Core MIDI may behave differently. So is there a comparable tool that you use or know of, with which I can test pure interface performance on the Mac? Having access to the numeric value of pure interface performace on the Mac would allow us to compare platform efficiency in terms of MIDI I/O...

Re: MIDI Speed PCI/PCIe v. USB

The differences between the axiom and the motu/ufx, might be caused by a different issue. Midi can be timestamped, or not. If a DAW receives midi it does 2 things, record it in the timeline and if a vsti is connected produce audio. If you check audio against the recorded midi note, this doesn´t say much about the actual latency, cause the DAW can use timestamped midi. That would place timestamped midi earlier on the timeline, suggesting a higher latency, but in fact it might be the same at the playing moment.

Vincent, Amsterdam
https://soundcloud.com/thesecretworld
Babyface pro fs, HDSP9652+ADI-8AE, HDSP9632

13 (edited by etluxperpetuam 2012-12-11 19:08:36)

Re: MIDI Speed PCI/PCIe v. USB

I have not yet investigated how timestamping works. So thanks for reminding me of that.

But I'm thinking, for what I'm trying to measure it matters only partially. Here's how and what I'm measuring;

I have 3 data points:
1. The audio recording of the keypress itself. I place a mic at the MIDI keyboard and hit the key as hard as I can to generate a clear attack.
2. The recorded MIDI event.
3. The audio recording of the VI that was triggered.

If you look at this strategy, you'll realize that where the MIDI note is placed is not relevant at the time of performance. It will only become relevant at the time of playback and that is actually very relevant indeed. But my first focus is on performance latency. I first want to be able to perform with a MIDI instrument with an as immediate and consistent feeling as I can. But timestamping definitely needs to be undestood and examined for playback of performances, especially if you're not capturing the audio of such performances.

Thanks!

Re: MIDI Speed PCI/PCIe v. USB

Ah, well done!

Vincent, Amsterdam
https://soundcloud.com/thesecretworld
Babyface pro fs, HDSP9652+ADI-8AE, HDSP9632

15 (edited by Zapp 2012-12-11 21:01:56)

Re: MIDI Speed PCI/PCIe v. USB

Excuse to chime in, but I have to admit: Cool!
The only way to get the feel of computer algorithms....:-)

Regards
Zapp

Re: MIDI Speed PCI/PCIe v. USB

:-) yeah - that's the idea.

I know I'm going at this in a very technical and boring (even if not for me) manner, but the biggest issue I have with virtual instruments (and I do want to use them), is that in real time they usually feel inconsistent and especially rhythmically quite awkward because of that. If you are performing to some tracks or with a band, musical magic happens only when there is a great deal of rhythmic gelling and interaction between the instruments and parts. With a poor MIDI performance station, that all becomes close to impossible IMO...

17

Re: MIDI Speed PCI/PCIe v. USB

> is that in real time they usually feel inconsistent and especially rhythmically quite awkward

Reminds me of old times:

http://www.rme-audio.de/english/techinfo/lola_latec.htm

Regards
Matthias Carstens
RME

Re: MIDI Speed PCI/PCIe v. USB

Haa. Yes Matthias; I remember reading a lot of material from your old site regarding latency - actually recently. What baffles me is; the technology has not advanced. MIDI is still MIDI. But this topic is very rarely discussed. I guess people either don't perform all that much thorugh MIDI+VI anymore, or quantization has just changed the game so much that performance inaccuracies and inconsistencies of MIDI+VI have simply become irrelevant. What's even more baffling is; why on earth are we still using such a sloppy, slow and downright awful protocol that was devised in the early 80s. I mean, simultaneously performed notes are going to sound 1ms apart BY DESIGN ??? That's just lame… I'd bet that at least 50% of the comments regarding the unnaturalness of virtual instruments are caused by MIDI BS rather than sound. So this situation gives VIs a bad name too, I think.

BTW, I've just conducted a loopback test through my UFX@USB and here are the results:

Mac OS 10.7.5 > Cubase 6.0.7 > UFX@USB > 96K / 64samples > Front MIDI I/O looped back via MIDI cable > 10 measurements - MIDI event to MIDI event :: 
Avg latency = 1.56ms
Max = 1.71ms
Min =1.46ms
Jitter Range = 0.25ms

Pretty impressive - esp. in terms of jitter. Does that sound about right?

Re: MIDI Speed PCI/PCIe v. USB

Low jitter in return for slightly higher latency may even be by design in Cubase. For example I know that Ableton Live does this (or at least advertised to do so).

Re: MIDI Speed PCI/PCIe v. USB

Yes Timur - that could be the case.

So the difference between my numbers and your numbers in Windows could be because of:

1. a difference between Core MIDI and DirectMusic / MME MIDI
2. a difference between your testing platform and Cubase's MIDI machinery.

Do you remember what setup you've used for your tests? Did you use a theoretical testing tool, or was it a DAW like in my case?

I am now curious about how my setup will behave in Bootcamp. I will test that shortly. Any rules of thumb re the use of DirectMusic v. MME which would save me some testing and tweaking time?

Re: MIDI Speed PCI/PCIe v. USB

I used Miditest.

http://earthvegaconnection.com/evc/products/miditest/

Re: MIDI Speed PCI/PCIe v. USB

Great, thanks...

Re: MIDI Speed PCI/PCIe v. USB

Just to mention it: MIDI can transport 781.25 notes (on + off) per second. As a result there is a lag of 0.64 ms between two notes that are being played together (note on), not taking jitter into account.

I once tested various of my MIDI interfaces for maximum bandwidth on Windows and OS X. All but the M-Audio 2496 (PCI) failed, but RME was very quick to fix this in their drivers (and introduced DirectMusic MIDI shortly afterwards). While I was testing this I noticed that on both Windows and OS X (Leopard) shared the same weakness that drags the performance of a good working MIDI interface/driver down if any other MIDI interface/driver cannot deliver good bandwidth.

Since Lion this seems to have been solved on the OS X side, didn't test for Windows (8) yet, but will do once I find time.

24 (edited by etluxperpetuam 2012-12-13 23:58:18)

Re: MIDI Speed PCI/PCIe v. USB

Timur - that is one crucial thing to know - thanks so much for sharing that!

So let me get this straight: If there is any poorly implemented proprietery MIDI driver running along with a nicely implemented proprietery driver, or simply along with Core MIDI on a Mac; prior to Lion that would have meant that the poor driver would have brought down the performance of the Core MIDI and the good proprietery driver as well.

How did you test for that? Did you write a MIDI sequence in a DAW that included 750+ MIDI events in a second and then loop that back in???

Also, did that limitation on bandwidth have any bearing on MIDI IO speed and jitter? Did you notice anything of the sort? I mean, it could be the case that as long as you don't saturate that limited bandwidth, you could be fine...

And just to make sure that I'm understanding MIDI correctly; that bandwidth of 781.25 notes per second; is that bandwidth the same one that's used for all MIDI events; or is that bandwidth reserved for note events only. My knowledge of this is a bit rusty but AFAIK, that bandwidth would be used by all events and not just note events; so a sustain pedal switch would consume the same 0.64ms, serially inserted into the flow of note ons and offs. Isn't that the case?

25 (edited by vinark 2012-12-14 00:30:44)

Re: MIDI Speed PCI/PCIe v. USB

Yes it is all serial, one bandwith for all. but those midi notes per second might be in running status. Look it up! To late to explain it now. Midi running status

Vincent, Amsterdam
https://soundcloud.com/thesecretworld
Babyface pro fs, HDSP9652+ADI-8AE, HDSP9632

26 (edited by etluxperpetuam 2012-12-14 01:48:21)

Re: MIDI Speed PCI/PCIe v. USB

Aaah. Thanks so much vinark for pointing that out. I did check running status out and also refreshed my MIDI knowledge a bit.

So MIDI speed is 31.250 bits per second. Normally, each note on message will require 30 bits (8 Status/Channel, 8 Note, 8 Velocity, 6 for 3 Start/Stop pairs). So:

31.250/30 = 1041,67 events
1000/1041,67 = 0,96ms per event

This corroborates my 1ms per event recollection.

Running status means that status bytes will be dropped, should it be the case that the next event is on the same channel and is the same type of operation (e.g. Note On) as the previous event. This is done to save bandwidth. That would mean that that next Note On event would use only 20 bits.

31.250/20 = 1562,5 events
1000/1562,5 = 0,64ms per event.

This is exactly Timur's number. So you're right! That number is indeed for running status.

Now, Timur's other number - 781,25 - is exactly a half of 1562,5. I wonder why that is! Is the driver reserving a fixed bandwidth for MIDI In and MIDI Out or something?

But if the bandwidth is in deed 781,25 events per second, that could mean 1,28ms per event and that would actually make Timur's Windows latency measurements kind of impossible since they are all faster than 1,28ms. But I take Timur's measurements to be true so there must be something else going on here...

Re: MIDI Speed PCI/PCIe v. USB

I think you find this a very interesting read:
http://www.midi.org/aboutmidi/tut_midimusicsynth.php

--
RME AIO
P9X79, i7 3930K, 16GB, HD6450
Windows 7 pro 64 Bit

28 (edited by etluxperpetuam 2012-12-14 02:28:12)

Re: MIDI Speed PCI/PCIe v. USB

Thanks for the link! Good thing to have information right from the source...

Re: MIDI Speed PCI/PCIe v. USB

Try this: http://www.expert-sleepers.co.uk/index_ … e-es-4.php

Re: MIDI Speed PCI/PCIe v. USB

Francesca - that's very intriguing! I will check that out. For those who are curious, the link points to a site where "Expert Sleepers" (apparently a one man company in the UK) has purportedly built a system for CV controlling that can also be used to generate jitter free and sample accurate MIDI transmission over an audio signal. I have no idea how this has been done but I will look into it.

31 (edited by Timur Born 2012-12-17 14:44:26)

Re: MIDI Speed PCI/PCIe v. USB

etluxperpetuam wrote:

Timur - that is one crucial thing to know - thanks so much for sharing that!

So let me get this straight: If there is any poorly implemented proprietery MIDI driver running along with a nicely implemented proprietery driver, or simply along with Core MIDI on a Mac; prior to Lion that would have meant that the poor driver would have brought down the performance of the Core MIDI and the good proprietery driver as well.

Having a poorly implemented driver installed or even using it at low bandwidth is not a problem. But once you saturate the "poor" bandwidth of such a driver it drags down the bandwidth of all other drivers in the system.

How did you test for that? Did you write a MIDI sequence in a DAW that included 750+ MIDI events in a second and then loop that back in???

Both with and without loop-back via DAW. I created tracks of 65 note on+off events each (=1/12 of maximum MIDI bandwidth) and ran MIDI Sync over another interface (trying both physical and virtual/software). Then duplicated tracks until the DAW started to react erratically, mostly showing in tempo/bpm dropping when the DAW was ran as MIDI Sync slave (but in some cases also audio, CPU load, etc).

As far as I remember the loop-back, or rather the input, wasn't the culprit (Input and Output get their full MIDI bandwidth individually). Some of my USB midi devices (Novation Remote SL, Korg PadKontrol) could not deliver full MIDI bandwidth (or even a good fraction of that) via their outputs without causing the DAW suffer. Both my M-Audio 2496 and later the FF 400 were able to run at full MIDI bandwidth for as long as none of the "poorly implemented" drivers were run over their choke limit at the same time.

Especially virtual/software implementations are practically only limited by CPU and artificial limits (like implementing 3125 bytes/s per channel maximum albeit it isn't really necessary). To give you an idea: I ran two separate instances of Ableton Live as Midi Time Code (MTC) slave to a software via virtual/software MIDI cables. All three applications ran on the same machine concurrently. Starting playback of both Live instances via MTC lead to _sample-accurate_ timing, which was easily assessed by running the output of one Live instance phase-inverted (=nullified sum when mixing both instances to a single channel-pair via Totalmix).

Also, did that limitation on bandwidth have any bearing on MIDI IO speed and jitter? Did you notice anything of the sort? I mean, it could be the case that as long as you don't saturate that limited bandwidth, you could be fine...

At least you are fine as far as total bandwidth is concerned. But I did not test for jitter back then, because I simply decided to keep the problematic device out of the chain when necessary (or in the case of the Remote SL to run it via DIN MIDI to the FF 400 instead of using its USB MIDI driver).

The biggest issue modern computers still face when they have to handle is not the irrelevantly low bandwidth of 1980's MIDI protocol. The fact that MIDI has to handle lots of small events in near real-time is the problem that modern hardware and especially software still chokes on. Modern SSD drives can deliver maximum bandwidth of well over 500 mb/s, but once you start transferring many small random blocks you cab see performance drop down to less than 20 mb/s.

And just to make sure that I'm understanding MIDI correctly; that bandwidth of 781.25 notes per second; is that bandwidth the same one that's used for all MIDI events; or is that bandwidth reserved for note events only. My knowledge of this is a bit rusty but AFAIK, that bandwidth would be used by all events and not just note events; so a sustain pedal switch would consume the same 0.64ms, serially inserted into the flow of note ons and offs. Isn't that the case?

The bandwidth is per MIDI cable/plug for _everything_ that runs over that single cable (regardless of what events, what MIDI channel, SYSEX or whatever). Each cable gets that full bandwidth, so you can run several MIDI ports at full bandwidth simultaneously, unless one driver plays foul and drags all the others down. I have to retest this all with later incarnations of Windows 7/8 and OS X.

32 (edited by Timur Born 2012-12-17 14:18:55)

Re: MIDI Speed PCI/PCIe v. USB

etluxperpetuam wrote:

31.250/20 = 1562,5 events
1000/1562,5 = 0,64ms per event.

This is exactly Timur's number. So you're right! That number is indeed for running status.

Now, Timur's other number - 781,25 - is exactly a half of 1562,5. I wonder why that is! Is the driver reserving a fixed bandwidth for MIDI In and MIDI Out or something?

780 Note On + Note Off events = 780 x 2 bytes (on) + 780 x 2 bytes (off) = 3120 bytes

But if the bandwidth is in deed 781,25 events per second, that could mean 1,28ms per event and that would actually make Timur's Windows latency measurements kind of impossible since they are all faster than 1,28ms. But I take Timur's measurements to be true so there must be something else going on here...

The bandwidth is 781,25 Note On+Off events per second. There are events that take less or more bytes. And if you only count Note on then you get 1.562,5 notes per second. The latency in between note (events) is 0.64 ms, so a chord that only consists of Note ON events (fingers only pushing down, but not releasing the keys) comes at 0.64 ms + _jitter_ in between each note/key even when pushed exactly at once.

The latter is only true for the DIN MIDI protocol, though. If the underlying USB/FW protocol transports events in packets of several (hundred) bytes at once then the receiving USB MIDI driver likely timestamps the full chord with the very same arrival time (especially with MME MIDI). As far as I know the RME interfaces use asynchronous USB frames of 1 ms on Windows and microframes of 125 us (picoseconds) on OS X for audio transport. So I suspect (but don't really know) that the same applies for MIDI (going over the same link). OS X handles driver events differently, though, so in the end the results are likely the same (around 1 ms latency, with jitter being below 1 ms, but depending on how the DAW handles latency vs. jitter).

Timestamping, and thus latency and jitter, is a combination of hardware, transport protocol, driver API (MME vs. DirectMusic, with DM being better but less supported by DAWs) and DAW handling.

33 (edited by etluxperpetuam 2012-12-19 07:01:49)

Re: MIDI Speed PCI/PCIe v. USB

Timur Born wrote:

Having a poorly implemented driver installed or even using it at low bandwidth is not a problem. But once you saturate the "poor" bandwidth of such a driver it drags down the bandwidth of all other drivers in the system.

That's good to know. At least it doesn't hurt right off the bat…

I'm not sure I fully understand how you conducted the test. Yet I'm not going to ask you for details and waste your time - at least not now, when I know I'm not going to be running the test myself anytime soon. But may I PM you if it ever came to that?

Especially virtual/software implementations are practically only limited by CPU and artificial limits (like implementing 3125 bytes/s per channel maximum albeit it isn't really necessary). To give you an idea: I ran two separate instances of Ableton Live as Midi Time Code (MTC) slave to a software via virtual/software MIDI cables. All three applications ran on the same machine concurrently. Starting playback of both Live instances via MTC lead to _sample-accurate_ timing, which was easily assessed by running the output of one Live instance phase-inverted (=nullified sum when mixing both instances to a single channel-pair via Totalmix).

That's another reassuring bit of information! Grateful that you shared that with us! So if you use proper virtual MIDI implementation, you don't even need Rewire, at least not for syncing multiple DAWs to each other. Did you use the IAC bus on the Mac side? What did you use for Windows? Also, very clever use of Totalmix right there - I'll keep that in mind!

The biggest issue modern computers still face when they have to handle is not the irrelevantly low bandwidth of 1980's MIDI protocol. The fact that MIDI has to handle lots of small events in near real-time is the problem that modern hardware and especially software still chokes on.

Hmm. But isn't it the case that when you have more bandwidth (and thus greater resolution), you're dividing time into ever smaller moments so that jitter and timing variations, even if they still exist, become irrelevantly small? If we were reporting MIDI latency and jitter in microseconds even, wouldn't both become totally irrelevant for performance purposes? Also for MTC applications; wouldn't having a greater resolution allow for greater sync accuracy even over external, hardware to hardware connections? I agree that bandwidth is irrelevant in the case of the number of events, unless there's a lot of activity on multiple channels simultaneously - like in your loopback tests. Aside from that, though, stirpped down to its essentials, isn't timing accuracy about the only thing that a protocol like MIDI has to handle properly? The timing of note on/offs, sustains, bends etc? And wouldn't that task become much easier to carry out accurately, if there was greater resolution?

I suspect that the choking you mentioned happens when VIs come into play; translating and "assembling" those MIDI commands into audio. The more MIDI events that need "translation", the more tax on sound engines and the CPUs that need to run those. And that, I agree, has nothing to do with MIDI bandwidth itself.

The bandwidth is 781,25 Note On+Off events per second.

Aaah, how did I miss that! Of course! Note offs have to be accounted for as well. Thanks for clarifying that.

34 (edited by Timur Born 2012-12-19 22:37:01)

Re: MIDI Speed PCI/PCIe v. USB

etluxperpetuam wrote:

But may I PM you if it ever came to that?

Yes, but it's been years since I conducted those tests and both hardware and software keep changing.

That's another reassuring bit of information! Grateful that you shared that with us! So if you use proper virtual MIDI implementation, you don't even need Rewire, at least not for syncing multiple DAWs to each other. Did you use the IAC bus on the Mac side? What did you use for Windows? Also, very clever use of Totalmix right there - I'll keep that in mind!

In theory, yes, in practice no. Take notice how I wrote "Midi Time Code" and "on the same setup". MTC does not allow for tempo changes, so it's inherently immune to Midi jitter. You both instances of DAW to start synchronized and then they keep running at their own internal tempo. As long as you don't change tempo and run both via the same audio interface (or at least synchronized audio interfaces) they will pretty much stay in sync.

Well, I also _did_ manage to get those two instances run in sample-accurate sync via Midi Clock Sync (aka ongoing sync tick events are send over Midi). But that only worked, because Live 7 prior to version 7.012 rounded Midi Sync BPM to the next full integer value and thus the chance for fluctuations/jitter to affects the tempi were small. Ableton always denied that, by the way, and changed the behaviour fundamentally after 7.012. In the end it was "wrong" behaviour anyway, but it helped to get two instances of Live to sync.

In practice the variables affecting Midi timing are many and complex, down to the point that there are several different hardware clocks inside your computer and then other clocks inside other hardware. Not to mention that DAW softwares' interpretation of the incoming Midi Sync ticks plays a big role, too (see Ableton Live above). Different software on the very same computer can react _very_ differently to the very same Midi Sync signal.

Here is an example (Kontakt 3 plugin running as Slave to the same software Master clock via virtual Midi cabled on the same computer, first line is Kontakt inside Kore 2, second line is Live 7, third line is Kontakt inside Live 7).

http://img211.imageshack.us/img211/9366/syncslave111oh1.gif

Here is an old thread on Gearslutz that recently got bumped. It includes some suggestions for Midi-over-LAN implementations.

http://www.gearslutz.com/board/music-co … -hard.html

Hmm. But isn't it the case that when you have more bandwidth (and thus greater resolution), you're dividing time into ever smaller moments so that jitter and timing variations, even if they still exist, become irrelevantly small?

High bandwidth usually is accomplished via larger blocks of data. The smaller the blocks of data the lower the bandwidth. And the smaller the blocks of data the more often the CPU is needed to handle the data. The more often the CPU is needed the higher the chance of other computer processes getting in the way (same with audio sample buffers). 3125 Midi Clock tick events per second correspond to 0.32 ms per tick. Try to get such low latency from your audio interfaces without dropouts (audio drivers know only dropouts, where Midi knows jitter instead)! Or another way around: 0.32 ms correspond to just 14 samples buffer at 44.1 kHz, and that's without using additional safety-buffers like all audio drivers do. wink

If we were reporting MIDI latency and jitter in microseconds even, wouldn't both become totally irrelevant for performance purposes? Also for MTC applications; wouldn't having a greater resolution allow for greater sync accuracy even over external, hardware to hardware connections?

It's not like we are stuck with 1980s Midi. There's always OSC, albeit in practice it's suffering from lack of widespread support. And the problem of using a realtime timing protocol on _non_ realtime computers with _non_ realtime operating systems still remains. Many people still think the Atari ST was the ultimative Midi computer.

Aside from that, though, stirpped down to its essentials, isn't timing accuracy about the only thing that a protocol like MIDI has to handle properly?

Yes, but timing accuracy is not exactly the biggest strength of PC operating systems. It even wasn't a strength of PC hardware until an improvement in form of the "High Precision Event Timer" (HPET) came along. And then many people turn the latter off in their BIOS thinking it would improve their audio performance. Also keep in mind that Midi was done for "practical" purposes in a time where hardware synthesizers could go out of tune. It's not meant to be rocket science, but just a way of getting something useful. In a test I could audibly keep my Korg 01/W Workstation in sync to my PC for hours. They may have been off by some milliseconds after such a long run, but I couldn't hear it.

I suspect that the choking you mentioned happens when VIs come into play; translating and "assembling" those MIDI commands into audio. The more MIDI events that need "translation", the more tax on sound engines and the CPUs that need to run those. And that, I agree, has nothing to do with MIDI bandwidth itself.

I don't think the "translate Midi to audio" part is the culprit. It's really a problem of priorities and handling many small "realtime" events alongside all the other things a DAW and an OS need to handle.

So at the end I wouldn't try to get perfect sync over Midi, but try getting "workable" sync with no obvious errors. And take a look at the software choices and how they perform versus each other.

Last but not least: One trick for getting Midi Clock back in sync is to do quick playback stops and starts in between songs or even inside a song if you can time them well. Every time you do that the Midi slave get an exact position message from the master (instead of just ticks), so they both start anew at the same position and then go back to using ticks.

Re: MIDI Speed PCI/PCIe v. USB

Timur Born wrote:

Here is an example (Kontakt 3 plugin running as Slave to the same software Master clock via virtual Midi cabled on the same computer, first line is Kontakt inside Kore 2, second line is Live 7, third line is Kontakt inside Live 7).

That's just crap (great visual presentation of the problem BTW!). That just brings back that feeling I get whenever I delve deep into MIDI. That your best bet with MIDI is always to stay within the confines of one DAW and I/O setup so as to not complicate things any further. Heck, ideally, just treat MIDI instruments as real instruments and capture the audio of your performances so as to not take any chances. Perform better, not edit better! smile Then what you heard while you were performing will be perfectly preserved in audio however f'd up your MIDI setup may be. If you insist you want a MIDI sequencing workstation and not just an instrument, the task becomes, then, test out DAW / IO / Keyboard combos, find the one that works best and then stick to it all the way. This may mean that you might not get all those MIDI tools you're used to; heck you may even have to switch OS platforms or have to learn a totally foreign DAW (I for one am curious about Digital Performer). But it seems that for the sake of accuracy and reliability, sacrifices have to be made in the case of MIDI.

Sorry for the rant

I will get back to our discussion re chokes and bandwidth. wink

I want to give that some more thought...

36 (edited by Timur Born 2012-12-21 12:43:02)

Re: MIDI Speed PCI/PCIe v. USB

Giving it a second thought that test might even have been over physical (RME) connections instead of virtual. Kore vs. Live demonstrates that DAW software often matters more than the rest when it comes to MIDI. Kore 2 software worked really as a plugin host with MIDI.

37 (edited by etluxperpetuam 2012-12-29 04:25:48)

Re: MIDI Speed PCI/PCIe v. USB

Timur Born wrote:

High bandwidth usually is accomplished via larger blocks of data. The smaller the blocks of data the lower the bandwidth. And the smaller the blocks of data the more often the CPU is needed to handle the data. The more often the CPU is needed the higher the chance of other computer processes getting in the way (same with audio sample buffers). 3125 Midi Clock tick events per second correspond to 0.32 ms per tick. Try to get such low latency from your audio interfaces without dropouts (audio drivers know only dropouts, where Midi knows jitter instead)! Or another way around: 0.32 ms correspond to just 14 samples buffer at 44.1 kHz, and that's without using additional safety-buffers like all audio drivers do.

Timur - here's why I'm having trouble following your logic through to the end.

Given 31,250 bps speed of MIDI, 3125 ticks per second means 10 bits per 0.32ms. That includes the start and stop bits (1+1) and the clock byte (8).

Now, let's think about 2496 audio.

24 bits per sample @ 96,000 samples per second means: 24 x 96,000 = 2,304,000 bits per second.

2,304,000 / 1,000 = 2,304 bits per ms.

2,304 * 0.32 = 737.28 bits per 0.32ms.

737.28 / 10 = 73.728

So within the same amount of time that passes for one MIDI tick, one 2496 audio stream requires roughly 74 times the amount of data to be moved. Now, I am not sure how audio interfaces handle multiple streams, but I'm guessing that each channel of audio stream adds one more count of the same amount of data. If that's correct, a stereo 2496 channel would require 737.28 * 2 = 1,474.56 bits of data to be handled per 0.32ms, and on and on.

Following your logic of, isn't a single 2496 audio channel infinitely more complex and smaller compared to a single MIDI channel; so that something this small should wreak more havoc than it does presently?

Also, for my UFX, I remember measuring 51 samples of DSP Round-Trip Latency (RTL) in and out of Totalmix at 2496. That comes to about 0.53ms RTL. Totalmix handles this without a hiccup for all its channels. Of course this efficiency comes from its dedicated and real time nature as you might put it. But this is testimony to the fact that even if not 0.32 ms, proper processing will handle 0.53 ms just fine. And if it were only a single data stream that needed handling, as is the case with MIDI, I bet that number could go even below 0.32 ms. But I'm guessing that that DSP chip is probably weaker in raw power than even a lowly single core Pentium 4 CPU.

Talking about a P4 CPU, let's do another exercise. (And I'm going out on a limb here - I'm no engineer)

Take a single core 3 GHz P4. That thing runs at 3,000,000,000 cycles per second. That is 3 million cycles per ms. Now, I don't exactly know how this relates to bitrate, but that's a lot of CPU cycles per ms. This is another reason why I'm having a hard time following your logic. I'm sure CPU scheduling and processing priorities will take a toll on everthing else that requires real time efficiency, but still; how could this kind of power not handle a very data-light operation like a MIDI transmission, I can't understand. And still, the explanation that makes sense to me is lack of resolution. Jitter is part of audio streams as well - although admittedly I'm not sure that this is the case when audio data is still "within" the computer. But since audio jitter is so infinitely small in time; we hear audio jitter as a sonic effect rather than something like a tape drift - which is more like what MIDI does. So if MIDI jitter too was much more smaller in time, I'm guessing that we would lose the audible timing inaccuracies altogether.

The link that Francesca provided above pointed to a site where a builder was carrying MIDI over audio with zero latency and jitter. Here's a direct quote from that link:

Because the MIDI is being sent via an audio interface, it is sample-accurate with the audio and free from the timing jitter normally associated with USB MIDI interfaces.

I don't yet know how he encodes MIDI into audio and then decodes the same back into MIDI, but that tells me that once you increase the resolution, you get the chance to clean MIDI of audible timing artifacts altogether.

Anyways; I'm having a lot of fun with this discussion - please don't get me wrong; I'm just trying to think together here! smile

Let me make one final thought exercise and go out on another limb! So let's say the processor scheduler is at fault in not prefectly lining up MIDI bits in time. If my thinking is correct, (3,000,000 cycles/ms * 0.32 ms = 960,000 cycles), one MIDI tick has to take place every 960,000 cycles. So the scheduler is very busy, the MIDI process doesn't have real time priority and the scheduler messes up by one half to process the next tick at the 1,440,000th cycle. That would be a jitter of about 0.16ms. Now let's say MIDI speed was a thousandfold at 31.25 Mbits/second instead of 31.25 Kbits/second. That would force the scheduler to place a MIDI tick every 960 cycles. In this case, even if the scheduler messed up, and placed the next tick 1440 cycles later instead of 960, that timing error would not be noticeable by ear.

OK. I bet I've misinterpreted a lot of technical basics, but hey I've done my best to make sense of things…

Oh and I wish all a happy new year!

Derin.

38 (edited by Timur Born 2012-12-29 13:57:50)

Re: MIDI Speed PCI/PCIe v. USB

The amount of data per time period is not the problem for MIDI itself, but at the same time that the little MIDI data is processed a lot of other processing takes place, too. The number of times and the short periods in between is the main issue. Regardless of whether you are processing a single byte or megabytes of data you cannot 100% guarantee that the CPU is free to do so just the very moment you need it. That is the nature of non real-time multi-tasking operating systems.

You might have heard about the DPC Latency Checker utility?! http://www.thesycon.de/deu/latency_check.shtml

This utility tries to permanently get hold of the CPU (or rather a single CPU core) and measures the time/latency it takes to get there. The utility uses a lot less CPU processing than a DAW working on MIDI data (including graphic output and mouse input) and still may not get below 0.32 ms on lots of computer setups. Even more so, the DAW has to do all of its processing of input and output within those 0.32 ms in order to catch the next event. The latter is where multicore systems can shine (Logic 8 had an option to reserve a single core solely for driver processing and it _did_ help to get lower latencies in the extremes).

Totalmix cannot be used for comparison here, because it uses _no_ CPU load for processing the audio, or rather, when you route audio data through Totalmix from input to output (or vice versa) it's all done within the RME device, no data is passing through the computer other than the meter readings (only the results, not the calculations for the meters, which are done internally, too).

Of course you can get really small audio buffers working, especially on modern CPUs and moderate to light workload. But with many computers you still cannot take this for granted, and even Apple Macs (OS X) don't guarantee to put any priority on realtime media data (rather the opposite in many instances). Other drivers often are bullies with hard elbows when it comes to letting audio/midi drivers take a timely hold on the CPU. And then it also all comes down to the implementations of the DAW itself (take a look at the advanced processing settings of Reaper to get an idea). wink