fbpx
Skip to main content

MIDI Forum

Change MIDI Keyboar...
 
Notifications
Clear all

Change MIDI Keyboard Master Volume Programmatically

7 Posts
5 Users
0 Reactions
20.2 K Views
Bassel
Posts: 1
New Member
Topic starter
 

Hello,

I am developing an iOS Application that connects to a midi keyboard, and controls the keyboard.

I was able to send messages to play notes, change the pitch band, and many other functionalities.

But i was unsuccessful to send system exclusive real time messages, for example microtuning and changing the master volume.

I have tested on several keyboards with no luck.

I am sending for changing the Master volume to 0 the following hexadecimal values :

F0 7F 7F 04 01 00 00 F7

Nothing is changing when i send it, volume remains the same.

Please help, i have no idea what i am missing.

 
Posted : 28/02/2017 8:32 am
Clemens Ladisch
Posts: 324
 

Do you actually know that these keyboards support master volume?

If yes, there might be something wrong with the way you're sending the SysEx messages.

 
Posted : 28/02/2017 10:37 am
Michael Rideout
Posts: 18
Active Member
 

I don't know if this will help, but one thing to be aware of-- in case you don't already know-- is that MIDI documentation sometimes omits things which are considered to be obvious, or which are typically handled by the software you're using. For instance, SysEx messages should include the length of the message after the F0 byte-- but since the length is often automatically added and transmitted by the software, it might not be shown in the documentation.

So your Master Tuning message should really be as follows:

F0 07 7F 7F 04 01 00 00 F7

The 07 after the F0 indicates that the rest of the message is 7 bytes long. If you're using a program that automatically counts the number of bytes in the message and adds the length for you, then you would omit the 07 and let the program insert it for you. But if you're writing your own program to send SysEx messages then you'll need to be sure you include the length.

Meta Events are similar-- they need to include a length after the Meta Event subtype to indicate how many bytes of data there are.

 
Posted : 01/03/2017 12:51 am
Clemens Ladisch
Posts: 324
 

SysEx messages should include the length of the message after the F0 byte-- but since the length is often automatically added and transmitted by the software, it might not be shown in the documentation.

This is wrong; SysEx messages are not transmitted with a length.

(SysEx messages have a length only when stored in a SMF file.)

Meta Events

… appear only in SMF files and are never transmitted directly.

 
Posted : 01/03/2017 2:04 am
Michael Rideout
Posts: 18
Active Member
 

Yes, I was aware that Meta Events are restricted to MIDI files; FF = Reset when transmitted.

But I hadn't heard that SysEx events don't include a length when transmitted. Thank you very much for educating me on that! 🙂

 
Posted : 01/03/2017 10:17 am
Geoff
Posts: 1047
Noble Member
 

Just to clarify, on the basis of MY experience.

Sysex messages may or may not need a length. It depends. On the actual message, on the actual machine/device, on the manufacturer.

Some messages are inherently of fixed length, and some devices will expect/recognise that length ONLY, and therefore length is not required. In other situations (even on the same device) a length will be required. If the documentation does not show a length, then I'd assume it is NOT required. If another example in the same instructions DOES show a length, then it's because THAT message DOES need the length.

We should NOT generalise about SYSEX. That's just what SYSEX is all about, after all!!

Geoff

 
Posted : 30/05/2018 8:27 am
Tobias
Posts: 3
Active Member
 

Sysex messages may or may not need a length.

According to the specification the length of a sysex message is only saved in SMF and never transmitted. In case a device needs a length in certain messages, then it is part of the device specific message but not part of the surrounding sysex frame. So the size comes *after* the device id, while in standard MIDI files it comes *before* it, right after F0.

I can imagine two reasons to require a length in a sysex message:

  • Knowing the size in advance allows to allocate a buffer of the right size and/or disable parsing while receiving the message.
  • When you want to encapsulate several variable length messages in one sysex block there must be a way to figure out to which message a byte belongs.

The length of a transmitted SysEx block is always determined by the closing F7 byte.

 
Posted : 09/09/2018 3:33 am
Share: