Feature Idea
Add the ability for custom notation events (those stored in reaper-notation.ini) to include metadata to be passed in the MIDI text event. The metadata isn't otherwise visible to the user.
Rationale
- Allows JSFX to perform some action based on the metadata which could be a numeric value for easier processing (easier than strings at least).
- By decoupling the user-visible text from a value that controls JSFX behavior, it means the text can be renamed without breaking the JSFX.
Proposal
Current custom notation entries in reaper-notation.ini look like:
Code:
CUSTOM harmonics "0xE114 harmonics"
The first parameter appears in the piano roll and the MIDI event. The second parameter controls how the notation editor presents the articulation in terms of icon and/or text.
The corresponding MIDI event looks like:
Code:
FF 0F <variable-length-quantity> NOTE 0 64 custom harmonics
Note 64 on MIDI channel 1 just being an example note in this case, which we'll use below too.
We could add an optional third parameter to this line which could be:
- A hex value (as a string prefixed with 0x which otherwise contains only hex digits) which is treated as a 32-bit integer and encoded in the MIDI event as 4 bytes with big endian byte order (standard MIDI)
- A string which is passed literally in the text event
When this parameter is specified, the text event will contain, appended after the notation text, a null (\x00), followed by the literal string 'META ' followed by the metadata value encoded either as a string or as a 4 byte value.
Below are some examples. For brevity, the MIDI outputs exclude the 'FF 0F <variable-length-quantity>" header of the meta event.
A line in reaper-notation.ini of:
Code:
CUSTOM harmonics "0xE114 harmonics" 0x0a
Would emit:
Code:
NOTE 0 64 custom harmonics 00 META 00 00 00 0A
# Python string to disambiguate
'NOTE 0 64 custom harmonics\x00META \x00\x00\x00\x0a'
A line in reaper-notation.ini of:
Code:
CUSTOM harmonics "0xE114 harmonics" foobar
Would emit:
Code:
NOTE 0 64 custom harmonics 00 META foobar
# Python string to disambiguate
'NOTE 0 64 custom harmonics\x00META foobar'
A line in reaper-notation.ini of:
Code:
CUSTOM harmonics "0xE114 harmonics" "foobar baz"
Would emit:
Code:
NOTE 0 64 custom harmonics 00 META foobar baz
# Python string to disambiguate
'NOTE 0 64 custom harmonics\x00METAfoobar baz'