Tuning RPNs: Difference between revisions

Wikispaces>TallKite
**Imported revision 452875632 - Original comment: **
Wikispaces>TallKite
**Imported revision 453092522 - Original comment: **
Line 1: Line 1:
<h2>IMPORTED REVISION FROM WIKISPACES</h2>
<h2>IMPORTED REVISION FROM WIKISPACES</h2>
This is an imported revision from Wikispaces. The revision metadata is included below for reference:<br>
This is an imported revision from Wikispaces. The revision metadata is included below for reference:<br>
: This revision was by author [[User:TallKite|TallKite]] and made on <tt>2013-09-20 22:27:21 UTC</tt>.<br>
: This revision was by author [[User:TallKite|TallKite]] and made on <tt>2013-09-22 08:13:36 UTC</tt>.<br>
: The original revision id was <tt>452875632</tt>.<br>
: The original revision id was <tt>453092522</tt>.<br>
: The revision comment was: <tt></tt><br>
: The revision comment was: <tt></tt><br>
The revision contents are below, presented both in the original Wikispaces Wikitext format, and in HTML exactly as Wikispaces rendered it.<br>
The revision contents are below, presented both in the original Wikispaces Wikitext format, and in HTML exactly as Wikispaces rendered it.<br>
Line 22: Line 22:
There are 3 parts to a tuning message: the input note, the output note, and the pitch bend. The input note is a midi note number which specifies a physical **__key__** on the controller. The output note is a midi note number which specifies a __**pitch**__ in the standard A-440 12-ET tuning. The pitch bend, which is the exact same format as the 2 data bytes of a standard midi pitch bend message, specifies how much to bend the output pitch. Upon receiving the input note, the synth produces this frequency:
There are 3 parts to a tuning message: the input note, the output note, and the pitch bend. The input note is a midi note number which specifies a physical **__key__** on the controller. The output note is a midi note number which specifies a __**pitch**__ in the standard A-440 12-ET tuning. The pitch bend, which is the exact same format as the 2 data bytes of a standard midi pitch bend message, specifies how much to bend the output pitch. Upon receiving the input note, the synth produces this frequency:


frequency = 440 * 2 ^ [ ((outputNote - 69) / 12) + (pitchBend / 8192 - 1) / 6) ]
frequency = 440 * 2 ^ [ (outputNote - 69) / 12 + (pitchBend / 8192 - 1) / 6 ]


The pitch bend range is "hard-wired" to 2 semitones, one sixth of an octave, hence the 6 at the end of the equation. If the physical pitch bend wheel is moved, that bend would be added onto the tuning bend. The physical pitch bend wheel is not hard-wired to 200¢ and is governed by the usual pitch bend range.
The pitch bend range is "hard-wired" to 2 semitones, one sixth of an octave, hence the 6 at the end of the equation. If the physical pitch bend wheel is moved, that bend would be added onto the tuning bend. The physical pitch bend wheel is not hard-wired to 200¢ and is governed by the usual pitch bend range.


Because microtonalists use array keyboards, there may be a full 128 keys in use. Any input key can be mapped to any output frequency. Because alternate tunings can have more than 12 notes per octave, more than one input note may be be mapped to the same output note. Therefore the pitch bend is associated with the input note, not the output note. Specifying an output note is optional. If none is specified, the output note is understood to be the same as the input note.
Because microtonalists use array keyboards, there may be a full 128 keys in use. Any input key can be mapped to any output frequency. Because alternate tunings can have more than 12 notes per octave, more than one input note may be be mapped to the same output note. Therefore the pitch bend is associated with the input note, not the output note. Specifying an output note is optional. If none is specified, the output note is understood to be the same as the input note.
The retuning is immediate (real-time), just like the standard pitch bend. One aim of the tuning method is to make extremely wide pitch glides possible. The synth should be able to retune a note as it's being played. Specifically, a tuning message that changes the output note number should not trigger a new ADSR envelope. That should only happen in response to note-ons.


