| 1 | |
| 2 | <refentry id="sfload"> |
| 3 | <indexterm id="IndexSfload"><primary>sfload</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Generators:Sample Playback</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>sfload</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>sfload</refname> |
| 11 | <refpurpose> |
| 12 | Loads an entire SoundFont2 (SF2) sample file into memory. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | Loads an entire SoundFont2 (SF2) sample file into memory. These opcodes allow management the sample-structure of SF2 files. In order to understand the usage of these opcodes, the user must have some knowledge of the SF2 format, so a brief description of this format can be found in the <link linkend="SiggenSample"><citetitle>SoundFont2 File Format</citetitle></link> section. |
| 20 | </para> |
| 21 | <para> |
| 22 | <emphasis>sfload</emphasis> should be placed in the header section of a Csound orchestra. |
| 23 | </para> |
| 24 | </refsect1> |
| 25 | |
| 26 | <refsect1> |
| 27 | <title>Syntax</title> |
| 28 | <synopsis>ir <command>sfload</command> "filename"</synopsis> |
| 29 | </refsect1> |
| 30 | |
| 31 | <refsect1> |
| 32 | <title>Initialization</title> |
| 33 | <para> |
| 34 | <emphasis>ir</emphasis> -- output to be used by other SF2 opcodes. For <emphasis>sfload</emphasis>, <emphasis>ir</emphasis> is <emphasis>ifilhandle</emphasis>. |
| 35 | </para> |
| 36 | |
| 37 | <para> |
| 38 | <emphasis><quote>filename</quote></emphasis> -- name of the SF2 |
| 39 | file, with its complete path. It must |
| 40 | be a string typed within |
| 41 | double-quotes with <quote>/</quote> to |
| 42 | separate directories (this applies to |
| 43 | DOS and Windows as well, where using a |
| 44 | backslash will generate an error), or |
| 45 | an integer that has been the subject |
| 46 | of a <link linkend="strset"><citetitle>strset</citetitle></link> operation |
| 47 | </para> |
| 48 | </refsect1> |
| 49 | |
| 50 | <refsect1> |
| 51 | <title>Performance</title> |
| 52 | <para> |
| 53 | <emphasis>sfload</emphasis> loads an entire SF2 file into memory. It returns a file handle to be used by other opcodes. Several instances of <emphasis>sfload</emphasis> can placed in the header section of an orchestra, allowing use of more than one SF2 file in a single orchestra. |
| 54 | </para> |
| 55 | <para>If there is an attempt to load the same file twice the |
| 56 | existing load is used with a warning message (from version 6.14). |
| 57 | </para> |
| 58 | <para> |
| 59 | These opcodes only support the sample structure of SF2 files. The modulator structure of the SoundFont2 format is not supported in Csound. Any modulation or processing to the sample data is left to the Csound user, bypassing all restrictions forced by the SF2 standard. |
| 60 | </para> |
| 61 | |
| 62 | <para> |
| 63 | It should be noted that before version 5.12 a maximum of 10 |
| 64 | sound fonts could be loaded, a restriction since relaxed. |
| 65 | </para> |
| 66 | </refsect1> |
| 67 | |
| 68 | <refsect1> |
| 69 | <title>Examples</title> |
| 70 | <para> |
| 71 | Here is an example of the sfload opcode. It uses the file <ulink url="examples/sfload.csd"><citetitle>sfload.csd</citetitle></ulink>. |
| 72 | <example> |
| 73 | <title>Example of the sfload opcode.</title> |
| 74 | <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> |
| 75 | <xi:include href="examples-xml/sfload.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 76 | </example> |
| 77 | </para> |
| 78 | </refsect1> |
| 79 | |
| 80 | <refsect1> |
| 81 | <title>See also</title> |
| 82 | <para><link linkend="SiggenSample"><citetitle>Soundfonts</citetitle></link></para> |
| 83 | <para> More information on soundfonts is in the Floss Manuals: <ulink url="https://flossmanual.csound.com/midi/reading-midi-files"><citetitle>https://flossmanual.csound.com/midi/reading-midi-files</citetitle></ulink></para> |
| 84 | <para> For other information on soundfonts look in the Wikipedia: <ulink url="http://en.wikipedia.org/wiki/Soundfont"><citetitle>http://en.wikipedia.org/wiki/Soundfont</citetitle></ulink></para> |
| 85 | </refsect1> |
| 86 | |
| 87 | <refsect1> |
| 88 | <title>Credits</title> |
| 89 | <para> |
| 90 | <simplelist> |
| 91 | <member>Author: &namegabriel;</member> |
| 92 | <member>Italy</member> |
| 93 | <member>May 2000</member> |
| 94 | </simplelist> |
| 95 | </para> |
| 96 | |
| 97 | <para>New in Csound Version 4.07</para> |
| 98 | </refsect1> |
| 99 | </refentry> |