| 1 | |
| 2 | <refentry id="massign"> |
| 3 | <indexterm id="IndexMassign"><primary>massign</primary></indexterm> |
| 4 | <refentryinfo><title>Real-time MIDI:Input</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>massign</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>massign</refname> |
| 13 | |
| 14 | <refpurpose> |
| 15 | Assigns a MIDI channel number to a Csound instrument. |
| 16 | </refpurpose> |
| 17 | </refnamediv> |
| 18 | |
| 19 | <refsect1> |
| 20 | <title>Description</title> |
| 21 | <para> |
| 22 | Assigns a MIDI channel number to a Csound instrument. |
| 23 | </para> |
| 24 | </refsect1> |
| 25 | |
| 26 | <refsect1> |
| 27 | <title>Syntax</title> |
| 28 | <synopsis><command>massign</command> ichnl, insnum[, ireset]</synopsis> |
| 29 | <synopsis><command>massign</command> ichnl, "insname"[, ireset]</synopsis> |
| 30 | </refsect1> |
| 31 | |
| 32 | <refsect1> |
| 33 | <title>Initialization</title> |
| 34 | <para> |
| 35 | <emphasis>ichnl</emphasis> -- MIDI channel number (1-16). |
| 36 | </para> |
| 37 | |
| 38 | <para> |
| 39 | <emphasis>insnum</emphasis> -- Csound orchestra instrument number. |
| 40 | 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 <link linkend="midiin"><citetitle>midiin</citetitle></link>). |
| 41 | </para> |
| 42 | |
| 43 | <para> |
| 44 | <emphasis><quote>insname</quote></emphasis> -- A string (in double-quotes) representing a named instrument. |
| 45 | </para> |
| 46 | <para> |
| 47 | <emphasis>ireset</emphasis> -- If non-zero resets the |
| 48 | controllers; default is to reset. |
| 49 | </para> |
| 50 | |
| 51 | </refsect1> |
| 52 | |
| 53 | <refsect1> |
| 54 | <title>Performance</title> |
| 55 | <para> |
| 56 | 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 <link linkend="midiin"><citetitle>midiin</citetitle></link> to interpret midi information). In this case set <emphasis>insnum</emphasis> to 0 or a negative number. |
| 57 | </para> |
| 58 | <para> |
| 59 | If <emphasis>ichan</emphasis> is set to 0, the value of <emphasis>insnum</emphasis> 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: |
| 60 | </para> |
| 61 | <programlisting>massign 0,0</programlisting> |
| 62 | <para> |
| 63 | This can be useful if you are doing all MIDI evaluation within Csound with an always on instrument(e.g. using <link linkend="midiin"><citetitle>midiin</citetitle></link> and <link linkend="turnon"><citetitle>turnon</citetitle></link>) to avoid doubling the instrument when a note is played. |
| 64 | </para> |
| 65 | </refsect1> |
| 66 | |
| 67 | <refsect1> |
| 68 | <title>Examples</title> |
| 69 | <para> |
| 70 | Here is an example of the massign opcode. It uses the file <ulink url="examples/massign.csd"><citetitle>massign.csd</citetitle></ulink>. |
| 71 | <example> |
| 72 | <title>Example of the massign opcode.</title> |
| 73 | <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para> |
| 74 | <xi:include href="examples-xml/massign.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 75 | </example> |
| 76 | </para> |
| 77 | </refsect1> |
| 78 | |
| 79 | <refsect1> |
| 80 | <title>See also</title> |
| 81 | <para><link linkend="MidiInput"><citetitle>MIDI input and Initialization</citetitle></link></para> |
| 82 | <para><link linkend="OrchHeader"><citetitle>Orchestra Header Statements</citetitle></link></para> |
| 83 | </refsect1> |
| 84 | |
| 85 | <refsect1> |
| 86 | <title>Credits</title> |
| 87 | <para> |
| 88 | <simplelist> |
| 89 | <member>Author: &namebarry; - &namemike;</member> |
| 90 | <member>MIT, Cambridge, Mass.</member> |
| 91 | </simplelist> |
| 92 | </para> |
| 93 | |
| 94 | <para>New in Csound version 3.47</para> |
| 95 | <para><emphasis>ireset</emphasis> parameter new in Csound5</para> |
| 96 | <para>Thanks goes to &namerasmus; for pointing out the correct MIDI channel range.</para> |
| 97 | </refsect1> |
| 98 | </refentry> |