| 1 | |
| 2 | <refentry id="ctrl7"> |
| 3 | <indexterm id="IndexCtrl7"><primary>ctrl7</primary></indexterm> |
| 4 | <refentryinfo><title>Real-time MIDI:Input</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>ctrl7</refentrytitle> |
| 7 | </refmeta> |
| 8 | <refnamediv> |
| 9 | <refname>ctrl7</refname> |
| 10 | |
| 11 | <refpurpose> |
| 12 | Allows a floating-point 7-bit MIDI signal scaled with a minimum and a maximum range. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | Allows a floating-point 7-bit MIDI signal scaled with a minimum and a maximum range. |
| 20 | </para> |
| 21 | </refsect1> |
| 22 | |
| 23 | <refsect1> |
| 24 | <title>Syntax</title> |
| 25 | <synopsis>idest <command>ctrl7</command> ichan, ictlno, imin, imax [, ifn]</synopsis> |
| 26 | <synopsis>kdest <command>ctrl7</command> ichan, ictlno, kmin, kmax [, ifn]</synopsis> |
| 27 | <synopsis>adest <command>ctrl7</command> ichan, ictlno, kmin, kmax [, ifn] [, icutoff]</synopsis> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Initialization</title> |
| 32 | <para> |
| 33 | <emphasis>idest</emphasis> -- output signal |
| 34 | </para> |
| 35 | |
| 36 | <para> |
| 37 | <emphasis>ichan</emphasis> -- MIDI channel (1-16) |
| 38 | </para> |
| 39 | |
| 40 | <para> |
| 41 | <emphasis>ictlno</emphasis> -- MIDI controller number (0-127) |
| 42 | </para> |
| 43 | |
| 44 | <para> |
| 45 | <emphasis>imin</emphasis> -- user-defined minimum floating-point value of output |
| 46 | </para> |
| 47 | |
| 48 | <para> |
| 49 | <emphasis>imax</emphasis> -- user-defined maximum floating-point value of output |
| 50 | </para> |
| 51 | |
| 52 | <para> |
| 53 | <emphasis>ifn</emphasis> (optional) -- table to be read when indexing is required. Table must be normalized. Output is scaled according to <emphasis>imax</emphasis> and <emphasis>imin</emphasis> val. |
| 54 | </para> |
| 55 | |
| 56 | <para> |
| 57 | <emphasis>icutoff</emphasis> (optional) -- low pass filter cut-off frequency for smoothing a-rate output. |
| 58 | </para> |
| 59 | </refsect1> |
| 60 | |
| 61 | <refsect1> |
| 62 | <title>Performance</title> |
| 63 | <para> |
| 64 | <emphasis>kdest, adest</emphasis> -- output signal |
| 65 | </para> |
| 66 | |
| 67 | <para> |
| 68 | <emphasis>kmin</emphasis> -- user-defined minimum floating-point value of output |
| 69 | </para> |
| 70 | |
| 71 | <para> |
| 72 | <emphasis>kmax</emphasis> -- user-defined maximum floating-point value of output |
| 73 | </para> |
| 74 | |
| 75 | <para> |
| 76 | <emphasis>ctrl7</emphasis> (i- and k-rate 7 bit MIDI control) allows a floating-point 7-bit MIDI signal scaled with a minimum and a maximum range. It also allows optional non-interpolated table indexing. Minimum and maximum values can be varied at k-rate. |
| 77 | </para> |
| 78 | |
| 79 | <para> |
| 80 | <emphasis>ctrl7</emphasis> differs from <link linkend="midic7"><citetitle>midic7</citetitle></link> because it can be included in score-oriented instruments without Csound crashes. It also needs the additional parameter <emphasis>ichan</emphasis> containing the MIDI channel of the controller. |
| 81 | </para> |
| 82 | <para> |
| 83 | The a-rate version of <emphasis>ctrl7</emphasis> outputs an a-rate variable, which is low-pass filtered (smoothed). It contains an optional <emphasis>icutoff</emphasis> parameter, to set the cutoff frecuency for the low-pass filter. The default is 5. |
| 84 | </para> |
| 85 | </refsect1> |
| 86 | |
| 87 | <refsect1> |
| 88 | <title>Examples</title> |
| 89 | <para> |
| 90 | Here is an example of the ctrl7 opcode. It uses the file <ulink url="examples/ctrl7.csd"><citetitle>ctrl7.csd</citetitle></ulink>. |
| 91 | |
| 92 | <example> |
| 93 | <title>Example of the ctrl7 opcode.</title> |
| 94 | <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> |
| 95 | <xi:include href="examples-xml/ctrl7.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 96 | </example> |
| 97 | </para> |
| 98 | </refsect1> |
| 99 | |
| 100 | <note> |
| 101 | ctrl7 only outputs k values once the controller is first moved. To |
| 102 | set an initial k-value, a call to initc7 is required. Ctrlinit does not work |
| 103 | for this purpose. |
| 104 | </note> |
| 105 | |
| 106 | <refsect1> |
| 107 | <title>See also</title> |
| 108 | <para><link linkend="MidiInput"><citetitle>MIDI input and Initialization</citetitle></link></para> |
| 109 | </refsect1> |
| 110 | |
| 111 | <refsect1> |
| 112 | <title>Credits</title> |
| 113 | <para> |
| 114 | <simplelist> |
| 115 | <member>Author: &namegabriel;</member> |
| 116 | <member>Italy</member> |
| 117 | </simplelist> |
| 118 | </para> |
| 119 | |
| 120 | <para>New in Csound version 3.47</para> |
| 121 | <para>Thanks goes to &namerasmus; for pointing out the correct MIDI channel and controller number ranges. |
| 122 | </para> |
| 123 | <para>The a-rate version of <emphasis>ctrl7</emphasis> was added in version 5.06</para> |
| 124 | </refsect1> |
| 125 | </refentry> |