Debian Codegraph @

opcodes/granule.xml

raw symbols SCIP
1
2 <refentry id="granule">
3 <indexterm id="IndexGranule"><primary>granule</primary></indexterm>
4 <refentryinfo><title>Signal Generators:Granular Synthesis</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>granule</refentrytitle>
7 </refmeta>
8
9
10
11 <refnamediv>
12 <refname>granule</refname>
13 <refpurpose>
14 A more complex granular synthesis texture generator.
15 </refpurpose>
16 </refnamediv>
17
18 <refsect1>
19 <title>Description</title>
20 <para>
21 The <emphasis>granule</emphasis> unit generator is more complex than <emphasis>grain</emphasis>, but does add new possibilities.
22 </para>
23
24 <para>
25 <emphasis>granule</emphasis> is a Csound unit generator which employs a wavetable as input to produce granularly synthesized audio output. Wavetable data may be generated by any of the GEN subroutines such as <link linkend="GEN01"><citetitle>GEN01</citetitle></link> which reads an audio data file into a wavetable. This enable a sampled sound to be used as the source for the grains. Up to 128 voices are implemented internally. The maximum number of voices can be increased by redefining the variable MAXVOICE in the grain4.h file. <emphasis>granule</emphasis> has a build-in random number generator to handle all the random offset parameters. Thresholding is also implemented to scan the source function table at initialization stage. This facilitates features such as skipping silence passage between sentences.
26 </para>
27
28 <para>
29 The characteristics of the synthesis are controlled by 22 parameters. <emphasis>xamp</emphasis> is the amplitude of the output and it can be either audio rate or control rate variable.
30 </para>
31 </refsect1>
32
33 <refsect1>
34 <title>Syntax</title>
35 <synopsis>ares <command>granule</command> xamp, ivoice, iratio, imode, ithd, ifn, ipshift, igskip, igskip_os, ilength, kgap, igap_os, kgsize, igsize_os, iatt, idec \
36 [, iseed] [, ipitch1] [, ipitch2] [, ipitch3] [, ipitch4] [, ifnenv]</synopsis>
37 </refsect1>
38
39 <refsect1>
40 <title>Initialization</title>
41 <para>
42 <emphasis>ivoice</emphasis> -- number of voices.
43 </para>
44
45 <para>
46 <emphasis>iratio</emphasis> -- ratio of the speed of the gskip pointer relative to output audio sample rate. eg. 0.5 will be half speed.
47 </para>
48
49 <para>
50 <emphasis>imode</emphasis> -- +1 grain pointer move forward (same direction of the gskip pointer), -1 backward (oppose direction to the gskip pointer) or 0 for random.
51 </para>
52
53 <para>
54 <emphasis>ithd</emphasis> -- threshold, if the sampled signal in the wavetable is smaller then <emphasis>ithd</emphasis>, it will be skipped.
55 </para>
56
57 <para>
58 <emphasis>ifn</emphasis> -- function table number of sound source.
59 </para>
60
61 <para>
62 <emphasis>ipshift</emphasis> -- pitch shift control. If <emphasis>ipshift</emphasis> is 0, pitch will be set randomly up and down an octave. If <emphasis>ipshift</emphasis> is 1, 2, 3 or 4, up to four different pitches can be set amount the number of voices defined in <emphasis>ivoice</emphasis>. The optional parameters <emphasis>ipitch1</emphasis>, <emphasis>ipitch2</emphasis>, <emphasis>ipitch3</emphasis> and <emphasis>ipitch4</emphasis> are used to quantify the pitch shifts.
63 </para>
64
65 <para>
66 <emphasis>igskip</emphasis> -- initial skip from the beginning of the function table in sec.
67 </para>
68
69 <para>
70 <emphasis>igskip_os</emphasis> -- gskip pointer random offset in sec, 0 will be no offset.
71 </para>
72
73 <para>
74 <emphasis>ilength</emphasis> -- length of the table to be used starting from <emphasis>igskip</emphasis> in sec.
75 </para>
76
77 <para>
78 <emphasis>igap_os</emphasis> -- gap random offset in % of the gap size, 0 gives no offset.
79 </para>
80
81 <para>
82 <emphasis>igsize_os</emphasis> -- grain size random offset in % of grain size, 0 gives no offset.
83 </para>
84
85 <para>
86 <emphasis>iatt</emphasis> -- attack of the grain envelope in % of grain size.
87 </para>
88
89 <para>
90 <emphasis>idec</emphasis> -- decade of the grain envelope in % of grain size.
91 </para>
92
93 <para>
94 <emphasis>iseed</emphasis> (optional, default=0.5) -- seed for the random number generator.
95 </para>
96
97 <para>
98 <emphasis>ipitch1, ipitch2, ipitch3, ipitch4</emphasis> (optional, default=1) -- pitch shift parameter, used when <emphasis>ipshift</emphasis> is set to 1, 2, 3 or 4. Time scaling technique is used in pitch shift with linear interpolation between data points. Default value is 1, the original pitch.
99 </para>
100
101 <para>
102 <emphasis>ifnenv</emphasis> (optional, default=0) -- function table number to be used to generate the shape of the envelope.
103 </para>
104 </refsect1>
105
106 <refsect1>
107 <title>Performance</title>
108 <para>
109 <emphasis>xamp</emphasis> -- amplitude.
110 </para>
111
112 <para>
113 <emphasis>kgap</emphasis> -- gap between grains in sec.
114 </para>
115
116 <para>
117 <emphasis>kgsize</emphasis> -- grain size in sec.
118 </para>
119 </refsect1>
120
121 <refsect1>
122 <title>Examples</title>
123 <para>
124 Here is an example of the granule opcode. It uses the files <ulink url="examples/granule.csd"><citetitle>granule.csd</citetitle></ulink>, <ulink url="examples/marimba.aif"><citetitle>marimba.aif</citetitle></ulink> and <ulink url="examples/fox.wav"><citetitle>fox.wav</citetitle></ulink>
125
126 <example>
127 <title>Example of the granule opcode.</title>
128
129 <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>
130 <xi:include href="examples-xml/granule.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
131 </example>
132 </para>
133
134 <para>
135 The above example reads a sound file called <emphasis>marimba.aif</emphasis> into wavetable number 1, a second reads <emphasis>fox.wav</emphasis> into wavetable number 2. The first note generates 10 seconds of stereo audio output using the wavetable. In the orchestra file, all parameters required to control the synthesis are passed from the score file. A <emphasis>linseg</emphasis> function generator is used to generate an envelope with 0.5 second of linear attack and decay. Stereo effect is generated by using different seeds for the two <emphasis>granule</emphasis> function calls. In the example, 0.17 is added to p20 (= iseed) before passing into the second <emphasis>granule</emphasis> call to ensure that all of the random offset events are different from the first one.
136 </para>
137
138 <para>
139 The second note (wavetable number 2) has slightly different parameters.
140 </para>
141
142 <para>
143 In the score file for the first note, the parameters are interpreted as:
144
145 <informaltable frame="all">
146 <tgroup cols="2" colsep="1" rowsep="1">
147 <thead>
148 <row>
149 <entry>Parameter</entry>
150 <entry>Interpreted As</entry>
151 </row>
152 </thead>
153
154 <tbody>
155 <row>
156 <entry>p5 (<emphasis>ivoice</emphasis>)</entry>
157 <entry>the number of voices is set to 64</entry>
158 </row>
159
160 <row>
161 <entry>p6 (<emphasis>iratio</emphasis>)</entry>
162 <entry>set to 0.5, it scans the wavetable at half of the speed of the audio output rate</entry>
163 </row>
164
165 <row>
166 <entry>p7 (<emphasis>imode</emphasis>)</entry>
167 <entry>set to 0, the grain pointer only move forward</entry>
168 </row>
169
170 <row>
171 <entry>p8 (<emphasis>ithd</emphasis>)</entry>
172 <entry>set to 0, skipping the thresholding process</entry>
173 </row>
174
175 <row>
176 <entry>p9 (<emphasis>ifn</emphasis>)</entry>
177 <entry>set to 1, function table number 1 is used</entry>
178 </row>
179
180 <row>
181 <entry>p10 (<emphasis>ipshift</emphasis>)</entry>
182 <entry>set to 4, four different pitches are going to be generated</entry>
183 </row>
184
185 <row>
186 <entry>p11 (<emphasis>igskip</emphasis>)</entry>
187 <entry>set to 0 and p12 (<emphasis>igskip_os</emphasis>) is set to 0.005, no skipping into the wavetable and a 5 mSec random offset is used</entry>
188 </row>
189
190 <row>
191 <entry>p13 (<emphasis>ilength</emphasis>)</entry>
192 <entry>set to 1, 1 second of the wavetable is to be used</entry>
193 </row>
194
195 <row>
196 <entry>p14 (<emphasis>kgap</emphasis>)</entry>
197 <entry>set to 0.01 and p15 (<emphasis>igap_os</emphasis>) is set to 50, 10 mSec gap with 50% random offset is to be used</entry>
198 </row>
199
200 <row>
201 <entry>p16 (<emphasis>kgsize</emphasis>)</entry>
202 <entry>set to 0.02 and p17 (<emphasis>igsize_os</emphasis>) is set to 50, 20 mSec grain with 50% random offset is used</entry>
203 </row>
204
205 <row>
206 <entry>p18 (<emphasis>iatt</emphasis>) and p19 (<emphasis>idec</emphasis>)</entry>
207 <entry>set to 25, 25% of linear attack and decade is applied to the grain</entry>
208 </row>
209
210 <row>
211 <entry>p20 (<emphasis>iseed</emphasis>)</entry>
212 <entry>seed for the random number generator is set to 0.39</entry>
213 </row>
214
215 <row>
216 <entry>p21 - p24</entry>
217 <entry>pitches set to 1 which is the original pitch, 1.42 which is a 5th up, 0.29 which is a 7th down and finally 2 which is an octave up.</entry>
218 </row>
219 </tbody>
220 </tgroup>
221 </informaltable>
222 </para>
223 </refsect1>
224
225 <refsect1>
226 <title>See Also</title>
227 <para>
228 <link linkend="SiggenGranular"><citetitle>Granular Synthesis</citetitle></link>
229 </para>
230 </refsect1>
231
232 <refsect1>
233 <title>Credits</title>
234 <para>Author: Allan Lee</para>
235 <para>Belfast</para>
236 <para>1996</para>
237 <para>New in version 3.35</para>
238 </refsect1>
239 </refentry>