Debian Codegraph @

opcodes/sfplay3m.xml

raw symbols SCIP
1
2 <refentry id="sfplay3m">
3 <indexterm id="IndexSfplay3m"><primary>sfplay3m</primary></indexterm>
4 <refentryinfo><title>Signal Generators:Sample Playback</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>sfplay3m</refentrytitle>
7 </refmeta>
8
9 <refnamediv>
10 <refname>sfplay3m</refname>
11 <refpurpose>
12 Plays a SoundFont2 (SF2) sample preset, generating a mono sound with cubic interpolation.
13 </refpurpose>
14 </refnamediv>
15
16 <refsect1>
17 <title>Description</title>
18 <para>
19 Plays a SoundFont2 (SF2) sample preset, generating a mono sound with cubic interpolation. 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 </refsect1>
22
23 <refsect1>
24 <title>Syntax</title>
25 <synopsis>ares <command>sfplay3m</command> ivel, inotenum, xamp, xfreq, ipreindex [, iflag] [, ioffset] [, ienv]</synopsis>
26 </refsect1>
27
28 <refsect1>
29 <title>Initialization</title>
30 <para>
31 <emphasis>ivel</emphasis> -- velocity value
32 </para>
33
34 <para>
35 <emphasis>inotenum</emphasis> -- MIDI note number value
36 </para>
37
38 <para>
39 <emphasis>ipreindex</emphasis> -- preset index
40 </para>
41
42 <para>
43 <emphasis>iflag</emphasis> (optional) -- flag regarding the behavior of <emphasis>xfreq</emphasis> and <emphasis>inotenum</emphasis>
44 </para>
45
46 <para>
47 <emphasis>ioffset</emphasis> (optional) -- start playing at offset, in samples.
48 </para>
49
50 <para>
51 <emphasis>ienv</emphasis> (optional) -- enables and determines amplitude envelope. 0 = no envelope, 1 = linear attack and decay, 2 = linear attack, exponential decay (see below). Default = 0.
52 </para>
53 </refsect1>
54
55 <refsect1>
56 <title>Performance</title>
57 <para>
58 <emphasis>xamp</emphasis> -- amplitude correction factor
59 </para>
60
61 <para>
62 <emphasis>xfreq</emphasis> -- frequency value or frequency multiplier, depending by <emphasis>iflag</emphasis>. When <emphasis>iflag</emphasis> = 0, <emphasis>xfreq</emphasis> is a multiplier of a the default frequency, assigned by SF2 preset to the <emphasis>inotenum</emphasis> value. When <emphasis>iflag</emphasis> = 1, <emphasis>xfreq</emphasis> is the absolute frequency of the output sound, in Hz. Default is 0.
63 </para>
64
65 <para>
66 When <emphasis>iflag</emphasis> = 0, <emphasis>inotenum</emphasis> sets the frequency of the output according to the MIDI note number used, and <emphasis>xfreq</emphasis> is used as a multiplier. When <emphasis>iflag</emphasis> = 1, the frequency of the output, is set directly by <emphasis>xfreq</emphasis>. This allows the user to use any kind of micro-tuning based scales. However, this method is designed to work correctly only with presets tuned to the default equal temperament. Attempts to use this method with a preset already having non-standard tunings, or with drum-kit-based presets, could give unexpected results.
67 </para>
68
69 <para>
70 Adjustment of the amplitude can be done by varying the <emphasis>xamp</emphasis> argument, which acts as a multiplier.
71 </para>
72
73 <para>
74 Notice that both <emphasis>xamp</emphasis> and <emphasis>xfreq</emphasis> can use k-rate as well as a-rate signals. Both arguments must use variables of the same rate, or <emphasis>sfplay3m</emphasis> will not work correctly. <emphasis>ipreindex</emphasis> must contain the number of a previously assigned preset, or Csound will crash.
75 </para>
76
77 <para>
78 The <emphasis>ioffset</emphasis> parameter allows the sound to start from a sample different than the first one. The user should make sure that its value is within the length of the specific sound. Otherwise, Csound will probably crash.
79 </para>
80
81 <para>
82 The <emphasis>ienv</emphasis> parameter enables and determines the type of amplitude envelope used. The default value is 0, or no envelope. If <emphasis>ienv</emphasis> is set to 1, the attack and decay portions are linear. If set to 2, the attack is linear and the decay is exponential. The release portion of the envelope has not yet been implemented.
83 </para>
84
85 <para>
86 <emphasis>sfplay3m</emphasis> is a mono version of <link linkend="sfplay3"><citetitle>sfplay3</citetitle></link>. It should be used with mono preset, or with the stereo presets in which stereo output is not required. It is faster than <emphasis>sfplay3</emphasis>.
87 </para>
88
89 <para>
90 <emphasis>sfplay3m</emphasis> is also a cubic-interpolation version of <link linkend="sfplaym"><citetitle>sfplaym</citetitle></link>. Difference of sound-quality is noticeable specially in bass-frequency-transposed samples. In high-freq-transposed samples the difference is less noticeable, and I suggest to use linear-interpolation versions, because they are faster.
91 </para>
92
93 <para>
94 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.
95 </para>
96 </refsect1>
97
98 <refsect1>
99 <title>Examples</title>
100 <para>
101 Here is an example of the sfplay3m opcode. It uses the file <ulink url="examples/sfplay3m.csd"><citetitle>sfplay3m.csd</citetitle></ulink>.
102 <example>
103 <title>Example of the sfplay3m opcode.</title>
104 <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>
105 <xi:include href="examples-xml/sfplay3m.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
106 </example>
107 </para>
108 </refsect1>
109
110 <refsect1>
111 <title>See also</title>
112 <para><link linkend="SiggenSample"><citetitle>Soundfonts</citetitle></link></para>
113 <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>
114 <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>
115 </refsect1>
116
117 <refsect1>
118 <title>Credits</title>
119 <para>
120 <simplelist>
121 <member>Author: &namegabriel;</member>
122 <member>Italy</member>
123 <member>May 2000</member>
124 </simplelist>
125 </para>
126
127 <para>New in Csound Version 4.07</para>
128 <para>New optional parameter <emphasis>ienv</emphasis> in version 5.09</para>
129 </refsect1>
130 </refentry>