Debian Codegraph @

opcodes/fout.xml

raw symbols SCIP
1
2 <refentry id="fout">
3 <indexterm id="IndexFout"><primary>fout</primary></indexterm>
4 <refentryinfo><title>Signal I/O:File I/O</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>fout</refentrytitle>
7 </refmeta>
8
9 <refnamediv>
10 <refname>fout</refname>
11 <refpurpose>
12 Outputs a-rate signals to an arbitrary number of channels.
13 </refpurpose>
14 </refnamediv>
15
16 <refsect1>
17 <title>Description</title>
18 <para>
19 <emphasis>fout</emphasis> outputs <emphasis>N</emphasis> a-rate signals to a specified file of <emphasis>N</emphasis> channels.
20 </para>
21 </refsect1>
22
23 <refsect1>
24 <title>Syntax</title>
25 <synopsis><command>fout</command> ifilename, iformat, aout1 [, aout2, aout3,...,aoutN]</synopsis>
26 <synopsis><command>fout</command> ifilename, iformat, array[]</synopsis>
27 </refsect1>
28
29 <refsect1>
30 <title>Initialization</title>
31 <para>
32 <emphasis>ifilename</emphasis> -- the output file's name (in double-quotes).
33 </para>
34
35 <para>
36 <emphasis>iformat</emphasis> -- a flag to choose output file format (note: Csound versions older than 5.0 may only support formats 0, 1, and 2):
37 <itemizedlist>
38 <listitem>
39 <para>-1 - format exactly as per global csound output format flags (-A, -W, --format=..., etc).</para>
40 </listitem>
41
42 <listitem>
43 <para>0 - 32-bit floating point samples without header (binary PCM multichannel file)</para>
44 </listitem>
45
46 <listitem>
47 <para>1 - 16-bit integers without header (binary PCM multichannel file)</para>
48 </listitem>
49
50 <listitem>
51 <para>2 - 16-bit integers with a header. The header type depends on the render (-o) format. For example, if the user chooses the AIFF format (using the <link linkend="FlagsMinusUpperA"><citetitle>-A flag</citetitle></link>), the header format will be AIFF type.</para>
52 </listitem>
53
54 <listitem>
55 <para>3 - u-law samples with a header (see iformat=2).</para>
56 </listitem>
57
58 <listitem>
59 <para>4 - 16-bit integers with a header (see iformat=2).</para>
60 </listitem>
61
62 <listitem>
63 <para>5 - 32-bit integers with a header (see iformat=2).</para>
64 </listitem>
65
66 <listitem>
67 <para>6 - 32-bit floats with a header (see iformat=2).</para>
68 </listitem>
69
70 <listitem>
71 <para>7 - 8-bit unsigned integers with a header (see iformat=2).</para>
72 </listitem>
73
74 <listitem>
75 <para>8 - 24-bit integers with a header (see iformat=2).</para>
76 </listitem>
77
78 <listitem>
79 <para>9 - 64-bit floats with a header (see iformat=2).</para>
80 </listitem>
81
82 <listitem>
83 <para> 50 - ogg-vorbis format.</para>
84 </listitem>
85
86 </itemizedlist>
87 In addition, Csound versions 5.0 and later allow for explicitly selecting a particular header type by specifying the format as 10 * fileType + sampleFormat, where fileType may be 1 for WAV, 2 for AIFF, 3 for raw (headerless) files, and 4 for IRCAM; sampleFormat is one of the above values in the range 0 to 9, except sample format 0 is taken from the command line (-o), format 1 is 8-bit signed integers, and format 2 is a-law. So, for example, iformat=25 means 32-bit integers with AIFF header.
88 </para>
89 </refsect1>
90
91 <refsect1>
92 <title>Performance</title>
93 <para>
94 <emphasis>aout1,... aoutN</emphasis> -- signals to be written to the file. In the case of raw files, the expected range of audio signals is determined by the selected sample format; for sound files with a header like WAV and AIFF, the audio signals should be in the range -0dbfs to 0dbfs.
95 </para>
96
97 <para>
98 <emphasis>fout</emphasis> (file output) writes samples of audio signals to a file with any number of channels. Channel number depends by the number of <emphasis>aoutN</emphasis> variables (i.e. a mono signal with only an a-rate argument, a stereo signal with two a-rate arguments etc.) Maximum number of channels is fixed to 64. Multiple <emphasis>fout</emphasis> opcodes can be present in the same instrument, referring to different files.
99 </para>
100
101 <para>
102 Notice that, unlike <link linkend="out"><citetitle>out</citetitle></link>, <link linkend="outs"><citetitle>outs</citetitle></link> and <link linkend="outq"><citetitle>outq</citetitle></link>, <emphasis>fout</emphasis> does not zero the audio variable so you must zero it after calling it. If polyphony is to be used, you can use <link linkend="vincr"><citetitle>vincr</citetitle></link> and <link linkend="clear"><citetitle>clear</citetitle></link> opcodes for this task.
103 </para>
104
105 <para>
106 Notice that <emphasis>fout</emphasis> and <link
107 linkend="foutk"><citetitle>foutk</citetitle></link> uses a
108 string containing a file pathname.
109 <!-- , or a handle-number generated by <link -->
110 <!-- linkend="fiopen"><citetitle>fiopen</citetitle></link>. -->
111 Whereas, with <link
112 linkend="fouti"><citetitle>fouti</citetitle></link> and <link
113 linkend="foutir"><citetitle>foutir</citetitle></link>, the
114 target file can be only specified by means of a handle-number.
115 </para>
116 <note>
117 <para>If you are using <emphasis>fout</emphasis> to generate an audio file for the global output of csound, you might want to use the <link linkend="monitor"><citetitle>monitor</citetitle></link> opcode, which can tap the output buffer, to avoid having to route </para>
118 </note>
119 </refsect1>
120
121 <refsect1>
122 <title>Examples</title>
123 <para>
124 Here is a simple example of the fout opcode. It uses the file <ulink url="examples/fout.csd"><citetitle>fout.csd</citetitle></ulink>.
125
126 <example>
127 <title>Example of the fout opcode.</title>
128
129 <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>
130 <xi:include href="examples-xml/fout.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
131 </example>
132 </para>
133
134 <para>
135 Here is another example of <emphasis>fout</emphasis>, using it to save the contents of a table to an audio file. It uses the file <ulink url="examples/fout_ftable.csd"><citetitle>fout_ftable.csd</citetitle></ulink> and <ulink url="examples/drumsMlp.wav"><citetitle>drumsMlp.wav</citetitle></ulink>.
136
137 <example>
138 <title>Example of the fout opcode to save the contents of an f-table.</title>
139
140 <xi:include href="examples-xml/fout_ftable.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
141 </example>
142 </para>
143 </refsect1>
144
145 <refsect1>
146 <title>See also</title>
147 <para><link linkend="SigioFileIO"><citetitle>File Input and Output</citetitle></link></para>
148 </refsect1>
149
150 <refsect1>
151 <title>Credits</title>
152 <para>
153 <simplelist>
154 <member>Author: &namegabriel;</member>
155 <member>Italy</member>
156 <member>1999</member>
157 <member>Author: &namejohn;</member>
158 <member>NUIM, 2013</member>
159 </simplelist>
160 </para>
161
162 <para>New in Csound version 3.56</para>
163 <para>October 2002. Added a note from Richard Dobson.</para>
164 <para>Array version new in 6.01</para>
165 </refsect1>
166 </refentry>