simple ms delay for midi note pitch only possible?

bilo2014's icon

Hello,

How to implement the following?

As soon as I send any note via midi, the velocity value should go through first and the note pitch value, which can be adjusted in ms, should follow with a delay.

Regards

B.T

Jan M's icon

A MIDI note message carries the values of pitch and velocity within the same package. You can only delay the entire package, otherwise it will result in broken data.

bilo2014's icon

Hello,

It's a shame, I thought almost anything was possible with Maxforlive :-)

back to the topic again.

I thought that borax would make it possible.

Can broken data still be sent out?

Regards

B.T

Lewis Keller's icon

Like this? Note offs will also be delayed and I've ignored pitch bend, etc....hence broken data.

Max Patch
Copy patch and select New From Clipboard in Max.

Source Audio's icon

you can do whatever you want to midi note input,

but must reassemble it back in proper order in case you want to use result for midi note output.

here note On gets delayed, note Off not

Max Patch
Copy patch and select New From Clipboard in Max.

you could for example extract velocity and use it as CC# value

and note number as program change delayed or not .

Jan M's icon

@BILO2014,

delaying a part of a MIDI message doesn't make sense.

No receiving device or program would be able to handle those data.
Imagine a synth receiving a velocity information without a pitch. There would be nothing to do with information except waiting for the pitch. And meanwhile, while waiting maybe another byte from a completely different message would arrive. What to do with that information? Which byte belongs to which message? This approach would lead to a ton of unpredictable and broken behaviour.

And even if the pitch information would arrive eventually and it could be combined correctly with the velocity: the action (playing a note) can only be executed once all information is available. The result would be se same as sending them together in the first place.

What are you trying to achieve? What result are you looking for?

Andy Maskell's icon

Unfortunately, you can not do what you are asking for. This is not a weakness of Max but due to the definitions laid down by the MIDI protocol.

All MIDI messages have very a simple but very rigid format. The first byte, which is always in the range 128-255 (high bit set), defines the message type (note on, note off, CC, pitchbend, sysex, etc). System messages (240-255) have variable formats according to function and can comprise any number of data bytes (0-127).

Channel messages (range 128-239) combine the message type and the channel number (1-16). This is followed by two (occasionally one) data bytes, always in the range 0-127 (high bit reset). The purpose of these two data bytes varies according to the type of message, but in the case of notes, the values are the note number and the note velocity. There is no mechanism in Max by which one could be sent without the other. If there were a means to send one data byte instead of two, the formatting of MIDI messages dictates that the message should be ignored.

Even if you considered using a zero value for one of the data bytes, 0 is a valid note number (C-2) and is also a valid note velocity (velocity = 0, or note not pressed, also frequently interpretted as equivalent to Note Off).

As this MIDI format is rigidly defined, you will find that any MIDI related functions in Max will only ever act on complete messages and ignore incomplete ones. Even where you can sepearate the two data bytes to apply other functions to them, you will have to recombine them again at some point to have them processed as valid MIDI messages.

[borax] is really an object used for managing notes played in a sequencer or read in from a MIDI song file (*.mid).

Roman Thilenius's icon

Can broken data still be sent out?

nope. midiout type externals do nothing when the third byte is missing.


simply put: "channel, note" is not MIDI.

there is only "note-on" and "note-off" and both require the velocity value.

bilo2014's icon

Wow, a lot of input and reading material.

Thanks to everyone involved.

The purpose why I need this is that the note velocity is needed as a control signal for an operation. However, the simultaneous note pitch value that is sent with it creates an audible disturbance or switching effect tone in the first milliseconds of the process. I could make this sound inaudible by shifting the note pitch value in ms.

Regards

B.T