AM_MIDI2.0Lib icon indicating copy to clipboard operation
AM_MIDI2.0Lib copied to clipboard

Request: Add support for MIDI 1.0 UMP to MIDI 2.0 UMP Protocol upscaling

Open Psychlist1972 opened this issue 1 year ago • 5 comments

You currently have the MIDI 2 UMP <-> MIDI 1 UMP transform. This is a request for the opposite.

In practice, all MIDI 2.0 devices should be able to handle MIDI 1.0 messages, but that isn't a hard requirement in the spec.

If, during discovery, a device declares support for MIDI 2.0 protocol, but does not declare support for MIDI 1.0 protocol, we want to be able to upscale MIDI 1.0 messages sent to the endpoint.

Psychlist1972 avatar Aug 16 '24 18:08 Psychlist1972

@Psychlist1972 I can add a class to do this.

However if I go ahead with this I would like to remove the bytestream to MIDI 2.0 Protocol (it's only an option currently). Instead I would just have the Bytestream to UMP MIDI 1.0 Protocol, and then separately do a UMP MIDI 1.0 Protocol to MIDI 2.0 Protocol.

If I went down this path would that break anything for you?

starfishmod avatar Aug 21 '24 03:08 starfishmod

I don't think that breaks anything here.

We're currently using:

bytestreamToUMP
umpToBytestream
umpToMIDI1Protocol

As long as none of those break, the change will be fine.

Psychlist1972 avatar Aug 22 '24 22:08 Psychlist1972

@Psychlist1972 I have updated the code to have the feature I believe you want. Can you please review and confirm? Once that is done I can make a new vcpkg :)

starfishmod avatar Sep 06 '24 01:09 starfishmod

@Psychlist1972 I have updated the code to have the feature I believe you want. Can you please review and confirm? Once that is done I can make a new vcpkg :)

Thanks! I'll take a look. The only way I can actually test through the current tests without messing up the internal builds is if there's a vcpkg.

Psychlist1972 avatar Sep 06 '24 19:09 Psychlist1972

I looked at ump2MIDI2Protocol.h

Looking at that, I assume we need to pre-check to see that it's a type 2 MIDI 1 message (one word) before passing it in. If so, that's fine.

Is val2 correct here?

                        if (status == 0x90 && val2 == 0)
                        {
                            status = 0x80;
                            val2 = 0x40;
                        }

Not sure if that's a special case in your code. I know it should translate to a velocity of 0x0000 though.

MIDI 1.0 Note On and Note Off A MIDI 1.0 Protocol Note On message with a Velocity of 0x00 is special (i.e., is equal to Note Off), and shall be translated to a MIDI 2.0 Protocol Note Off message with Velocity 0x0000. For Velocity values from 1-127, use the upscaling method described in Section D.1.3. MIDI Velocity = 0x01: translates to 0x0200

I assume it's passing your unit tests. I can run through ours when there's a vcpkg. Thanks!

Psychlist1972 avatar Sep 06 '24 19:09 Psychlist1972

@Psychlist1972 this task has been done (quite sometime ago!) and is now closed

starfishmod avatar May 15 '25 22:05 starfishmod