Tuning RPNs: Difference between revisions
Wikispaces>TallKite **Imported revision 451155272 - Original comment: ** |
Wikispaces>TallKite **Imported revision 452036444 - 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- | : This revision was by author [[User:TallKite|TallKite]] and made on <tt>2013-09-18 03:19:53 UTC</tt>.<br> | ||
: The original revision id was <tt> | : The original revision id was <tt>452036444</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 16: | Line 16: | ||
After much discussion, we came up with a specific method, and we'd like your input. The original discussion is in this XA facebook megathread: [[@https://www.facebook.com/groups/xenharmonic2/permalink/621829327837373/]] The main contributors were Robert Walker, Kite Giedraitis, Rob Fielding, and Graham Breed. | After much discussion, we came up with a specific method, and we'd like your input. The original discussion is in this XA facebook megathread: [[@https://www.facebook.com/groups/xenharmonic2/permalink/621829327837373/]] The main contributors were Robert Walker, Kite Giedraitis, Rob Fielding, and Graham Breed. | ||
The new method uses RPNs (Registered Parameter Numbers). The technical details: There are about 16,000 possible RPN parameters, and only about a dozen are in use. We can use a block of 128 RPNs, one for each note number, for retuning. Data MSB and LSB messages for these RPNs contain the cents to retune by, in the exact same format as the standard midi pitch bend message. The retuning is immediate (real-time), just like the standard pitch bend. 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 RPNs. | 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) * (pitchBendRange / 1200) ] | |||
The pitch bend range is expressed here in cents, not semitones. It's the exact same range that the standard midi pitch bend message uses. | |||
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 new method uses RPNs (Registered Parameter Numbers). The technical details: There are about 16,000 possible RPN parameters, and only about a dozen are in use. We can use a block of 128 RPNs, one for each input note number, for retuning. Data MSB and LSB messages for these RPNs contain the cents to retune by, in the exact same format as the standard midi pitch bend message. The retuning is immediate (real-time), just like the standard pitch bend. 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 RPNs. To define the output note, we use either a data increment or a data decrement message to transpose the input note by so many semitones, allowing for non-12-note tunings. If the RPN MSB is 100 = 64 hexadecimal, then to bend note nn on channel c to note mm with bend of yyzz would take up to 5 midi CC (Controller Change) messages. In hexadecimal the midi looks like this: | |||
RPN MSB: Bc 65 64 (start retuning, B means CC message, 65 means set RPN parameter MSB) | RPN MSB: Bc 65 64 (start retuning, B means CC message, 65 means set RPN parameter MSB) | ||
RPN LSB: Bc 64 nn (note | RPN LSB: Bc 64 nn (input note, 64 means set RPN parameter LSB) | ||
data inc: Bc 60 mm-nn --OR-- data dec: Bc 61 nn-mm (transpose up/down, optional) | data inc: Bc 60 mm-nn --OR-- data dec: Bc 61 nn-mm (transpose up/down, optional) | ||
data MSB: Bc 06 yy (coarse tune, optional) | data MSB: Bc 06 yy (coarse tune, optional) | ||
| Line 28: | Line 36: | ||
The data inc/dec message is optional and would generally be omitted for 12-notes-per-octave tunings. The data MSB could be omitted for slight pitch bends that don't change the MSB. The required data LSB functions as an "end of tuning message" marker and the synth waits until receiving this message to actually apply the new tuning. | The data inc/dec message is optional and would generally be omitted for 12-notes-per-octave tunings. The data MSB could be omitted for slight pitch bends that don't change the MSB. The required data LSB functions as an "end of tuning message" marker and the synth waits until receiving this message to actually apply the new tuning. | ||
A possible conflict arises with NRPNs, which use the same data inc/dec/MSB/LSB messages. The solution is for the tuning software to monitor the midi stream for NRPNs, and if found, take these steps: Remember the current NRPN parameter number, | A possible conflict arises with NRPNs, which use the same data inc/dec/MSB/LSB messages. The solution is for the tuning software to monitor the midi stream for NRPNs, and if any are found, take these steps: Remember the current NRPN parameter number, never omit the RPN MSB and LSB when retuning, and send a NRPN MSB/LSB message after retuning to restore the current NRPN parameter. Similar steps should be taken if one of the few RPNs already defined are encountered. | ||
An additional RPN of 101, 0 is for resetting the tuning of all notes. On receiving this RPN, the synth should reset all notes on that channel back to standard tuning. The data MSB/LSB/inc/dec messages are not needed. To reset all notes on channel c: | An additional RPN of 101, 0 is for resetting the tuning of all notes. On receiving this RPN, the synth should reset all notes on that channel back to standard tuning. The data MSB/LSB/inc/dec messages are not needed. To reset all notes on channel c: | ||
| Line 37: | Line 45: | ||
A few recommended practices for synths: | A few recommended practices for synths: | ||
One aim of the tuning RPN 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 data inc/dec message that changes the output note number should not trigger a new | One aim of the tuning RPN 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 data inc/dec message that changes the output note number should not trigger a new ADSR envelope. That should only happen in response to note-ons. The midi stream for pitch glides will be reduced to mostly data LSBs, with data MSBs whenever the MSB boundary is crossed, and data inc/dec whenever the note boundary is crossed. | ||
A pitch bend range of 200¢ can generally be assumed. Ideally the synth should respond to RPN 0,0 = pitch bend sensitivity, for greater flexibility. Upon responding, the synth should update any manual range control it may have on its screen. | A pitch bend range of 200¢ can generally be assumed. Ideally the synth should respond to RPN 0,0 = pitch bend sensitivity, for greater flexibility. Upon responding, the synth should update any manual range control it may have on its screen. | ||
| Line 77: | Line 85: | ||
After much discussion, we came up with a specific method, and we'd like your input. The original discussion is in this XA facebook megathread: <a class="wiki_link_ext" href="https://www.facebook.com/groups/xenharmonic2/permalink/621829327837373/" rel="nofollow" target="_blank">https://www.facebook.com/groups/xenharmonic2/permalink/621829327837373/</a> The main contributors were Robert Walker, Kite Giedraitis, Rob Fielding, and Graham Breed.<br /> | After much discussion, we came up with a specific method, and we'd like your input. The original discussion is in this XA facebook megathread: <a class="wiki_link_ext" href="https://www.facebook.com/groups/xenharmonic2/permalink/621829327837373/" rel="nofollow" target="_blank">https://www.facebook.com/groups/xenharmonic2/permalink/621829327837373/</a> The main contributors were Robert Walker, Kite Giedraitis, Rob Fielding, and Graham Breed.<br /> | ||
<br /> | <br /> | ||
The new method uses RPNs (Registered Parameter Numbers). The technical details: There are about 16,000 possible RPN parameters, and only about a dozen are in use. We can use a block of 128 RPNs, one for each note number, for retuning. Data MSB and LSB messages for these RPNs contain the cents to retune by, in the exact same format as the standard midi pitch bend message. The retuning is immediate (real-time), just like the standard pitch bend. 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 RPNs. | 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 <strong><u>key</u></strong> on the controller. The output note is a midi note number which specifies a <u><strong>pitch</strong></u> 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:<br /> | ||
<br /> | |||
frequency = 440 * 2 ^ [ ((outputNote - 69) / 12) + (pitchBend / 8192 - 1) * (pitchBendRange / 1200) ]<br /> | |||
<br /> | |||
The pitch bend range is expressed here in cents, not semitones. It's the exact same range that the standard midi pitch bend message uses.<br /> | |||
<br /> | |||
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.<br /> | |||
<br /> | |||
The new method uses RPNs (Registered Parameter Numbers). The technical details: There are about 16,000 possible RPN parameters, and only about a dozen are in use. We can use a block of 128 RPNs, one for each input note number, for retuning. Data MSB and LSB messages for these RPNs contain the cents to retune by, in the exact same format as the standard midi pitch bend message. The retuning is immediate (real-time), just like the standard pitch bend. 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 RPNs. To define the output note, we use either a data increment or a data decrement message to transpose the input note by so many semitones, allowing for non-12-note tunings. If the RPN MSB is 100 = 64 hexadecimal, then to bend note nn on channel c to note mm with bend of yyzz would take up to 5 midi CC (Controller Change) messages. In hexadecimal the midi looks like this:<br /> | |||
<br /> | <br /> | ||
RPN MSB: Bc 65 64 (start retuning, B means CC message, 65 means set RPN parameter MSB)<br /> | RPN MSB: Bc 65 64 (start retuning, B means CC message, 65 means set RPN parameter MSB)<br /> | ||
RPN LSB: Bc 64 nn (note | RPN LSB: Bc 64 nn (input note, 64 means set RPN parameter LSB)<br /> | ||
data inc: Bc 60 mm-nn --OR-- data dec: Bc 61 nn-mm (transpose up/down, optional)<br /> | data inc: Bc 60 mm-nn --OR-- data dec: Bc 61 nn-mm (transpose up/down, optional)<br /> | ||
data MSB: Bc 06 yy (coarse tune, optional)<br /> | data MSB: Bc 06 yy (coarse tune, optional)<br /> | ||
| Line 89: | Line 105: | ||
The data inc/dec message is optional and would generally be omitted for 12-notes-per-octave tunings. The data MSB could be omitted for slight pitch bends that don't change the MSB. The required data LSB functions as an &quot;end of tuning message&quot; marker and the synth waits until receiving this message to actually apply the new tuning.<br /> | The data inc/dec message is optional and would generally be omitted for 12-notes-per-octave tunings. The data MSB could be omitted for slight pitch bends that don't change the MSB. The required data LSB functions as an &quot;end of tuning message&quot; marker and the synth waits until receiving this message to actually apply the new tuning.<br /> | ||
<br /> | <br /> | ||
A possible conflict arises with NRPNs, which use the same data inc/dec/MSB/LSB messages. The solution is for the tuning software to monitor the midi stream for NRPNs, and if found, take these steps: Remember the current NRPN parameter number, | A possible conflict arises with NRPNs, which use the same data inc/dec/MSB/LSB messages. The solution is for the tuning software to monitor the midi stream for NRPNs, and if any are found, take these steps: Remember the current NRPN parameter number, never omit the RPN MSB and LSB when retuning, and send a NRPN MSB/LSB message after retuning to restore the current NRPN parameter. Similar steps should be taken if one of the few RPNs already defined are encountered.<br /> | ||
<br /> | <br /> | ||
An additional RPN of 101, 0 is for resetting the tuning of all notes. On receiving this RPN, the synth should reset all notes on that channel back to standard tuning. The data MSB/LSB/inc/dec messages are not needed. To reset all notes on channel c:<br /> | An additional RPN of 101, 0 is for resetting the tuning of all notes. On receiving this RPN, the synth should reset all notes on that channel back to standard tuning. The data MSB/LSB/inc/dec messages are not needed. To reset all notes on channel c:<br /> | ||
| Line 98: | Line 114: | ||
A few recommended practices for synths:<br /> | A few recommended practices for synths:<br /> | ||
<br /> | <br /> | ||
One aim of the tuning RPN 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 data inc/dec message that changes the output note number should not trigger a new | One aim of the tuning RPN 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 data inc/dec message that changes the output note number should not trigger a new ADSR envelope. That should only happen in response to note-ons. The midi stream for pitch glides will be reduced to mostly data LSBs, with data MSBs whenever the MSB boundary is crossed, and data inc/dec whenever the note boundary is crossed.<br /> | ||
<br /> | <br /> | ||
A pitch bend range of 200¢ can generally be assumed. Ideally the synth should respond to RPN 0,0 = pitch bend sensitivity, for greater flexibility. Upon responding, the synth should update any manual range control it may have on its screen.<br /> | A pitch bend range of 200¢ can generally be assumed. Ideally the synth should respond to RPN 0,0 = pitch bend sensitivity, for greater flexibility. Upon responding, the synth should update any manual range control it may have on its screen.<br /> | ||