Debian Codegraph @

opcodes/sfplay.xml

raw symbols SCIP
1
2 <refentry id="sfplay">
3 <indexterm id="IndexSfplay"><primary>sfplay</primary></indexterm>
4 <refentryinfo><title>Signal Generators:Sample Playback</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>sfplay</refentrytitle>
7 </refmeta>
8
9 <refnamediv>
10 <refname>sfplay</refname>
11 <refpurpose>
12 Plays a SoundFont2 (SF2) sample preset, generating a stereo sound.
13 </refpurpose>
14 </refnamediv>
15
16 <refsect1>
17 <title>Description</title>
18 <para>
19 Plays a SoundFont2 (SF2) sample preset, generating a stereo sound. 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>ar1, ar2 <command>sfplay</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>sfplay</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>sfplay</emphasis> plays a preset, generating a stereo sound. <emphasis>ivel</emphasis> does not directly affect the amplitude of the output, but informs <emphasis>sfplay</emphasis> about which sample should be chosen in multi-sample, velocity-split presets.
87 </para>
88
89 <para>
90 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.
91 </para>
92 </refsect1>
93
94 <refsect1>
95 <title>Examples</title>
96 <para>
97 See the example for <link linkend="sfplay3"><citetitle>sfplay3</citetitle></link>.
98 </para>
99 </refsect1>
100
101 <refsect1>
102 <title>See also</title>
103 <para><link linkend="SiggenSample"><citetitle>Soundfonts</citetitle></link></para>
104 <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>
105 <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>
106 </refsect1>
107
108 <refsect1>
109 <title>Credits</title>
110 <para>
111 <simplelist>
112 <member>Author: &namegabriel;</member>
113 <member>Italy</member>
114 <member>May 2000</member>
115 </simplelist>
116 </para>
117 <para>New in Csound Version 4.07</para>
118 <para>New optional parameter <emphasis>ienv</emphasis> in version 5.09</para>
119 </refsect1>
120 </refentry>