summaryrefslogtreecommitdiff
path: root/opcodes/diskin.xml
blob: 420e6a340753626bc128ecbd63401aa349935631 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<refentry id="diskin">
<indexterm id="IndexDiskin"><primary>diskin</primary></indexterm>
  <refentryinfo><title>Signal I/O:Signal Input</title></refentryinfo>
  <refmeta>
    <refentrytitle>diskin</refentrytitle>
  </refmeta>

  <refnamediv>
    <refname>diskin</refname>
    <refpurpose>
      Deprecated. Reads audio data from an external device or stream and can alter its pitch.
    </refpurpose>
  </refnamediv>

  <refsect1>
    <title>Description</title>
    <para>
      Deprecated. Reads audio data from an external device or stream and can alter its pitch.
    </para>
  </refsect1>

  <refsect1>
    <title>Syntax</title>
    <synopsis>ar1 [, ar2 [, ar3 [, ... arN]]] <command>diskin</command> ifilcod, kpitch [, iskiptim] \
      [, iwraparound] [, iformat] [, iskipinit]</synopsis>
<para> Note the N was 24 in versions before 5.14, and 40 after.</para>

<synopsis>ar1[] <command>diskin2</command> ifilcod, kpitch[, iskiptim \
      [, iwrap[, iformat [, iwsize[, ibufsize[, iskipinit]]]]]]</synopsis>
<para> (in this version, the number of output channels is not limited.)</para>
  </refsect1>

  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>ifilcod</emphasis> -- integer or character-string denoting the source soundfile name. An integer denotes the file soundin.filcod ; a character-string (in double quotes, spaces permitted) gives the filename itself, optionally a full pathname. If not a full path, the named file is sought first in the current directory, then in that given by the environment variable <link linkend="CommandEnvironment"><citetitle>SSDIR</citetitle></link> (if defined) then by <link linkend="CommandEnvironment"><citetitle>SFDIR</citetitle></link>. See also <link linkend="GEN01"><citetitle>GEN01</citetitle></link>.
    </para>

    <para>
      <emphasis>iskptim</emphasis> (optional) -- time in seconds of input sound to be skipped. The default value is 0.
    </para>

    <para>
      <emphasis>iformat</emphasis> (optional) -- specifies the audio data file format:
      <itemizedlist>
        <listitem>
          <para>1 = 8-bit signed char (high-order 8 bits of a 16-bit integer)</para>
        </listitem>

        <listitem>
          <para>2 = 8-bit A-law bytes</para>
        </listitem>

        <listitem>
          <para>3 = 8-bit U-law bytes</para>
        </listitem>

        <listitem>
          <para>4 = 16-bit short integers</para>
        </listitem>

        <listitem>
          <para>5 = 32-bit long integers</para>
        </listitem>

        <listitem>
          <para>6 = 32-bit floats</para>
        </listitem>

        <listitem>
          <para>7 = 8-bit unsigned int (not available in Csound versions older than 5.00)</para>
        </listitem>

        <listitem>
          <para>8 = 24-bit int (not available in Csound versions older than 5.00)</para>
        </listitem>

        <listitem>
          <para>9 = 64-bit doubles (not available in Csound versions older than 5.00)</para>
        </listitem>
      </itemizedlist>
    </para>

    <para>
      <emphasis>iwraparound</emphasis> -- 1 = on, 0 = off (wraps
      around to end of file either direction, enabling looping)
    </para>

    <para>
     <emphasis>iskipinit</emphasis> switches off all initialisation if
     non zero (default =0).  This was introduced in 4_23f13 and
     csound5.
    </para>

    <para>
      If <emphasis>iformat</emphasis> = 0 it is taken from the soundfile header, and if no header from the Csound <link linkend="FlagsMinusLowerO"><citetitle>-o</citetitle></link> command-line flag. The default value is 0.
    </para>

  </refsect1>

  <refsect1>
    <title>Performance</title>
    	<para>
	<emphasis>a1 ... a24</emphasis>
	-- output signals, in the range -0dbfs to 0dbfs. Any samples
    before the beginning (i.e. negative location) and after the end of
    the file are assumed to be zero, unless <emphasis>iwrap</emphasis> is non-zero.
    The number of output arguments must be the same as the number of sound
    file channels - which can be determined with the
    <link linkend="filenchnls"><citetitle>filenchnls</citetitle></link> opcode,
    otherwise an init error will occur.
