Debian Codegraph @

opcodes/vosim.xml

raw symbols SCIP
1
2 <refentry id="vosim">
3 <indexterm id="IndexVosim"><primary>vosim</primary></indexterm>
4 <refentryinfo><title>Signal Generators:Granular Synthesis</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>vosim</refentrytitle>
7 </refmeta>
8
9 <refnamediv>
10 <refname>vosim</refname>
11 <refpurpose>
12 Simple vocal simulation based on glottal pulses with formant characteristics.
13 </refpurpose>
14 </refnamediv>
15
16 <refsect1>
17 <title>Description</title>
18 <para>
19 This opcode produces a simple vocal simulation based on glottal pulses with formant characteristics.
20 Output is a series of sound events, where each event is composed of a burst of squared sine pulses followed by silence.
21 The VOSIM (VOcal SIMulation) synthesis method was developed by Kaegi and Tempelaars in the 1970's.
22 </para>
23 </refsect1>
24
25 <refsect1>
26 <title>Syntax</title>
27 <synopsis>ar <command>vosim</command> kamp, kFund, kForm, kDecay, kPulseCount, kPulseFactor, ifn [, iskip]</synopsis>
28 </refsect1>
29
30 <refsect1>
31 <title>Intialization</title>
32 <para><emphasis>ifn</emphasis> - a sound table, normally containing half a period of a sinewave, squared (see notes below).</para>
33 <para><emphasis>iskip</emphasis> - (optional) Skip initialization, for tied notes.</para>
34 </refsect1>
35
36 <refsect1>
37 <title>Performance</title>
38 <para><emphasis>ar</emphasis> - output signal. Note that the output is usually unipolar - positive only.</para>
39 <para><emphasis>kamp</emphasis> - output amplitude, the peak amplitude of the first pulse in each burst.
40 </para>
41 <para><emphasis>kFund</emphasis> - fundamental pitch, in Herz. Each event is 1/kFund seconds long.
42 </para>
43 <para><emphasis>kForm</emphasis> - formant center frequency. Length of each pulse in the burst is 1/kForm seconds.
44 </para>
45 <para><emphasis>kDecay</emphasis> - a dampening factor from pulse to pulse. This is subtracted from amplitude on each new pulse.
46 </para>
47 <para><emphasis>kPulseCount</emphasis> - number of pulses in the burst part of each event.
48 </para>
49 <para><emphasis>kPulseFactor</emphasis> - the pulse width is multiplied by this value at each new pulse.
50 This results in formant sweeping. If factor is &lt; 1.0, the formant sweeps up, if &gt; 1.0 each new pulse is longer,
51 so the formant sweeps down. The final pitch of the formant is kForm * pow(kPulseFactor, kPulseCount)</para>
52 <para>The output of <emphasis>vosim</emphasis> is a series of sound events, where each event is composed of a burst of squared sine pulses followed by silence.
53 The total duration of the events determines fundamental frequency.
54 The length of each single pulse in the squared-sine bursts produce a formant frequency band. The width of the formant is determined by rate of silence to pulses (see below). The final result is also shaped by the dampening factor from pulse to pulse.</para>
55
56 <para>A small practical problem in using this opcode is that no GEN function will create a squared sine wave out of the box. Something like the following can be used to create the appropriate table from the score.</para>
57 <programlisting><emphasis role="comment">; use GEN09 to create half a sine in table 17
58 </emphasis>
59 <emphasis role="stamnt">f</emphasis> 17 <emphasis>time</emphasis> <emphasis>size</emphasis> 9 0.5 1 0
60
61 <emphasis role="comment">; run instr 101 on table 17 for a single init-pass
62 </emphasis>
63 <emphasis role="stamnt">i</emphasis> 101 0 0 17
64 </programlisting>
65
66 <para>It can also be done with an instrument writing to an f-table in the orchestra:</para>
67 <programlisting> ; square each point in table #p4. This should be run as init-only, just once in the performance.
68
69 <emphasis role="oblock">instr</emphasis> 101
70
71 index <emphasis role="opc">tableng</emphasis> p4
72
73 index <emphasis role="op">=</emphasis> index - 1 <emphasis role="comment">; start from last point</emphasis>
74 loop:
75
76 ival <emphasis role="opc">table</emphasis> index, p4
77
78 ival <emphasis role="op">=</emphasis> ival * ival
79
80 <emphasis role="opc">tableiw</emphasis> ival, index, p4
81
82 index <emphasis role="op">=</emphasis> index - 1
83
84 if index &lt; 0 <emphasis role="opctrl">igoto</emphasis> <emphasis role="olabel">endloop</emphasis>
85 <emphasis role="opctrl">igoto</emphasis> <emphasis role="olabel">loop</emphasis>
86 <emphasis role="olabel">endloop:</emphasis>
87 <emphasis role="oblock">endin</emphasis></programlisting>
88
89 <note><title>Parameter Limits</title><para>The count of pulses multiplied by pulse width should fit in the event length (1/<emphasis>kFund</emphasis>).
90 If this is not fulfilled, the algorithm does not break, we just do not start any pulses that would outlast the event.
91 This might introduce a silence at end of event even if none was intended.
92 In consequence,
93 <emphasis>kForm</emphasis> should be higher than <emphasis>kFund</emphasis>, otherwise only silence is output.</para></note>
94
95 <para><emphasis>Vosim</emphasis> was created to emulate voice sounds using a model of glottal pulse.
96 Rich sounds can be created by combining several instances of <emphasis>vosim</emphasis> with different parameters.
97 One drawback is that the signal is not band-limited. But as the authors point out, attenuation of high-pitch components is -60 dB
98 at 6 times the fundamental frequency. The signal can also be changed by changing the source signal in the lookup table.
99 The technique has historical interest, and can produce rich sound very cheaply (each sample requires only a table lookup and a single multiplication for attenuation).
100 </para>
101
102 <para>As stated, formant bandwidth depends on the ratio between pulse burst and silence in an event.
103 But this is not an independent parameter: The fundamental decides event length, and formant center defines the pulse length. It is therefore impossible to guarantee a specific burst/silence ratio, since the burst length has to be an integer multiple of pulse length. The decay of pulses can be used to smooth the transition from N to N+/-1 pulses, but there will still be steps in the spectral profile of output. The example code below shows one approach to this.
104 </para>
105
106 <para>All input parameters are k-rate. The input parameters are only used to set up each new event (or grain). Event amplitude is fixed for each event at initialization.
107 In normal parameter ranges, when <link linkend="ksmps"><citetitle>ksmps</citetitle></link> &lt;500, the k-rate parameters are updated more often than events are created. In any case, no wide-band noise will be injected in the system due to k-rate inputs being updated less often than they are read,
108 but some other artefacts could be created.</para>
109
110
111 <para>The opcode should behave reasonably in the face of all user inputs. Some details:
112 <orderedlist numeration="loweralpha">
113 <listitem>
114 <para>kFund &lt; 0: This is forced to positive - no point in "reversed" events.</para>
115 </listitem>
116 <listitem>
117 <para>kFund == 0: This leads to "infinite" length event, ie a pulse burst followed by very long indefinite silence.</para>
118 </listitem>
119 <listitem>
120 <para>kForm == 0: This leads to infinite length pulse, so no pulses are generated (i.e. silence).</para>
121 </listitem>
122 <listitem>
123 <para>kForm &lt; 0: Table is read backward. If table is symmetric, <emphasis>kform</emphasis> and -<emphasis>kform</emphasis> should give bit-identical outputs.
124 </para>
125 </listitem>
126 <listitem>
127 <para>kPulseFactor == 0: Second pulse onwards is zero. See (c).</para>
128 </listitem>
129 <listitem>
130 <para>kPulseFactor &lt; 0: Pulses alternately read table forward and reversed.
131 </para>
132 </listitem>
133 </orderedlist>
134 </para>
135 <para>With asymmetric pulse table there may be some use for negative <emphasis>kForm</emphasis> or negative <emphasis>kPulseFactor</emphasis>.
136 </para>
137 </refsect1>
138
139 <refsect1>
140 <title>Examples</title>
141 <para>
142 Here is an example of the vosim opcode. It uses the file <ulink url="examples/vosim.csd"><citetitle>vosim.csd</citetitle></ulink>.
143
144 <example>
145 <title>Example of the vosim opcode.</title>
146 <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>
147 <xi:include href="examples-xml/vosim.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
148 </example>
149 </para>
150 </refsect1>
151
152 <refsect1>
153 <title>See Also</title>
154 <para>
155 <link linkend="SiggenGranular"><citetitle>Granular Synthesis</citetitle></link>
156 </para>
157 </refsect1>
158
159 <refsect1>
160 <title>Credits</title>
161 <para>
162 <simplelist>
163 <member>Author: &namerasmus;</member>
164 <member>March 2008</member>
165 </simplelist>
166 </para>
167 </refsect1>
168 </refentry>