Debian Codegraph @

opcodes/midinoteonoct.xml

raw symbols SCIP
1
2 <refentry id="midinoteonoct">
3 <indexterm id="IndexMidinoteonoct"><primary>midinoteonoct</primary></indexterm>
4 <refentryinfo><title>Real-time MIDI:MIDI/Score Interoperability</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>midinoteonoct</refentrytitle>
7 </refmeta>
8
9
10
11 <refnamediv>
12 <refname>midinoteonoct</refname>
13 <refpurpose>
14 Gets a MIDI note number value as octave-point-decimal value.
15 </refpurpose>
16 </refnamediv>
17
18 <refsect1>
19 <title>Description</title>
20 <para>
21 <emphasis>midinoteonoct</emphasis> is designed to simplify writing instruments that can be used interchangeably for either score or MIDI input, and to make it easier to adapt instruments originally written for score input to work with MIDI input.
22 </para>
23
24 <para>
25 In general, it should be possible to write instrument definitions that work identically with both scores
26 and MIDI, including both MIDI files and real-time MIDI input, without using any conditional statements, and that take full advantage of MIDI voice messages.
27 </para>
28
29 <para>
30 Note that correlating Csound instruments with MIDI channel numbers is done using the <link linkend="massign"><citetitle>massign</citetitle></link> opcode for real-time performance,. For file-driven performance, instrument numbers default to MIDI channel number + 1, but the defaults are overridden by any MIDI program change messages in the file.
31 </para>
32 </refsect1>
33
34 <refsect1>
35 <title>Syntax</title>
36 <synopsis><command>midinoteonoct</command> xoct, xvelocity</synopsis>
37 </refsect1>
38
39 <refsect1>
40 <title>Performance</title>
41 <para>
42 <emphasis>xoct</emphasis> -- returns MIDI key translated to linear octaves during MIDI activation, remains unchanged otherwise.
43 </para>
44
45 <para>
46 <emphasis>xvelocity</emphasis> -- returns MIDI velocity during MIDI activation, remains unchanged otherwise.
47 </para>
48
49 <para>
50 If the instrument was activated by MIDI input, the opcode overwrites the values of <emphasis>xoct</emphasis> and <emphasis>xvelocity</emphasis> with the corresponding value from MIDI input. If the instrument was <emphasis>NOT</emphasis> activated by MIDI input, the values of <emphasis>xoct</emphasis> and <emphasis>xvelocity</emphasis> remain unchanged.
51 </para>
52
53 <para>
54 This enables score p-fields to receive MIDI input data during MIDI activation, and score values otherwise.
55 </para>
56
57 <note>
58 <title>Adapting a score-activated Csound instrument.</title>
59 <para>See the <link linkend="MidiInterop"><citetitle>MIDI interop opcodes</citetitle></link> section for details on adapting score driven instruments for MIDI or vice-versa.</para>
60 </note>
61 </refsect1>
62
63 <refsect1>
64 <title>Examples</title>
65 <para>
66 Here is an example of the midinoteonoct opcode. It uses the file <ulink url="examples/midinoteonoct.csd"><citetitle>midinoteonoct.csd</citetitle></ulink>.
67 <example>
68 <title>Example of the midinoteonoct opcode.</title>
69 <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>
70 <xi:include href="examples-xml/midinoteonoct.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
71 </example>
72 Its output should include lines like:
73 <screen>
74 i1 8.00000
75 i1 8.91700
76 i1 9.33333
77 </screen>
78 </para>
79 </refsect1>
80
81 <refsect1>
82 <title>See also</title>
83 <para><link linkend="MidiInterop"><citetitle>MIDI/Score Interoperability</citetitle></link></para>
84 </refsect1>
85
86 <refsect1>
87 <title>Credits</title>
88 <para>Author: Michael Gogins</para>
89 <para>New in version 4.20</para>
90 </refsect1>
91 </refentry>