</para>

	<para>
	<emphasis>ar1[]</emphasis>
         --- output signals, in a-rate array of size N, where N is the number of
             channels in the file. Arrays are automatically allocated to the correct
             size.
	</para>
<para>
      <emphasis>kpitch</emphasis> -- can be any real number. A negative number signifies backwards playback. The given number is a pitch ratio, where:
      <itemizedlist>
        <listitem><para><emphasis>1</emphasis> = normal pitch</para></listitem>
        <listitem><para><emphasis>2</emphasis> = 1 octave higher</para></listitem>
        <listitem><para><emphasis>3</emphasis> = 12th higher, etc.</para></listitem>
        <listitem><para><emphasis>.5</emphasis> = 1 octave lower</para></listitem>
        <listitem><para><emphasis>.25</emphasis> = 2 octaves lower, etc.</para></listitem>
        <listitem><para><emphasis>-1</emphasis> = normal pitch backwards</para></listitem>
        <listitem><para><emphasis>-2</emphasis> = 1 octave higher backwards, etc.</para></listitem>
      </itemizedlist>
    </para>

  
    <caution>
      <title>Note to Windows users</title>
      <para>
        Windows users typically use back-slashes, <quote>\</quote>, when specifying the paths of their files. As an example, a Windows user might use the path <quote>c:\music\samples\loop001.wav</quote>. This is problematic because back-slashes are normally used to specify special characters.
      </para>

      <para>
        To correctly specify this path in Csound, one may alternately:
        <itemizedlist>
          <listitem><para><emphasis>Use forward slashes</emphasis>: c:/music/samples/loop001.wav</para></listitem>
          <listitem><para><emphasis>Use back-slash special characters, <quote>\\</quote></emphasis>: c:\\music\\samples\\loop001.wav</para></listitem>

        </itemizedlist>
      </para>
    </caution>
  </refsect1>

  <refsect1>
    <title>Examples</title>
    <para>
      Here is an example of the diskin opcode. It uses the file <ulink url="examples/diskin.csd"><citetitle>diskin.csd</citetitle></ulink>, <ulink url="examples/beats.wav"><citetitle>beats.wav</citetitle></ulink>.
      <example>
        <title>Example of the diskin opcode.</title>
        <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>
          <xi:include href="examples-xml/diskin.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
      </example>
    </para>
  </refsect1>

  <refsect1>
    <title>See Also</title>
    <para>
      <link linkend="in"><citetitle>in</citetitle></link>,
      <link linkend="inh"><citetitle>inh</citetitle></link>,
      <link linkend="ino"><citetitle>ino</citetitle></link>,
      <link linkend="inq"><citetitle>inq</citetitle></link>,
      <link linkend="ins"><citetitle>ins</citetitle></link>,
      <link linkend="soundin"><citetitle>soundin</citetitle></link> and 
      <link linkend="diskin2"><citetitle>diskin2</citetitle></link>
     </para>
  </refsect1>

  <refsect1>
    <title>Credits</title>
    <para>
      <simplelist>
        <member>Authors: &namebarry;, &namematt;/&namemike;</member>
        <member>MIT, Mills College</member>
        <member>1993-1997</member>
      </simplelist>
    </para>
    <para>New in version 3.46</para>

    <para>Warning to Windows users added by &namekevin;, April 2002</para>
  </refsect1>
</refentry>