summaryrefslogtreecommitdiff
path: root/opcodes/mididefault.xml
blob: 1787cbbf096cc46c7687cfe03a65d7f6fc23e073 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<refentry id="mididefault">
<indexterm id="IndexMididefault"><primary>mididefault</primary></indexterm>
  <refentryinfo><title>Real-time MIDI:MIDI/Score Interoperability</title></refentryinfo>
  <refmeta>
    <refentrytitle>mididefault</refentrytitle>
  </refmeta>



  <refnamediv>
    <refname>mididefault</refname>
    <refpurpose>
      Changes values, depending on MIDI activation.
          </refpurpose>
  </refnamediv>
  
  <refsect1>
    <title>Description</title>
    <para>
      <emphasis>mididefault</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.
    </para>

    <para>
      In general, it should be possible to write instrument definitions that work identically with both scores
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.
    </para>

    <para>
      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.
    </para>
  </refsect1>

  <refsect1>
    <title>Syntax</title>
    <synopsis><command>mididefault</command> xdefault, xvalue</synopsis>
  </refsect1>

  <refsect1>
    <title>Performance</title>
    <para>
      <emphasis>xdefault</emphasis> -- specifies a default value that will be used during MIDI activation.
    </para>

    <para>
      <emphasis>xvalue</emphasis> -- overwritten by <emphasis>xdefault</emphasis> during MIDI activation, remains unchanged otherwise.
    </para>

    <para>
      If the instrument was activated by MIDI input, the opcode will overwrite the value of <emphasis>xvalue</emphasis> with the value of <emphasis>xdefault</emphasis>. If the instrument was <emphasis>NOT</emphasis> activated by MIDI input, <emphasis>xvalue</emphasis> will remain unchanged.
    </para>

    <para>
      This enables score pfields to receive a default value during MIDI activation, and score values otherwise.
    </para>

    <note>
      <title>Adapting a score-activated Csound instrument.</title>
      <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>
    </note>
  </refsect1>

  <refsect1>
    <title>See Also</title>
    <para>
      <link linkend="midichannelaftertouch"><citetitle>midichannelaftertouch</citetitle></link>, 
      <link linkend="midicontrolchange"><citetitle>midicontrolchange</citetitle></link>, 
      <link linkend="midinoteoff"><citetitle>midinoteoff</citetitle></link>, 
      <link linkend="midinoteoncps"><citetitle>midinoteoncps</citetitle></link>, 
      <link linkend="midinoteonkey"><citetitle>midinoteonkey</citetitle></link>, 
      <link linkend="midinoteonoct"><citetitle>midinoteonoct</citetitle></link>, 
      <link linkend="midinoteonpch"><citetitle>midinoteonpch</citetitle></link>, 
      <link linkend="midipitchbend"><citetitle>midipitchbend</citetitle></link>, 
      <link linkend="midipolyaftertouch"><citetitle>midipolyaftertouch</citetitle></link>, 
      <link linkend="midiprogramchange"><citetitle>midiprogramchange</citetitle></link>
    </para>
  </refsect1>

  <refsect1>
    <title>Credits</title>
    <para>Author: Michael Gogins</para>
    <para>New in version 4.20</para>
  </refsect1>
</refentry>