| 1 | |
| 2 | <refentry id="GEN49"> |
| 3 | <indexterm id="IndexGEN49"><primary>GEN49</primary></indexterm> |
| 4 | <refmeta> |
| 5 | <refentrytitle>GEN49</refentrytitle> |
| 6 | </refmeta> |
| 7 | |
| 8 | <refnamediv> |
| 9 | <refname>GEN49</refname> |
| 10 | <refpurpose> |
| 11 | Transfers data from an MP3 soundfile into a function table. |
| 12 | </refpurpose> |
| 13 | </refnamediv> |
| 14 | |
| 15 | <refsect1> |
| 16 | <title>Description</title> |
| 17 | <para> |
| 18 | This subroutine transfers data from an MP3 soundfile into a function table. |
| 19 | </para> |
| 20 | </refsect1> |
| 21 | |
| 22 | <refsect1> |
| 23 | <title>Syntax</title> |
| 24 | <synopsis><command>f</command># time size 49 filcod skiptime format</synopsis> |
| 25 | </refsect1> |
| 26 | |
| 27 | <refsect1> |
| 28 | <title>Performance</title> |
| 29 | <para> |
| 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. |
| 41 | </para> |
| 42 | |
| 43 | <para> |
| 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>. |
| 53 | </para> |
| 54 | |
| 55 | <para> |
| 56 | <emphasis>skiptime</emphasis> -- begin reading at <emphasis>skiptime</emphasis> seconds into the file. |
| 57 | </para> |
| 58 | |
| 59 | <para> |
| 60 | <emphasis>format</emphasis> -- specifies the audio data-file format required: |
| 61 | <literallayout> |
| 62 | 1 - Mono file 3 - First channel (left) |
| 63 | 2 - Stereo file 4 - Second channel (right) |
| 64 | </literallayout> |
| 65 | </para> |
| 66 | |
| 67 | <para> |
| 68 | If <emphasis>format</emphasis> = 0 the sample format is taken from the soundfile header. |
| 69 | </para> |
| 70 | |
| 71 | <note> |
| 72 | <title>Note</title> |
| 73 | <para> |
| 74 | <itemizedlist> |
| 75 | <listitem> |
| 76 | <para> |
| 77 | Reading stops at end-of-file or when the table is full. Table locations not filled will contain zeros. |
| 78 | </para> |
| 79 | </listitem> |
| 80 | |
| 81 | <listitem> |
| 82 | <para> |
| 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. |
| 84 | </para> |
| 85 | </listitem> |
| 86 | </itemizedlist> |
| 87 | </para> |
| 88 | </note> |
| 89 | </refsect1> |
| 90 | |
| 91 | <refsect1> |
| 92 | <title>Examples</title> |
| 93 | <para> |
| 94 | Here is an example of the GEN49 routine. It uses the files <ulink url="examples/gen49.csd"><citetitle>gen49.csd</citetitle></ulink>. |
| 95 | <example> |
| 96 | <title>An example of the GEN49 routine.</title> |
| 97 | <xi:include href="examples-xml/gen49.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 98 | </example> |
| 99 | |
| 100 | <textobject> |
| 101 | <phrase>This is the diagram of the waveforms of the GEN49 routine, as used in the example:</phrase> |
| 102 | </textobject> |
| 103 | |
| 104 | <mediaobject> |
| 105 | <imageobject> |
| 106 | <imagedata fileref="images/gen49.png" format="PNG"/> |
| 107 | </imageobject> |
| 108 | |
| 109 | <textobject> |
| 110 | <phrase>f 1 0 131072 49 "beats.mp3" 0 1</phrase> |
| 111 | </textobject> |
| 112 | |
| 113 | <caption> |
| 114 | <para>f 1 0 131072 49 "beats.mp3" 0 1</para> |
| 115 | </caption> |
| 116 | </mediaobject> |
| 117 | |
| 118 | </para> |
| 119 | </refsect1> |
| 120 | |
| 121 | <refsect1> |
| 122 | <title>Credits</title> |
| 123 | <para>Written by &namejohn;</para> |
| 124 | <para>February 2009.</para> |
| 125 | </refsect1> |
| 126 | </refentry> |