Following the discussion on VVIDs, I've been thinking about how the
MIDI protocol could be modified to encompass explicit contexts. To my
surprise, this would quite simple. I'll call the new protocol ECMP
(Explicit Context Midi Protocol -- just a working name). Key features
are:
1. Easy conversion MIDI <--> ECMP.
To convert a MIDI stream to ECMP, just insert a zero byte as the second
byte of each voice message (or as the first byte if running status is
used). To convert ECMP to MIDI, just skip the inserted bytes which are
easy to find, and what remains is standard MIDI. So porting existing
instruments to use ECMP but ignore the extensions is almost trivial.
2. Allows to have a 'set of mono synths' (up to 127 at a time) on a
single channel.
3. Caters for the needs of continuous control synths (I think).
These are the standard MIDI voice messages, with the new byte
inserted:
0x80+c z k v note off
0x90+c z k v note on
0xA0+c z k p aftertouch
0xB0+c z n x controller
0xC0+c z a program change
0xD0+c z p channel pressure
0xE0+c z b c pitch wheel
c = channel number
z = inserted context number
k = key (pitch)
p = pressure
v = velocity
x = controller value
a = program number
b, c = pitch wheel value
If the context number is 0, this means standard MIDI behaviour, all
contexts numbered zero are independent of each other.
A 'note on' with a non-zero context number creates the context if it
does not already exist. If it does already exist, the new note is
started in the existing context. What that means is defined by the
patch.
Each such context is either in the 'on' or 'off' state, depending on
which one of 'note on' or 'note off' was most recently received.
When a context is 'off' and it reaches an internal state where
its further existence does no longer matter (e.g. all envelopes are at
the end of their release phase), it is destroyed. If a context never
reaches such a point, it can be explicitly destroyed by 'note off'
received in the 'off' state.
Control messages (including aftertouch, pitch wheel, etc.) are ignored
if they refer to a non-existing context.
For the 'channel pressure' message, z = 0 means 'channel pressure',
which means all contexts, and z > 0 refers to a specific context.
'Channel program' with z = 0 has its normal meaning. If z > 0, it
could be used to associate a context number with a specific patch
variation or static parameter set. For example, a patch that contains
a simulation of four different violin strings could use this message
to associate a context number with a particular string.
If z > 0 in the 'aftertouch' message, then the key (pitch) parameter
is effectively redundant. I propose to keep it anyway, as this allows
conversion to standard MIDI (and you may get 'almost' what you want).
For continuous control instruments, a context or voice is created
by a 'note-on' message. The interpretation of the key and velocity
params is up to the patch, but normally no sound should be produced
at this point. The context will continue to exist until the end of the
performance, when it is removed by a double 'note off'.
Comments invited !!
--
Fons Adriaensen