3

I am working on a MIDI effect (a VST plugin which modifies incoming MIDI generates new data and forwards it out) using the Juce Framework in C++. I see that it's technically possible to generate a new MIDI message with EVERY sample making my stream of MIDI flow at 16 to 24 bits 41,000 times a second or more. This seems entirely impossible for MIDI hardware to handle.

Is there any guideline or rule I must adhere to when when I decide on my bandwidth for MIDI over USB to hardware synths, new and old?

EDIT: I should add that for what I am trying to do, higher bandwidth would help, but should work with hardware such as the Arturia Minibrute. I am attempting to do novel things like apply envelopes and LFOs to the modulation and pitch wheel.

Jeff-Russ
  • 341
  • 2
  • 10
  • Off topic really but you don't need much. MIDI doesn't transmit sound, only commands. A thousand or two per *minute* would be adequate. – user207421 Apr 09 '15 at 01:35
  • Well actually in my case, more would be better. I am attempting to do odd things like apply envelopes and LFOs to the modulation and pitch wheel. – Jeff-Russ Apr 09 '15 at 01:36
  • 3
    MIDI devices expect 31.25 kbps, that's ~1000 messages per second tops. – Hans Passant Apr 09 '15 at 02:14
  • @Jeff-Russ: You may end up with synchronization issues. Are you expecting the number of audio samples processed between commands to be consistent? Good luck. – Ben Voigt Apr 09 '15 at 02:20
  • No. The way the Juce frameworks handles MIDI is that is has a variable number of MIDI messages per sample buffer. Each MIDI message is synchronized with a sample number (where the first sample of each buffer is sample number zero). If you have a buffer size of 64 sample you could theoretically have 64 MIDI messages but I'll try to limit my MIDI events in each buffer, taking into account the sample rate and buffer size. – Jeff-Russ Apr 09 '15 at 05:09

1 Answers1

6

MIDI over DIN cables runs at 31250 bits/s, i.e., 3125 bytes/s.

The USB MIDI specification does not specifiy any bandwidth, but the underlying USB bulk transfer protocol implicitly allows the receiving device to decide when to accept new packets. In other words, the USB MIDI device can decide how fast it runs, but there is no easy mechanism to determine this limit (especially if your OS just drops MIDI messages that the device driver cannot deliver fast enough).

USB/MIDI interfaces run at exactly 3125 bytes/s. USB MIDI devices where no 'real' MIDI interface is involved might be able to run faster; for example, my SC-8820 can process about 10 KB/s.

In practice, you cannot know what hardware sits behind some generic MIDI port. You should use the 3125 bytes/s limit unless you have special knowledge about the device.

CL.
  • 173,858
  • 17
  • 217
  • 259