| 1 | |
| 2 | <refentry id="outkpc"> |
| 3 | <indexterm id="IndexOutkpc"><primary>outkpc</primary></indexterm> |
| 4 | <refentryinfo><title>Real-time MIDI:Output</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>outkpc</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>outkpc</refname> |
| 13 | |
| 14 | <refpurpose> |
| 15 | Sends MIDI program change messages at k-rate. |
| 16 | </refpurpose> |
| 17 | </refnamediv> |
| 18 | |
| 19 | <refsect1> |
| 20 | <title>Description</title> |
| 21 | <para> |
| 22 | Sends MIDI program change messages at k-rate. |
| 23 | </para> |
| 24 | </refsect1> |
| 25 | |
| 26 | <refsect1> |
| 27 | <title>Syntax</title> |
| 28 | <synopsis><command>outkpc</command> kchn, kprog, kmin, kmax</synopsis> |
| 29 | </refsect1> |
| 30 | |
| 31 | <refsect1> |
| 32 | <title>Performance</title> |
| 33 | <para> |
| 34 | <emphasis>kchn</emphasis> -- MIDI channel number (1-16) |
| 35 | </para> |
| 36 | |
| 37 | <para> |
| 38 | <emphasis>kprog</emphasis> -- program change number in floating point |
| 39 | </para> |
| 40 | |
| 41 | <para> |
| 42 | <emphasis>kmin</emphasis> -- minimum floating point value (converted in MIDI integer value 0) |
| 43 | </para> |
| 44 | |
| 45 | <para> |
| 46 | <emphasis>kmax</emphasis> -- maximum floating point value (converted in MIDI integer value 127 (7 bit)) |
| 47 | </para> |
| 48 | |
| 49 | <para> |
| 50 | <emphasis>outkpc</emphasis> (k-rate program change output) sends program change messages. It works only with MIDI instruments which recognize them. These opcodes can drive a different value of a parameter for each note currently active. |
| 51 | </para> |
| 52 | |
| 53 | <para> |
| 54 | It can scale the k-value floating-point argument according to the <emphasis>kmin</emphasis> and <emphasis>kmax</emphasis> values. For example: set <emphasis>kmin</emphasis> = 1.0 and <emphasis>kmax</emphasis> = 2.0. |
| 55 | When the <emphasis>kvalue</emphasis> argument receives a 2.0 value, the opcode will send a 127 value to the MIDI OUT device. When the <emphasis>kvalue</emphasis> argument receives a 1.0 value, it will send a 0 value. k-rate opcodes send a message each time the MIDI converted value of argument <emphasis>kvalue</emphasis> changes. |
| 56 | </para> |
| 57 | </refsect1> |
| 58 | |
| 59 | <refsect1> |
| 60 | <title>Examples</title> |
| 61 | <para> |
| 62 | Here is an example of the outkpc opcode. It uses the file <ulink url="examples/outkpc.csd"><citetitle>outkpc.csd</citetitle></ulink>. |
| 63 | |
| 64 | <example> |
| 65 | <title>Example of the outkpc opcode.</title> |
| 66 | <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> |
| 67 | <para>This example generates a program change and a note on Csound's MIDI output port whenever a note is received on channel 1. Be sure to have something connected to Csound's MIDI out port to hear the result.</para> |
| 68 | <xi:include href="examples-xml/outkpc.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 69 | </example> |
| 70 | Here is another example of the outkpc opcode. It uses the file <ulink url="examples/outkpc_fltk.csd"><citetitle>outkpc_flkt.csd</citetitle></ulink>. |
| 71 | |
| 72 | <example> |
| 73 | <title>Example of the outkpc opcode using FLTK.</title> |
| 74 | <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> |
| 75 | <xi:include href="examples-xml/outkpc_fltk.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 76 | </example> |
| 77 | </para> |
| 78 | </refsect1> |
| 79 | |
| 80 | <refsect1> |
| 81 | <title>See also</title> |
| 82 | <para><link linkend="MidiOutput"><citetitle>MIDI Message 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 | </simplelist> |
| 92 | </para> |
| 93 | |
| 94 | <para>New in Csound version 3.47</para> |
| 95 | <para>Thanks goes to &namerasmus; for pointing out the correct MIDI channel and controller number ranges.</para> |
| 96 | </refsect1> |
| 97 | </refentry> |