3
<indexterm id="IndexGEN49"><primary>GEN49</primary></indexterm>
5
<refentrytitle>GEN49</refentrytitle>
9
<refname>GEN49</refname>
11
Transfers data from an MP3 soundfile into a function table.
16
<title>Description</title>
18
This subroutine transfers data from an MP3 soundfile into a function table.
24
<synopsis><command>f</command># time size 49 filcod skiptime format</synopsis>
28
<title>Performance</title>
30
<emphasis>size</emphasis> -- number of points in the
31
table. Ordinarily a power of 2 or a power-of-2 plus 1
32
(see <link linkend="f"><citetitle>f
33
statement</citetitle></link>); the maximum tablesize is 16777216
34
(2<superscript>24</superscript>) points. The allocation of table
35
memory can be <emphasis>deferred</emphasis> by setting this
36
parameter to 0; the size allocated is then the number of points
37
in the file (probably not a power-of-2), and the table is not
38
usable by normal oscillators, but it is usable by
39
a <link linkend="loscil"><citetitle>loscil</citetitle></link>
40
unit. The soundfile can also be mono or stereo.
44
<emphasis>filcod</emphasis> -- integer or character-string
45
denoting the source soundfile name. An integer denotes the
46
file <emphasis>soundin</emphasis>.<emphasis>filcod</emphasis> ;
47
a character-string (in double quotes, spaces permitted) gives
48
the filename itself, optionally a full pathname. If not a full
49
path, the file is sought first in the current directory, then in
50
that given by the environment variable <link linkend="CommandEnvironment"><citetitle>SSDIR</citetitle></link> (if defined) then
51
by <link linkend="CommandEnvironment"><citetitle>SFDIR</citetitle></link>. See
52
also <link linkend="soundin"><citetitle>soundin</citetitle></link>.
56
<emphasis>skiptime</emphasis> -- begin reading at <emphasis>skiptime</emphasis> seconds into the file.
60
<emphasis>format</emphasis> -- specifies the audio data-file format required:
62
1 - Mono file 3 - First channel (left)
63
2 - Stereo file 4 - Second channel (right)
68
If <emphasis>format</emphasis> = 0 the sample format is taken from the soundfile header.
77
Reading stops at end-of-file or when the table is full. Table locations not filled will contain zeros.
83
If p4 is positive, the table will be post-normalized (rescaled to a maximum absolute value of 1 after generation). A negative p4 will cause rescaling to be skipped.
92
<title>Examples</title>
94
Here is a simple example of the GEN49 routine. It uses the files <ulink url="examples/gen49.csd"><citetitle>gen49.csd</citetitle></ulink>, and <ulink url="examples/beats.mp3"><citetitle>beats.mp3</citetitle></ulink>. It uses the MP3 file <quote>beats.mp3</quote>.
97
<title>A simple example of the GEN49 routine.</title>
99
<xi:include href="examples-xml/gen49.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
107
<title>Credits</title>
108
<para>Written by &namejohn;</para>
109
<para>February 2009.</para>