Debian Codegraph @

opcodes/soundin.xml

raw symbols SCIP
1
2 <refentry id="soundin">
3 <indexterm id="IndexSoundin"><primary>soundin</primary></indexterm>
4 <refentryinfo><title>Signal I/O:Signal Input</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>soundin</refentrytitle>
7 </refmeta>
8
9
10
11 <refnamediv>
12 <refname>soundin</refname>
13 <refpurpose>
14 Reads audio data from an external device or stream.
15 </refpurpose>
16 </refnamediv>
17
18 <refsect1>
19 <title>Description</title>
20 <para>
21 Reads audio data from an external device or stream. Up to 24
22 channels may be read before v5.14, extended to 40 in later versions.
23 </para>
24 </refsect1>
25
26 <refsect1>
27 <title>Syntax</title>
28 <synopsis>ar1[, ar2[, ar3[, ... a24]]] <command>soundin</command> ifilcod [, iskptim] [, iformat] \
29 [, iskipinit] [, ibufsize]</synopsis>
30 </refsect1>
31
32 <refsect1>
33 <title>Initialization</title>
34 <para>
35 <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>.
36 </para>
37
38 <para>
39 <emphasis>iskptim</emphasis> (optional, default=0) -- time in seconds of input sound to be skipped. The default value is 0. In csound 5.00 and later, this may be negative to add a delay instead of skipping time.
40 </para>
41
42 <para>
43 <emphasis>iformat</emphasis> (optional, default=0) -- specifies the audio data file format:
44 <itemizedlist>
45 <listitem>
46 <para>1 = 8-bit signed char (high-order 8 bits of a 16-bit integer)</para>
47 </listitem>
48
49 <listitem>
50 <para>2 = 8-bit A-law bytes</para>
51 </listitem>
52
53 <listitem>
54 <para>3 = 8-bit U-law bytes</para>
55 </listitem>
56
57 <listitem>
58 <para>4 = 16-bit short integers</para>
59 </listitem>
60
61 <listitem>
62 <para>5 = 32-bit long integers</para>
63 </listitem>
64
65 <listitem>
66 <para>6 = 32-bit floats</para>
67 </listitem>
68
69 <listitem>
70 <para>7 = 8-bit unsigned int (not available in Csound versions older than 5.00)</para>
71 </listitem>
72
73 <listitem>
74 <para>8 = 24-bit int (not available in Csound versions older than 5.00)</para>
75 </listitem>
76
77 <listitem>
78 <para>9 = 64-bit doubles (not available in Csound versions older than 5.00)</para>
79 </listitem>
80 </itemizedlist>
81 </para>
82
83 <para>
84 <emphasis>iskipinit</emphasis> -- switches off all initialisation if
85 non zero (default=0). This was introduced in 4_23f13 and
86 csound5.
87 </para>
88
89 <para>
90 <emphasis>ibufsize</emphasis> -- buffer size in mono samples (not sample frames). Not available in Csound versions older than 5.00. The default buffer size is 2048.
91 </para>
92
93 <para>
94 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.
95 </para>
96 </refsect1>
97
98 <refsect1>
99 <title>Performance</title>
100 <para>
101 <emphasis>soundin</emphasis> is functionally an audio generator that derives its signal from a pre-existing file. The number of channels read in is controlled by the number of result cells, a1, a2, etc., which must match that of the input file. A <emphasis>soundin</emphasis> opcode opens this file whenever the host instrument is initialized, then closes it again each time the instrument is turned off.
102 </para>
103
104 <para>
105 There can be any number of <emphasis>soundin</emphasis> opcodes within a single instrument or orchestra. Two or more of them can read simultaneously from the same external file.
106 </para>
107
108 <caution>
109 <title>Note to Windows users</title>
110 <para>
111 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.
112 </para>
113
114 <para>
115 To correctly specify this path in Csound, one may alternately:
116 <itemizedlist>
117 <listitem><para><emphasis>Use forward slashes</emphasis>: c:/music/samples/loop001.wav</para></listitem>
118 <listitem><para><emphasis>Use back-slash special characters, <quote>\\</quote></emphasis>: c:\\music\\samples\\loop001.wav</para></listitem>
119
120 </itemizedlist>
121 </para>
122 </caution>
123 </refsect1>
124
125 <refsect1>
126 <title>Examples</title>
127 <para>
128 Here is an example of the soundin opcode. It uses the file <ulink url="examples/soundin.csd"><citetitle>soundin.csd</citetitle></ulink>,
129 <ulink url="examples/fox.wav"><citetitle>fox.wav</citetitle></ulink> and <ulink url="examples/drumsSlp.wav"><citetitle>drumsSlp.wav</citetitle></ulink>.
130 <example>
131 <title>Example of the soundin opcode.</title>
132 <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>
133 <xi:include href="examples-xml/soundin.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
134 </example>
135 </para>
136 </refsect1>
137
138 <refsect1>
139 <title>See also</title>
140 <para><link linkend="SigioInput"><citetitle>Signal Input</citetitle></link></para>
141 </refsect1>
142
143 <refsect1>
144 <title>Credits</title>
145 <para>
146 <simplelist>
147 <member>Authors: &namebarry;, &namematt;/&namemike;</member>
148 <member>MIT, Mills College</member>
149 <member>1993-1997</member>
150 </simplelist>
151 </para>
152 <para>Warning to Windows users added by &namekevin;, April 2002</para>
153 </refsect1>
154 </refentry>