This might be easier to understand if a hardware implementation is visualized. Imagine a 10-and-a-half octave keyboard with 128 keys. Behind each key is a tiny transposing slider and a tiny pitch bend wheel. The slider runs from 0 to 127 and sets that key's output pitch. The slider doesn't travel smoothly, rather it clicks into place on the whole numbers. The pitch bend wheel runs from -200¢ to 200¢ and sets the bend. When the keyboard is first turned on, all these wheels are set to center and all the sliders are set to match the key -- the lowest key's slider is 0, the 2nd one is 1, etc. Unlike the usual pitch bend wheel, which this keyboard also has, the tiny wheels don't have a spring that returns them to center. If one is moved to +30¢, it stays there until moved again. Using the sliders and wheels, any key on the keyboard can be set to play any pitch in the entire 10-and-a-half octave midi range. The synth's job is to produce whatever pitches are required by the keys and sliders and wheels, which may be further bent by the usual pitch bend wheel.
This might be easier to understand if a hardware implementation is visualized. Imagine a 10-and-a-half octave keyboard with 128 keys. Behind each key is a tiny transposing slider and a tiny pitch bend wheel. The slider runs from 0 to 127 and sets that key's output pitch. The slider doesn't travel smoothly, rather it clicks into place on the whole numbers. The pitch bend wheel runs from -200¢ to 200¢ and sets the bend. When the keyboard is first turned on, all these wheels are set to center and all the sliders are set to match the key -- the lowest key's slider is 0, the 2nd one is 1, etc. Unlike the usual pitch bend wheel, which this keyboard also has, the tiny wheels don't have a spring that returns them to center. If one is moved to +30¢, it stays there until moved again. Using the sliders and wheels, any key on the keyboard can be set to play any pitch in the entire 10-and-a-half octave midi range. The synth's job is to produce whatever pitches are required by the keys and sliders and wheels, which may be further bent by the usual pitch bend wheel.
Line 32: Line 34:
Sometimes the keyboard will actually be a touchscreen device, and instead of pressing a key, the musician simply touches the screen to play a note, with the touch's location determining the pitch. Dragging one's fingers along the surface generates ultra-wide pitch bends. This is a polyphonic device, with each finger being in effect a separate "key". There may be no retuning software, because the controller (or iPad app) will generate its own tuning messages. The imaginary keyboard analogous to this device has no tiny wheels and each tiny slider can travel freely without clicks. From the synth's point of view, the midi stream is the same as from a standard controller: note-ons and note-offs mixed with tuning messages and perhaps standard pitch bends.
Sometimes the keyboard will actually be a touchscreen device, and instead of pressing a key, the musician simply touches the screen to play a note, with the touch's location determining the pitch. Dragging one's fingers along the surface generates ultra-wide pitch bends. This is a polyphonic device, with each finger being in effect a separate "key". There may be no retuning software, because the controller (or iPad app) will generate its own tuning messages. The imaginary keyboard analogous to this device has no tiny wheels and each tiny slider can travel freely without clicks. From the synth's point of view, the midi stream is the same as from a standard controller: note-ons and note-offs mixed with tuning messages and perhaps standard pitch bends.


