back to list

Re: Midi pitch bend range - how to set it from a midi file / sequencer

🔗Robert Walker <robert_walker@rcwalker.freeserve.co.uk>

5/7/2001 9:14:23 AM

Hi Manuel

There is a standard way to set the pitch bend range in Midi,
though it is somewhat esoteric the way it is done, I agree:

You use the registered parameter number 0.

I call it for all the channels in my midi files, just in case
it isn't set to the default of +- one tone.

To use the rpn, first you do two controller messages with
0x64 as the controller (coarse rpn) and 0x65 as the controller
(fine rpn) and the registered parameter number as the data
for both of them.

Here it is for channel 1.

:00 b0 65 00 ;channel 1 controller - fine rpn 0 (pitch bend sensitivity)
:00 b0 64 00 ;channel 1 controller - coarse registered parameter number 0

Then you call the data entry controller which is 06 for the most significant
byte, and 26 for the least significant byte. You pass the amount of the
range as the data:

:00 b0 06 02 ;channel 1 controller Data Entry - coarse pitch bend range 2 semitones
:00 b0 26 00 ;channel 1 controller Data Entry - fine pitch bend range 0 cents

Finally, it is considered good practice to null the rpn when you are finished with
it, which you do by calling the rpn controllers again with 0x7f (127) as the data.

:00 b0 65 7f ;channel 1 controller - fine rpn 127 (Null the active parameter numbre)
:00 b0 64 7f ;channel 1 controller - coarse registered parameter number 127

Ability to change pitch bend range must be pretty standard in modern soundcards, as
the Quicktime media player automatically resets the pitch bend range to +- 2 octaves.
This is for convenience of programmers using a Quicktime programming language.

See my post to the TL on "Basson piano pitch bends", 2/14/01.

Quicktime does this for its own internal synth. However, you can also set the
midi device on your soundcard as the output for Quicktime (in windows:
Control panel | Quicktime | Music), and if you do this, Quicktime resets the
pitch bend range for your soundcard to +- 2 octaves while playing. You can
midi relay the output and look at the data and find the pitch bend range changing
messages.

To work around the pitch bend range change, it re-writes all the pitch bends
from the midi file on the fly, result being that the midi clip
still sounds the same as before. The loss of pitch bend resolution resulting
from multiplying the smallest pitch bend unit by 12 isn't significant, as it
is likely to still be smaller than the pitch bend resolution of the soundcard.

(This caused me a fair amount of puzzlement at the time!)

Kind of a bit strange that they would do it that way, as one would think they
could just relay the data unchanged from the midi file without doing anything
to it at all when the output device is set in this way, and then it wouldn't
matter whether or not the output device supported a two octave pitch
bend range. Must be some fairly strong overriding reason for it I suppose.

For the FTS "joystick theremin", one option resets the pitch bend range to the
entire range needed for the theremin to get smooth pitch bending without need
to resound the notes, if synthesiser or soundcard supports it.

The other way, if one wanted more accuracy for whatever reason, and the other
equipment supports it (music using slow beating notes?), one could
still play any pitch one wants using a range of +- half a semitone, and so
a quarter of the size of the unit, or even less if one didn't need to
go as far from 12-tet as a quarter note sharp / flat.

I find that changing the pitch bend range can take a significant amount of
time in terms of milliseconds. So one will usually do it for all the channels
at once at start of the midi file, rather than for each note as it is played.

Anyway, with +- one tone as the Midi standard, and +- two octaves as another
standard that a fair number of Quicktime programmers will be used to, there is
clearly no fixed midi pitch bend unit.

Robert