| 1 | |
| 2 | <refentry id="midiin"> |
| 3 | <indexterm id="IndexMidiin"><primary>midiin</primary></indexterm> |
| 4 | <refentryinfo><title>Real-time MIDI:Generic I/O</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>midiin</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>midiin</refname> |
| 13 | |
| 14 | <refpurpose> |
| 15 | Returns a generic MIDI message received by the MIDI IN port. |
| 16 | </refpurpose> |
| 17 | </refnamediv> |
| 18 | |
| 19 | <refsect1> |
| 20 | <title>Description</title> |
| 21 | <para> |
| 22 | Returns a generic MIDI message received by the MIDI IN port |
| 23 | </para> |
| 24 | </refsect1> |
| 25 | |
| 26 | <refsect1> |
| 27 | <title>Syntax</title> |
| 28 | <synopsis>kstatus, kchan, kdata1, kdata2 <command>midiin</command></synopsis> |
| 29 | </refsect1> |
| 30 | |
| 31 | <refsect1> |
| 32 | <title>Performance</title> |
| 33 | <para> |
| 34 | <emphasis>kstatus</emphasis> -- the type of MIDI message. Can be: |
| 35 | <itemizedlist> |
| 36 | <listitem><para>128 (note off)</para></listitem> |
| 37 | <listitem><para>144 (note on)</para></listitem> |
| 38 | <listitem><para>160 (polyphonic aftertouch)</para></listitem> |
| 39 | <listitem><para>176 (control change)</para></listitem> |
| 40 | <listitem><para>192 (program change)</para></listitem> |
| 41 | <listitem><para>208 (channel aftertouch)</para></listitem> |
| 42 | <listitem><para>224 (pitch bend</para></listitem> |
| 43 | <listitem><para>0 if no MIDI message are pending in the MIDI IN buffer</para></listitem> |
| 44 | </itemizedlist> |
| 45 | </para> |
| 46 | |
| 47 | <para> |
| 48 | <emphasis>kchan</emphasis> -- MIDI channel (1-16) |
| 49 | </para> |
| 50 | |
| 51 | <para> |
| 52 | <emphasis>kdata1, kdata2</emphasis> -- message-dependent data values |
| 53 | </para> |
| 54 | |
| 55 | <para> |
| 56 | <emphasis>midiin</emphasis> has no input arguments, because it reads at the MIDI in port implicitly. It works at k-rate. Normally (i.e., when no messages are pending) <emphasis>kstatus</emphasis> is zero, only when MIDI data are present in the MIDI IN buffer, is <emphasis>kstatus</emphasis> set to the type of the relevant messages. |
| 57 | </para> |
| 58 | <note> |
| 59 | <para> |
| 60 | Be careful when using <emphasis>midiin</emphasis> in low numbered instruments, since a MIDI note will launch additional instances of the instrument, resulting in duplicate events and weird behaviour. Use <link linkend="massign"><citetitle>massign</citetitle></link> to direct MIDI note on messages to a different instrument or to disable triggering of instruments from MIDI. |
| 61 | </para> |
| 62 | </note> |
| 63 | </refsect1> |
| 64 | |
| 65 | <refsect1> |
| 66 | <title>Examples</title> |
| 67 | <para> |
| 68 | Here is an example of the midiin opcode. It uses the file <ulink url="examples/midiin.csd"><citetitle>midiin.csd</citetitle></ulink>. |
| 69 | |
| 70 | <example> |
| 71 | <title>Example of the midiin opcode.</title> |
| 72 | |
| 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/midiin.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="MidiGeneric"><citetitle>Generic Input and Output</citetitle></link></para> |
| 83 | </refsect1> |
| 84 | |
| 85 | <refsect1> |
| 86 | <title>Credits</title> |
| 87 | <para> |
| 88 | <simplelist> |
| 89 | <member>Author: &namegabriel;</member> |
| 90 | <member>Italy</member> |
| 91 | <member>1998</member> |
| 92 | </simplelist> |
| 93 | </para> |
| 94 | |
| 95 | <para>New in Csound version 3.492</para> |
| 96 | </refsect1> |
| 97 | </refentry> |