We are using cookies to give you the best experience on our site. Cookies are files stored in your browser and are used by most websites to help personalise your web experience. If you "ACCEPT" setting, you are agreeing to our use of cookies. Accept
Discuss other brands keyboards, synthesizers, modules, software, controllers including how they compare or work with the Nords.

For programmers: MIDIoUSB problem solved

Postby BruceV » 08 Jan 2017, 15:28

This is to report a solution (and a very relieved programmer). It may not be relevant for most readers, but anyway here goes:

I develop my own MIDI software, until recently I only used native MIDI via adaptors, but I’m moving to MIDI over USB. The chat groups are full of posts about problems with MoUSB, particularly when a USB hub is involved, and I encountered one as well. Sometimes I have to send a string of messages to a single device, including Sysex/es, an example is:

Sysex to change the mode of a sound generator
Bank change / program change
Sysex to set a parameter in a sound generator part.

What I found was that some of these message bundles behaved strangely. Sometimes some actions were completely ignored, or actions produced incorrect results. When I switched back to straight MIDI, the problems disappeared.

The nice thing about MIDI is that it’s easy to view the actual packets using a package such as MidiOx. It’s harder with USB, you need specialised software that I don’t have the energy to find, install and learn (although I probably have to make the effort). Anyway, the only easy thing I could think of doing was to add small delays between the message sends using the Win32 Sleep function, so the above example would become:

Sysex to change the mode of a sound generator
Sleep (20) // 20millisecond delay
Bank change / program change
Sleep (20) // 20millisecond delay
Sysex to set a parameter in a sound generator part.

In my case I can do this without latency problems, because there is always a reasonable time between these message bundles, and a delay of a few 10s of milliseconds is of no consequence. They are only used for patch changes and similar events.

Anyway, it worked, the resultant program seems as solid as the native MIDI equivalent. Given the timing around USB, I expect that the Sleep times could probably be reduced significantly.

In the several weeks I’ve been working with USB, this bundled message problem is the only one I’ve come across. The critical real time stuff, ND, NUs and streams of pitch bend messages & the like, seem to work without fail.
Last edited by BruceV on 08 Jan 2017, 15:32, edited 2 times in total.
BruceV
 
Posts: 17
Joined: 26 Dec 2016, 10:07
Has thanked: 5 times
Been thanked: 0 time
Your Nord Gear #1: Nord Stage 2 EX
Your Nord Gear #2: Other Brand

For programmers: MIDIoUSB problem solved


Sponsor
 

Re: For programmers: MIDIoUSB problem solved

Postby Mr_-G- » 08 Jan 2017, 18:54

Hi, Do you really mean SysEx? That is not usually used to change programs.
SysEx start with F0 and end with F7, they are manufacturer-dependent and often used to change parameters on a particular hardware.
Or do you mean ProgCh messages?

This is a complete guess: maybe your code is accessing the USB interface quite rapidly, and might not be sending the MIDI bytes out at the right rate (remember that the MIDI standard is quite old and at that time 31250 baud was not particularly slow).
I would have thought that there might be a way of sending MIDI bytes out from your program at the right rate via some software API, so these problems do not happen (imagine that a similar issue in a sequencer program would be catastrophic if every message is delayed by 20 ms!).
User avatar
Mr_-G-
Moderator
 
Posts: 2922
Joined: 18 Aug 2012, 16:48
Has thanked: 816 times
Been thanked: 779 times
Your Nord Gear #1: Nord Stage 2

Re: For programmers: MIDIoUSB problem solved

Postby jfenton » 08 Jan 2017, 19:18

I have found I need to put a small delay after sending Sysex to my Korg Triton Extreme to change from Program Mode to Combi mode and back before changing patches. With that said,
I'm running my Korg through midi connectors but the controlling device is either my PC running Bome Midi Translator software or a Bome Box. So there is always a midi over usb component in the mix.


Note, Korg can only switch modes with Sysex and then the Bank and PC is valid from only the mode it is in.

I have found no other instances where I've had to insert delays. I run most of my stuff over USB through a Iconnectivity 4x4 box. My Hammond does not have Midi over USB and I run Korg over midi instead of USB for other reasons.
Keyboards:
  • NS2 EX Compact 73
  • Hammond SK2
  • Roland VCombo VR-09
  • Alesis VI61

The author jfenton was thanked by:
BruceV
User avatar
jfenton
Patch Creator
 
Posts: 350
Joined: 03 Apr 2016, 18:21
Country: United States of America
Has thanked: 24 times
Been thanked: 98 times
Your Nord Gear #1: Nord Stage 2 EX

Re: For programmers: MIDIoUSB problem solved

Postby Quai34 » 09 Jan 2017, 01:37

Hi,
If you use a USB hub that is not powered, Midi over USB doesn't work, even midi sometimes, that's what I realized 4 years ago when I used for the first time my computer with just non powered USB Hub.
Stage 2/C2/NL2X+TC Pedals, 2X Matrix 1000, EMU P2K, TX802, DSI Prophet 08+Tetra/P12+H9, D50+PG1000, XV5080,AX keytar,Waldorf Streichfett, Basses:Ibanez SR1200+G&L L2000.Guitars:G&L Legacy HSS,Asat Blueboys,Asat Deluxe Savanna,Ibanez Artstar AS153
User avatar
Quai34
 
Posts: 747
Joined: 01 Jan 2012, 23:02
Location: CANADA WINNIPEG
Country: Canada
Has thanked: 74 times
Been thanked: 119 times
Your Nord Gear #1: Nord Stage 2
Your Nord Gear #2: Nord Lead 1/2/2x

Re: For programmers: MIDIoUSB problem solved

Postby BruceV » 09 Jan 2017, 09:04

Thanks all. It looks like I'm on the right track with small delays, however I would have expected the protocol to handle queuing better than that.

My hub is powered.
BruceV
 
Posts: 17
Joined: 26 Dec 2016, 10:07
Has thanked: 5 times
Been thanked: 0 time
Your Nord Gear #1: Nord Stage 2 EX
Your Nord Gear #2: Other Brand

Re: For programmers: MIDIoUSB problem solved

Postby maxpiano » 09 Jan 2017, 09:16

As Mr G. Said and even on the traditional 31.25KHz serial MIDI, some older devices had too small buffers for MIDI Data that required slowing down the transmission of long Sysex sequences (and in fact most Librarian programs had an option to add such a delay, also MidiOx does). With MoUSB this problem shouldn't happen, unless you are using a USB to MIDI DIN cable/interface and that interface (translation chip) has too not enough buffers (this happens frequently with some cheap models)
User avatar
maxpiano
Patch Creator
 
Posts: 1901
Joined: 27 Jun 2011, 13:29
Location: Italy
Country: Italy
Has thanked: 167 times
Been thanked: 666 times
Your Nord Gear #1: Nord Stage 2


Return to General Synthesizers/Keyboards Forum



Who is online

Users browsing this forum: No registered users and 0 guests