0

Are there some common algorithms for implementing MIDI pitch bend for single notes and multi voices (e.g. chords). I am implementing this in kind of an intuitive way, but I would really like to know if I am not totally off-track! For single notes I currently I am sending a pitch bend message to the channel, just before the note on message, and resetting the pitch bend by sending it the center value of 2^13, right after the note off message has been sent to keep the channel clean for the next coming note! I am specially interested in how to deal with channels for implementing the pitch bends. Any help or hint to appropriate readings is highly appreciated.

PS: here is how I have implemented pitch bend for a single note (https://github.com/teymuri/cu/blob/main/mid.py#L61)

Student
  • 708
  • 4
  • 11

1 Answers1

0

A pitch bend message affects all sounds on the channel. So you should send it when you want the pitch to change.

The sound might not stop immediately after a note-off message. You should not reset the pitch bend until you are sure that the sound has ended. (Or don't reset it at all; the pitch of silence does not matter.)

If you want to do microtonality, you pretty much have to use one channel per note.

CL.
  • 173,858
  • 17
  • 217
  • 259
  • I send the resetting the pitch of channel right "after" the note-off message has been sent. And not resetting a channel seems to me not a good option, since this leaves the "bent" channel unusable for next notes. – Student Jan 29 '23 at 21:53
  • For microtonality/xenharmony, multiplying the number of channels (or rather track-channel combinations?) by the number of [pitch classes](https://en.wikipedia.org/wiki/Pitch_class) rather than the number of notes is enough. Sometimes fewer, for example factor 2 is enough for 24-TET. – root Aug 04 '23 at 08:05