Multi-timbral synths should be able to handle as many as 16 of these keyboards at once, one per channel. (To be decided: Tuning messages must only affect their own channel, so that a pitch glide on one keyboard won't affect the tuning of another keyboard. **OR** Tuning messages must affect all channels at once, to reduce the volume of the midi traffic. If one keyboard is sending pitch glides, the synth developer can assume that that musician is using a separate instance of the synth.)
Multi-timbral synths should be able to handle as many as 16 of these keyboards at once, one per channel. A multi-timbral synth should be one of 3 types: mono-tunable, multi-tunable, or switchable. Mono-tunable synths force all channels to adhere to one tuning. Channel information in tuning messages is ignored, comparable to midi's omni mode. Multi-tunable synths permit all 16 channels to be tuned independently. Switchable synths can be switched between the two modes. The advantages of mono-tunable are a reduction in the volume of the midi traffic for the common situation of identical tunings in all channels, as well as easier implementation. The advantages of multi-tunable are being able to combine different tunings, and also a pitch glide on one keyboard won't affect the tuning of another keyboard. The advantages of multi-tunable can be achieved with mono-tunable software synths by using multiple instances of the synth. Switchable synths will respond to a special tuning message that sets the synth to either mono-tunable or multi-tunable. Switchable synths should default to the multi-tunable setting.
 


**__Implementation__:**
**__Implementation__:**
The new method uses keyswitches for the 5 highest keys, 123-127. If middle C is C4, these are notes D#9 to G9. The velocity of the keyswitches carries 1 byte of tuning information. Keyswitch F#9 is the input note, keyswitch F9 is the output note, and keyswitches E9 and D#9 are the pitch bend, in the exact same format as the standard midi pitch bend message. This makes it easier for the synth developer or designer, because he has already written code that deals with physical pitch bend wheel movement, and can just reuse it to deal with tuning keyswitches. To bend note nn on channel c to note mm with bend of yyzz would take up to 4 midi note-on messages. In hexadecimal the midi looks like this:
F#9 note-on: 9c FE nn (input note, only needs to be sent when the input note changes)
F9 note-on: 9c FD mm (output note, optional)
E9 note-on: 9c FC yy (coarse bend, optional)
D#9 note-on: 9c FB zz (fine bend, required)
These messages are always sent in this order. If the F#9 message is omitted, additional output note and bend messages continue to affect the current input note, overwriting previous output note and bend messages. The output note message is optional and would generally be omitted for 12-notes-per-octave tunings. The coarse bend could be omitted for slight pitch bends that don't change the MSB of the pitch bend. The required fine bend message functions as an "end of tuning message" marker and the synth waits until receiving this message to actually apply the new tuning. In general, the retuning software will limit the pitch bends to +/- 50¢. The midi stream for pitch glides will be reduced to mostly fine bends, with coarse bends whenever the MSB boundary is crossed, and output note messages whenever the note boundary is crossed.
The note-ons need to be balanced by note-offs to avoid being misinterpreted and possibly blocked by the DAW or other environment. To this end, the note-ons are alternated with note-offs. So if one input note message is 9c FE nn, the next one will be of the form 8c FE nn.
The G9 keyswitch with velocity 1 resets the tuning of all notes. On receiving this message, the synth should reset all notes on that channel back to standard tuning. To reset all notes on channel c:
G9 note-on: 9c FF 01 (reset all notes on channel c)
Because note-ons with velocity zero are interpreted as note-offs, such a message must be transmitted via the G9 keyswitch, using velocities 2 through 5:
G9 note-on: 9c FF 02 (set input note to #0)
G9 note-on: 9c FF 03 (set output note to the C 5 octaves below middle-C)
G9 note-on: 9c FF 04 (set coarse bend to 0¢)
G9 note-on: 9c FF 05 (set fine bend to 0¢)
To reset an individual note to standard pitch:
F#9 note-on: 9c FE nn (set input note)
F9 note-on: 9c FD nn (set output note to input note)
E9 note-on: 9c FC 80 (set coarse bend to 0¢)
G9 note-on: 9c FF 05 (set fine bend to 0¢)
To set a switchable multi-timbral synth to mono-tunable mode or multi-tunable mode:
G9 note-on: 9c FF 06 (set to mono-tunable)
G9 note-on: 9c FF 07 (set to multi-tunable)
Remember in all of these messages, the "9c" will be "8c" half the time.
----
**__Old Implementation, now obsolete__:**


//(We've recently discovered that RPN data messages are not completely supported, and are considering alternatives to RPNs like undefined CCs, user-defined CCs, and keyswitches - Ed.)//
//(We've recently discovered that RPN data messages are not completely supported, and are considering alternatives to RPNs like undefined CCs, user-defined CCs, and keyswitches - Ed.)//
Line 104: Line 148:
There are 3 parts to a tuning message: the input note, the output note, and the pitch bend. The input note is a midi note number which specifies a physical &lt;strong&gt;&lt;u&gt;key&lt;/u&gt;&lt;/strong&gt; on the controller. The output note is a midi note number which specifies a &lt;u&gt;&lt;strong&gt;pitch&lt;/strong&gt;&lt;/u&gt; in the standard A-440 12-ET tuning. The pitch bend, which is the exact same format as the 2 data bytes of a standard midi pitch bend message, specifies how much to bend the output pitch. Upon receiving the input note, the synth produces this frequency:&lt;br /&gt;
There are 3 parts to a tuning message: the input note, the output note, and the pitch bend. The input note is a midi note number which specifies a physical &lt;strong&gt;&lt;u&gt;key&lt;/u&gt;&lt;/strong&gt; on the controller. The output note is a midi note number which specifies a &lt;u&gt;&lt;strong&gt;pitch&lt;/strong&gt;&lt;/u&gt; in the standard A-440 12-ET tuning. The pitch bend, which is the exact same format as the 2 data bytes of a standard midi pitch bend message, specifies how much to bend the output pitch. Upon receiving the input note, the synth produces this frequency:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
frequency = 440 * 2 ^ [ ((outputNote - 69) / 12) + (pitchBend / 8192 - 1) / 6) ]&lt;br /&gt;
frequency = 440 * 2 ^ [ (outputNote - 69) / 12 + (pitchBend / 8192 - 1) / 6 ]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The pitch bend range is &amp;quot;hard-wired&amp;quot; to 2 semitones, one sixth of an octave, hence the 6 at the end of the equation. If the physical pitch bend wheel is moved, that bend would be added onto the tuning bend. The physical pitch bend wheel is not hard-wired to 200¢ and is governed by the usual pitch bend range.&lt;br /&gt;
The pitch bend range is &amp;quot;hard-wired&amp;quot; to 2 semitones, one sixth of an octave, hence the 6 at the end of the equation. If the physical pitch bend wheel is moved, that bend would be added onto the tuning bend. The physical pitch bend wheel is not hard-wired to 200¢ and is governed by the usual pitch bend range.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Because microtonalists use array keyboards, there may be a full 128 keys in use. Any input key can be mapped to any output frequency. Because alternate tunings can have more than 12 notes per octave, more than one input note may be be mapped to the same output note. Therefore the pitch bend is associated with the input note, not the output note. Specifying an output note is optional. If none is specified, the output note is understood to be the same as the input note.&lt;br /&gt;
Because microtonalists use array keyboards, there may be a full 128 keys in use. Any input key can be mapped to any output frequency. Because alternate tunings can have more than 12 notes per octave, more than one input note may be be mapped to the same output note. Therefore the pitch bend is associated with the input note, not the output note. Specifying an output note is optional. If none is specified, the output note is understood to be the same as the input note.&lt;br /&gt;
&lt;br /&gt;
The retuning is immediate (real-time), just like the standard pitch bend. One aim of the tuning method is to make extremely wide pitch glides possible. The synth should be able to retune a note as it's being played. Specifically, a tuning message that changes the output note number should not trigger a new ADSR envelope. That should only happen in response to note-ons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This might be easier to understand if a hardware implementation is visualized. Imagine a 10-and-a-half octave keyboard with 128 keys. Behind each key is a tiny transposing slider and a tiny pitch bend wheel. The slider runs from 0 to 127 and sets that key's output pitch. The slider doesn't travel smoothly, rather it clicks into place on the whole numbers. The pitch bend wheel runs from -200¢ to 200¢ and sets the bend. When the keyboard is first turned on, all these wheels are set to center and all the sliders are set to match the key -- the lowest key's slider is 0, the 2nd one is 1, etc. Unlike the usual pitch bend wheel, which this keyboard also has, the tiny wheels don't have a spring that returns them to center. If one is moved to +30¢, it stays there until moved again. Using the sliders and wheels, any key on the keyboard can be set to play any pitch in the entire 10-and-a-half octave midi range. The synth's job is to produce whatever pitches are required by the keys and sliders and wheels, which may be further bent by the usual pitch bend wheel.&lt;br /&gt;
This might be easier to understand if a hardware implementation is visualized. Imagine a 10-and-a-half octave keyboard with 128 keys. Behind each key is a tiny transposing slider and a tiny pitch bend wheel. The slider runs from 0 to 127 and sets that key's output pitch. The slider doesn't travel smoothly, rather it clicks into place on the whole numbers. The pitch bend wheel runs from -200¢ to 200¢ and sets the bend. When the keyboard is first turned on, all these wheels are set to center and all the sliders are set to match the key -- the lowest key's slider is 0, the 2nd one is 1, etc. Unlike the usual pitch bend wheel, which this keyboard also has, the tiny wheels don't have a spring that returns them to center. If one is moved to +30¢, it stays there until moved again. Using the sliders and wheels, any key on the keyboard can be set to play any pitch in the entire 10-and-a-half octave midi range. The synth's job is to produce whatever pitches are required by the keys and sliders and wheels, which may be further bent by the usual pitch bend wheel.&lt;br /&gt;
Line 114: Line 160:
Sometimes the keyboard will actually be a touchscreen device, and instead of pressing a key, the musician simply touches the screen to play a note, with the touch's location determining the pitch. Dragging one's fingers along the surface generates ultra-wide pitch bends. This is a polyphonic device, with each finger being in effect a separate &amp;quot;key&amp;quot;. There may be no retuning software, because the controller (or iPad app) will generate its own tuning messages. The imaginary keyboard analogous to this device has no tiny wheels and each tiny slider can travel freely without clicks. From the synth's point of view, the midi stream is the same as from a standard controller: note-ons and note-offs mixed with tuning messages and perhaps standard pitch bends.&lt;br /&gt;
Sometimes the keyboard will actually be a touchscreen device, and instead of pressing a key, the musician simply touches the screen to play a note, with the touch's location determining the pitch. Dragging one's fingers along the surface generates ultra-wide pitch bends. This is a polyphonic device, with each finger being in effect a separate &amp;quot;key&amp;quot;. There may be no retuning software, because the controller (or iPad app) will generate its own tuning messages. The imaginary keyboard analogous to this device has no tiny wheels and each tiny slider can travel freely without clicks. From the synth's point of view, the midi stream is the same as from a standard controller: note-ons and note-offs mixed with tuning messages and perhaps standard pitch bends.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multi-timbral synths should be able to handle as many as 16 of these keyboards at once, one per channel. (To be decided: Tuning messages must only affect their own channel, so that a pitch glide on one keyboard won't affect the tuning of another keyboard. &lt;strong&gt;OR&lt;/strong&gt; Tuning messages must affect all channels at once, to reduce the volume of the midi traffic. If one keyboard is sending pitch glides, the synth developer can assume that that musician is using a separate instance of the synth.)&lt;br /&gt;
Multi-timbral synths should be able to handle as many as 16 of these keyboards at once, one per channel. A multi-timbral synth should be one of 3 types: mono-tunable, multi-tunable, or switchable. Mono-tunable synths force all channels to adhere to one tuning. Channel information in tuning messages is ignored, comparable to midi's omni mode. Multi-tunable synths permit all 16 channels to be tuned independently. Switchable synths can be switched between the two modes. The advantages of mono-tunable are a reduction in the volume of the midi traffic for the common situation of identical tunings in all channels, as well as easier implementation. The advantages of multi-tunable are being able to combine different tunings, and also a pitch glide on one keyboard won't affect the tuning of another keyboard. The advantages of multi-tunable can be achieved with mono-tunable software synths by using multiple instances of the synth. Switchable synths will respond to a special tuning message that sets the synth to either mono-tunable or multi-tunable. Switchable synths should default to the multi-tunable setting.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;u&gt;Implementation&lt;/u&gt;:&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;u&gt;Implementation&lt;/u&gt;:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The new method uses keyswitches for the 5 highest keys, 123-127. If middle C is C4, these are notes D#9 to G9. The velocity of the keyswitches carries 1 byte of tuning information. Keyswitch F#9 is the input note, keyswitch F9 is the output note, and keyswitches E9 and D#9 are the pitch bend, in the exact same format as the standard midi pitch bend message. This makes it easier for the synth developer or designer, because he has already written code that deals with physical pitch bend wheel movement, and can just reuse it to deal with tuning keyswitches. To bend note nn on channel c to note mm with bend of yyzz would take up to 4 midi note-on messages. In hexadecimal the midi looks like this:&lt;br /&gt;
&lt;br /&gt;
F#9 note-on: 9c FE nn (input note, only needs to be sent when the input note changes)&lt;br /&gt;
F9 note-on: 9c FD mm (output note, optional)&lt;br /&gt;
E9 note-on: 9c FC yy (coarse bend, optional)&lt;br /&gt;
D#9 note-on: 9c FB zz (fine bend, required)&lt;br /&gt;
&lt;br /&gt;
These messages are always sent in this order. If the F#9 message is omitted, additional output note and bend messages continue to affect the current input note, overwriting previous output note and bend messages. The output note message is optional and would generally be omitted for 12-notes-per-octave tunings. The coarse bend could be omitted for slight pitch bends that don't change the MSB of the pitch bend. The required fine bend message functions as an &amp;quot;end of tuning message&amp;quot; marker and the synth waits until receiving this message to actually apply the new tuning. In general, the retuning software will limit the pitch bends to +/- 50¢. The midi stream for pitch glides will be reduced to mostly fine bends, with coarse bends whenever the MSB boundary is crossed, and output note messages whenever the note boundary is crossed.&lt;br /&gt;
&lt;br /&gt;
The note-ons need to be balanced by note-offs to avoid being misinterpreted and possibly blocked by the DAW or other environment. To this end, the note-ons are alternated with note-offs. So if one input note message is 9c FE nn, the next one will be of the form 8c FE nn.&lt;br /&gt;
&lt;br /&gt;
The G9 keyswitch with velocity 1 resets the tuning of all notes. On receiving this message, the synth should reset all notes on that channel back to standard tuning. To reset all notes on channel c:&lt;br /&gt;
&lt;br /&gt;
G9 note-on: 9c FF 01 (reset all notes on channel c)&lt;br /&gt;
&lt;br /&gt;
Because note-ons with velocity zero are interpreted as note-offs, such a message must be transmitted via the G9 keyswitch, using velocities 2 through 5:&lt;br /&gt;
&lt;br /&gt;
G9 note-on: 9c FF 02 (set input note to #0)&lt;br /&gt;
G9 note-on: 9c FF 03 (set output note to the C 5 octaves below middle-C)&lt;br /&gt;
G9 note-on: 9c FF 04 (set coarse bend to 0¢)&lt;br /&gt;
G9 note-on: 9c FF 05 (set fine bend to 0¢)&lt;br /&gt;
&lt;br /&gt;
To reset an individual note to standard pitch:&lt;br /&gt;
&lt;br /&gt;
F#9 note-on: 9c FE nn (set input note)&lt;br /&gt;
F9 note-on: 9c FD nn (set output note to input note)&lt;br /&gt;
E9 note-on: 9c FC 80 (set coarse bend to 0¢)&lt;br /&gt;
G9 note-on: 9c FF 05 (set fine bend to 0¢)&lt;br /&gt;
&lt;br /&gt;
To set a switchable multi-timbral synth to mono-tunable mode or multi-tunable mode:&lt;br /&gt;
&lt;br /&gt;
G9 note-on: 9c FF 06 (set to mono-tunable)&lt;br /&gt;
G9 note-on: 9c FF 07 (set to multi-tunable)&lt;br /&gt;
&lt;br /&gt;
Remember in all of these messages, the &amp;quot;9c&amp;quot; will be &amp;quot;8c&amp;quot; half the time.&lt;br /&gt;
&lt;br /&gt;
&lt;hr /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;u&gt;Old Implementation, now obsolete&lt;/u&gt;:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;(We've recently discovered that RPN data messages are not completely supported, and are considering alternatives to RPNs like undefined CCs, user-defined CCs, and keyswitches - Ed.)&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;(We've recently discovered that RPN data messages are not completely supported, and are considering alternatives to RPNs like undefined CCs, user-defined CCs, and keyswitches - Ed.)&lt;/em&gt;&lt;br /&gt;