| 1 | |
| 2 | <refentry id="sndload"> |
| 3 | <indexterm id="IndexSndload"><primary>sndload</primary></indexterm> |
| 4 | <refentryinfo><title>Table Control</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>sndload</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>sndload</refname> |
| 11 | <refpurpose> |
| 12 | Loads a sound file into memory for use by <link linkend="loscilx"><citetitle>loscilx</citetitle></link> |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | <emphasis>sndload</emphasis> loads a sound file into memory for use by <link linkend="loscilx"><citetitle>loscilx</citetitle></link>. |
| 20 | </para> |
| 21 | <note>This opcode loads the file into memory but it is not |
| 22 | available for use adfterwards. In effect it just wastes memory.</note> |
| 23 | </refsect1> |
| 24 | <refsect1> |
| 25 | <title>Syntax</title> |
| 26 | <synopsis><command>sndload</command> Sfname[, ifmt[, ichns[, isr[, ibas[, iamp[, istrt \ |
| 27 | [, ilpmod[, ilps[, ilpe]]]]]]]]]</synopsis> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Initialization</title> |
| 32 | <para><emphasis>Sfname</emphasis> - file name as a string constant |
| 33 | or variable, string p-field, or a number that is used either as an |
| 34 | index to strings set with strset, or, if that is not available, a |
| 35 | file name in the format soundin.n is used. If the file name does |
| 36 | not include a full path, the file is searched in the current |
| 37 | directory first, then those specified by <link |
| 38 | linkend="CommandEnvironment"><citetitle>SSDIR</citetitle></link> |
| 39 | (if defined), and finally <link |
| 40 | linkend="CommandEnvironment"><citetitle>SFDIR</citetitle></link>. If |
| 41 | the same file was already loaded previously, it will not be read |
| 42 | again, but the parameters ibas, iamp, istrt, ilpmod, ilps, and |
| 43 | ilpe are still updated. |
| 44 | </para> |
| 45 | <para> |
| 46 | <emphasis>ifmt </emphasis>(optional, defaults to zero) - default |
| 47 | sample format for raw (headerless) sound files; if the file has |
| 48 | a header, this is ignored. Can be one of the following: |
| 49 | <simplelist type='vert' columns='1'> |
| 50 | <member>-1: do not allow headerless files (fail with an init error)</member> |
| 51 | <member>0: use the same format as the one specified on the command line</member> |
| 52 | <member>1: 8 bit signed integers</member> |
| 53 | <member>2: a-law</member> |
| 54 | <member>3: u-law</member> |
| 55 | <member>4: 16 bit signed integers</member> |
| 56 | <member>5: 32 bit signed integers</member> |
| 57 | <member>6: 32 bit floats</member> |
| 58 | <member>7: 8 bit unsigned integers</member> |
| 59 | <member>8: 24 bit signed integers</member> |
| 60 | <member>9: 64 bit floats</member> |
| 61 | </simplelist> |
| 62 | </para> |
| 63 | <para> |
| 64 | <emphasis>ichns</emphasis> (optional, defaults to zero) - |
| 65 | default number of channels for raw (headerless) sound files; if |
| 66 | the file has a header, this is ignored. Zero or negative values |
| 67 | are interpreted as 1 channel. |
| 68 | </para> |
| 69 | <para> |
| 70 | <emphasis>isr</emphasis> (optional, defaults to zero) - default |
| 71 | sample rate for raw (headerless) sound files; if the file has a |
| 72 | header, this is ignored. Zero or negative values are interpreted |
| 73 | as the orchestra sample rate (sr). |
| 74 | </para> |
| 75 | <para> |
| 76 | <emphasis>ibas</emphasis> (optional, defaults to zero) - base |
| 77 | frequency in Hz. If positive, overrides the value specified in |
| 78 | the sound file header; otherwise, the value from the header is |
| 79 | used if present, and 1.0 if the file does not include such |
| 80 | information. |
| 81 | </para> |
| 82 | <para> |
| 83 | <emphasis>iamp</emphasis> (optional, defaults to zero) - |
| 84 | amplitude scale. If non-zero, overrides the value specified in |
| 85 | the sound file header (note: negative values are allowed, and |
| 86 | will invert the sound output); otherwise, the value from the |
| 87 | header is used if present, and 1.0 if the file does not include |
| 88 | such information. |
| 89 | </para> |
| 90 | <para> |
| 91 | <emphasis>istrt</emphasis> (optional, defaults to -1) - starting |
| 92 | position in sample frames, can be fractional. If non-negative, |
| 93 | overrides the value specified in the sound file header; |
| 94 | otherwise, the value from the header is used if present, and 0 |
| 95 | if the file does not include such information. Note: even if |
| 96 | this parameter is specified, the whole file is still read into |
| 97 | memory. |
| 98 | </para> |
| 99 | <para> |
| 100 | <emphasis>ilpmod</emphasis> (optional, defaults to -1) - loop |
| 101 | mode, can be one of the following: |
| 102 | <simplelist type='vert' columns='1'> |
| 103 | <member>any negative value: use the loop information specified in the |
| 104 | sound file header, ignoring ilps and ilpe</member> |
| 105 | <member>0: no looping (ilps and ilpe are ignored)</member> |
| 106 | <member>1: forward looping (wrap around loop end if it is crossed in |
| 107 | forward direction, and wrap around loop start if it is |
| 108 | crossed in backward direction)</member> |
| 109 | <member>2: backward looping (change direction at loop end if it is |
| 110 | crossed in forward direction, and wrap around loop start if it |
| 111 | is crossed in backward direction)</member> |
| 112 | <member>3: forward-backward looping (change direction at both loop points |
| 113 | if they are crossed as described above)</member> |
| 114 | </simplelist> |
| 115 | </para> |
| 116 | <para> |
| 117 | <emphasis>ilps</emphasis> (optional, defaults to 0) - loop start |
| 118 | in sample frames (fractional values are allowed), or loop end if |
| 119 | ilps is greater than ilpe. Ignored unless ilpmod is set to 1, 2, |
| 120 | or 3. If the loop points are equal, the whole sample is looped. |
| 121 | </para> |
| 122 | <para> |
| 123 | <emphasis>ilpe</emphasis> (optional, defaults to 0) - loop end |
| 124 | in sample frames (fractional values are allowed), or loop start |
| 125 | if ilps is greater than ilpe. Ignored unless ilpmod is set to |
| 126 | 1, 2, or 3. If the loop points are equal, the whole sample is |
| 127 | looped. |
| 128 | </para> |
| 129 | </refsect1> |
| 130 | |
| 131 | <refsect1> |
| 132 | <title>Credits</title> |
| 133 | <para>Written by &nameistvan;.</para> |
| 134 | <para>2006</para> |
| 135 | <para>New in Csound 5.03</para> |
| 136 | </refsect1> |
| 137 | </refentry> |