8

I have been making some basic MIDI files (based on one created by an app) and they are not behaving exactly as I expected. Take the following string:

00 90 36 50 00 39 50 00 3B 50 00 3E 50 9F 7F B0 7B 00

I understand this as follows:

00 90 - at delta time 0, note on (channel 1):

... 36 50 - note 36, velocity 50

... 00 39 50 - at delta time 0, note 39, velocity 50

... 00 3B 50 - at delta time 0, note 3B, velocity 50

... 00 3E 50 - at delta time 0, note 3E, velocity 50

So it seems as though the 'note on' command opens a sort of bracket and does not need to be repeated for each note.

9F 7F B0 7B 00 (at delta time 9F 7F, all notes off).

When the file contains this string, the notes do not sound. If the note off command is replaced by separate note on commands for each individual note, with the velocity set to zero, the notes do sound and do end - but this means twice as much manual editing down the line, so I want to use the 'all off' approach.

I think I must be misunderstanding something so any pointers would be welcome!

Thanks

  • 1
    It's been far too long since i worked that closely with raw midi data, but I'd always think of 7F as poly on [mono off] rather than all notes off. A lot of synths used to ignore all notes off, which I'd think of as 7B. If you're using running status, which you appear to be, then note on value zero would be the way to go, unless you have devices that respond to off velocity. – Tetsujin Nov 16 '15 at 18:42
  • 1
    Are the time delta bytes actually being transmitted or is that used by the program that will transmit the data? The MIDI spec says "A single Note-On message consists of 3 bytes..." Running Status mode should drop the second and subsequent Note-On messages to 2 bytes. BTW the spec also points out that for efficient "note off" messages in Running Status mode, one can (should?) send Note-On with velocity 0 instead of changing to Note-Off messages. – Todd Wilcox Nov 16 '15 at 18:45
  • Thanks - Tetsujin I think the string does use 7B for all notes off (isn't the 7F part of the delta time? I think it must be because the previous byte is greater than 80 i.e. has the most significant bit set). – Dark Ages Nov 16 '15 at 20:37
  • Running status! Now it makes sense - didn't know about that. It explains why the 90 command 'opens a bracket' which then closed by the B0 command. Todd I think all notes off is going to be more efficient in my case because I have to edit the file manually to make about 100 separate files out of the same template, and all notes off will halve the editing work. At least, if it worked it would... – Dark Ages Nov 16 '15 at 20:40
  • I think what I'll do is put in a bit of boilerplate that just switches every single note off - that way I don't have to change it in each file. – Dark Ages Nov 16 '15 at 20:49
2

The Standard MIDI-File Format Spec. 1.1 says about repeated status bytes:

Running status is used: status bytes of MIDI channel messages may be omitted if the preceding event is a MIDI channel message with the same status. The first event in each MTrk chunk must specify status. Delta-time is not considered an event itself: it is an integral part of the syntax for an MTrk event. Notice that running status occurs across delta-times.

The MIDI 1.0 Detailed Specification says:

[controller] Messages 123 through 127 also function as All Notes Off messages. They will turn off all voices controlled by the assigned Basic Channel. These messages should not be sent periodically, but only for a specific purpose. In no case should they be used in lieu of Note Off commands to turn off notes which have been previously turned on. Any All Notes Off command (123-127) may by ignored by a receiver with no possibility of notes staying on, since any Note On command must have a corresponding specific Note Off command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.