| 1 | |
| 2 | <refentry id="midichn"> |
| 3 | <indexterm id="IndexMidichn"><primary>midichn</primary></indexterm> |
| 4 | <refentryinfo><title>Real-time MIDI:MIDI/Score Interoperability</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>midichn</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>midichn</refname> |
| 13 | <refpurpose> |
| 14 | Returns the MIDI channel number from which the note was activated. |
| 15 | </refpurpose> |
| 16 | </refnamediv> |
| 17 | |
| 18 | <refsect1> |
| 19 | <title>Description</title> |
| 20 | <para> |
| 21 | <emphasis>midichn</emphasis> returns the MIDI channel number (1 - 16) from which the note was activated. In the case of score notes, it returns 0. |
| 22 | </para> |
| 23 | </refsect1> |
| 24 | |
| 25 | <refsect1> |
| 26 | <title>Syntax</title> |
| 27 | <synopsis>ichn <command>midichn</command></synopsis> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Initialization</title> |
| 32 | <para> |
| 33 | <emphasis>ichn</emphasis> -- channel number. If the current note was activated from score, it is set to zero. |
| 34 | </para> |
| 35 | </refsect1> |
| 36 | |
| 37 | <refsect1> |
| 38 | <title>Examples</title> |
| 39 | <para> |
| 40 | Here is a simple example of the midichn opcode. It uses the file <ulink url="examples/midichn.csd"><citetitle>midichn.csd</citetitle></ulink>. |
| 41 | |
| 42 | <example> |
| 43 | <title>Example of the midichn opcode.</title> |
| 44 | |
| 45 | |
| 46 | |
| 47 | <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> |
| 48 | <xi:include href="examples-xml/midichn.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 49 | </example> |
| 50 | </para> |
| 51 | |
| 52 | <para> |
| 53 | Here is an advanced example of the midichn opcode. It uses the file <ulink url="examples/midichn_advanced.csd"><citetitle>midichn_advanced.csd</citetitle></ulink>. |
| 54 | </para> |
| 55 | |
| 56 | <para> |
| 57 | Do not forget that you must include the <link linkend="FlagsMinusUpperF"><citetitle>-F flag</citetitle></link> when using an external MIDI file like <quote>midichn_advanced.mid</quote>. |
| 58 | </para> |
| 59 | |
| 60 | <para> |
| 61 | <example> |
| 62 | <title>An advanced example of the midichn opcode.</title> |
| 63 | |
| 64 | <xi:include href="examples-xml/midichn_advanced.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 65 | </example> |
| 66 | |
| 67 | Its output should include lines like: |
| 68 | <screen> |
| 69 | note 1 (time = 0.00) was activated from channel 1 |
| 70 | note 2 (time = 2.00) was activated from channel 4 |
| 71 | note 3 (time = 3.00) was activated from channel 2 |
| 72 | note 4 (time = 5.00) was activated from channel 3 |
| 73 | </screen> |
| 74 | </para> |
| 75 | </refsect1> |
| 76 | |
| 77 | <refsect1> |
| 78 | <title>See also</title> |
| 79 | <para><link linkend="MidiInput"><citetitle>MIDI input and Initialization</citetitle></link></para> |
| 80 | <para><link linkend="MidiInterop"><citetitle>MIDI/Score Interoperability</citetitle></link></para> |
| 81 | </refsect1> |
| 82 | |
| 83 | <refsect1> |
| 84 | <title>Credits</title> |
| 85 | <para> |
| 86 | <simplelist> |
| 87 | <member>Author: &nameistvan;</member> |
| 88 | <member>May 2002</member> |
| 89 | </simplelist> |
| 90 | </para> |
| 91 | <para>New in version 4.20</para> |
| 92 | </refsect1> |
| 93 | </refentry> |