massignReal-time MIDI:Inputmassignmassign
Assigns a MIDI channel number to a Csound instrument.
Description
Assigns a MIDI channel number to a Csound instrument.
Syntaxmassign ichnl, insnum[, ireset]massign ichnl, "insname"[, ireset]Initializationichnl -- MIDI channel number (1-16).
insnum -- Csound orchestra instrument number.
If zero or negative, the channel is muted (i.e. it does not trigger a csound instrument, though information will still be received by opcodes like midiin).
insname -- A string (in double-quotes) representing a named instrument.
ireset -- If non-zero resets the
controllers; default is to reset.
Performance
Assigns a MIDI channel number to a Csound instrument. Also useful to make sure a certain instrument (if its number is from 1 to 16) will not be triggered by midi noteon messages (if using something midiin to interpret midi information). In this case set insnum to 0 or a negative number.
If ichan is set to 0, the value of insnum is used for all channels. This way you can route all MIDI channels to a single Csound instrument. You can also disable triggering of instruments from MIDI note events from all channels with the following line:
massign 0,0
This can be useful if you are doing all MIDI evaluation within Csound with an always on instrument(e.g. using midiin and turnon) to avoid doubling the instrument when a note is played.
Examples
Here is an example of the massign opcode. It uses the file massign.csd.
Example of the massign opcode.See the sections Real-time Audio and Command Line Flags for more information on using command line flags.See alsoMIDI input and InitializationOrchestra Header StatementsCreditsAuthor: &namebarry; - &namemike;MIT, Cambridge, Mass.New in Csound version 3.47ireset parameter new in Csound5Thanks goes to &namerasmus; for pointing out the correct MIDI channel range.