-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGranularize.effect
413 lines (398 loc) · 17.3 KB
/
Granularize.effect
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
<effect>
<name>Granularize</name>
<enabled>true</enabled>
<numIns>2</numIns>
<numOuts>2</numOuts>
<code>if (<GranularizeON> == 1) then
setksmps 1
itblsz = 131072
itbfrq = sr / itblsz
ifnA1 ftgentmp 0, 0, itblsz, -7, 0, itblsz, 0 ; generate tables
ifnA2 ftgentmp 0, 0, itblsz, -7, 0, itblsz, 0
idclip ftgentmp 0, 0, itblsz, 7, 0, 36, 1, itblsz-72, 1, 36, 0
iwfn ftgentmp 0, 0, 4096, 20, 5
awp phasor itbfrq ; write signal to tables
awin tablei awp, idclip, 1
tablew ain1*awin, awp, ifnA1, 1
tablew ain2*awin, awp, ifnA2, 1
ipitch = itbfrq * i(<Granularize_freq Mult>) ; set grain3 parameters
kphs = 0
kfmd = <Granularize_FM fine> + <Granularize_FM coarse>
kpmd = <Granularize_phase>
kgdur = <Granularize_duration>
kdens = <Granularize_density fine> + <Granularize_density coarse>
; kmaxovr = kdens*kgdur
; kmaxovr = (<densA> + <densB>) * <gdur> + 1
imaxovr = 1000
kfrpow = <Granularize_FM distribution>
kprpow = <Granularize_phase distribution>
iseed = 0
imode = 0
kfn1 = ifnA1
kfn2 = ifnA2
agrain1 grain3 ipitch, kphs, kfmd, kpmd, kgdur, kdens, imaxovr, kfn1, iwfn, kfrpow, kprpow, iseed, imode ; granularize both channels
agrain2 grain3 ipitch, kphs, kfmd, kpmd, kgdur, kdens, imaxovr, kfn2, iwfn, kfrpow, kprpow, iseed-1, imode
ablk1 dcblock agrain1
ablk2 dcblock agrain2
cigoto (imaxovr > 1), bal ; balance signals
iscal = 1
goto end
bal:
iscal = sqrt(imaxovr) * .666666
end:
aout1 = ablk1/iscal
aout2 = ablk2/iscal
aout1 = (ain1 * <Granularize_wetdry>) + (aout1 * 4 * (1 - <Granularize_wetdry>))
aout2 = (ain2 * <Granularize_wetdry>) + (aout2 * 4 * (1 - <Granularize_wetdry>))
else
aout1 = ain1
aout2 = ain2
endif
</code>
<comments>
DESCRIPTION:
Granularize a signal using the grain3 opcode. It generates granular synthesis textures with more user control.
CONTROLLERS:
ON/OFF - bypass
duration - grain duration in seconds
density fine/coarse - fine and coarse number of grains per second
pitch multiplier - multiplies the grain frequency in Hz
pitch dist. - controls the distribution of grain frequency variation
freq. variation fine/coarse - fine and coarse random variation (bipolar) in grain frequency in Hz
phase random - random variation (bipolar) in start phase
phase distribution - controls the distribution of grain frequency variation
mix - mix direct signal with effect
---
version 1.11, May 2020
- added comments on controllers
version 1.1, 2018
- new GUI and small code adaptations by Menno Knevel
version 1.0, 2008?
- initial version by mbechard
</comments>
<opcodeList/>
<graphicInterface editEnabled='false'>
<gridSettings>
<width>5</width>
<height>5</height>
<gridStyle>NONE</gridStyle>
<snapGridEnabled>true</snapGridEnabled>
</gridSettings>
<bsbObject type='blue.orchestra.blueSynthBuilder.BSBGroup'>
<objectName></objectName>
<x>0</x>
<y>0</y>
<groupName>Group</groupName>
<backgroundColor>0x00000033</backgroundColor>
<borderColor>0x000000ff</borderColor>
<labelTextColor>0xffffffff</labelTextColor>
<titleEnabled>true</titleEnabled>
<width>20</width>
<height>20</height>
<bsbObject type='blue.orchestra.blueSynthBuilder.BSBCheckBox'>
<objectName>GranularizeON</objectName>
<x>0</x>
<y>0</y>
<automationAllowed>true</automationAllowed>
<label/>
<selected>true</selected>
<randomizable>true</randomizable>
</bsbObject>
<bsbObject type='blue.orchestra.blueSynthBuilder.BSBGroup'>
<objectName></objectName>
<x>10</x>
<y>10</y>
<groupName>Group</groupName>
<backgroundColor>0x4d8080ff</backgroundColor>
<borderColor>0x000000ff</borderColor>
<labelTextColor>0xffffffff</labelTextColor>
<titleEnabled>false</titleEnabled>
<width>20</width>
<height>20</height>
<bsbObject type='blue.orchestra.blueSynthBuilder.BSBGroup'>
<objectName></objectName>
<x>275</x>
<y>10</y>
<groupName>pitch</groupName>
<backgroundColor>0x00000033</backgroundColor>
<borderColor>0x000000ff</borderColor>
<labelTextColor>0xffffffff</labelTextColor>
<titleEnabled>true</titleEnabled>
<width>20</width>
<height>20</height>
<bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
<objectName>Granularize_freq Mult</objectName>
<x>10</x>
<y>0</y>
<automationAllowed>true</automationAllowed>
<minimum>0.0</minimum>
<maximum>4.0</maximum>
<value>1.0005438</value>
<knobWidth>40</knobWidth>
<randomizable>true</randomizable>
<valueDisplayEnabled>true</valueDisplayEnabled>
<label>muliplier</label>
<labelEnabled>true</labelEnabled>
<font>
<name>System Regular</name>
<size>12.0</size>
</font>
</bsbObject>
<bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
<objectName>Granularize_FM distribution</objectName>
<x>65</x>
<y>0</y>
<automationAllowed>true</automationAllowed>
<minimum>-2.0</minimum>
<maximum>2.0</maximum>
<value>-0.3909154</value>
<knobWidth>40</knobWidth>
<randomizable>false</randomizable>
<valueDisplayEnabled>true</valueDisplayEnabled>
<label>distribution</label>
<labelEnabled>true</labelEnabled>
<font>
<name>System Regular</name>
<size>12.0</size>
</font>
</bsbObject>
</bsbObject>
<bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
<objectName>Granularize_duration</objectName>
<x>19</x>
<y>16</y>
<automationAllowed>true</automationAllowed>
<minimum>0.005</minimum>
<maximum>2.0</maximum>
<value>0.15581608482499998</value>
<knobWidth>40</knobWidth>
<randomizable>true</randomizable>
<valueDisplayEnabled>true</valueDisplayEnabled>
<label>duration</label>
<labelEnabled>true</labelEnabled>
<font>
<name>System Regular</name>
<size>12.0</size>
</font>
</bsbObject>
<bsbObject type='blue.orchestra.blueSynthBuilder.BSBGroup'>
<objectName></objectName>
<x>660</x>
<y>10</y>
<groupName>phase</groupName>
<backgroundColor>0x00000033</backgroundColor>
<borderColor>0x000000ff</borderColor>
<labelTextColor>0xffffffff</labelTextColor>
<titleEnabled>true</titleEnabled>
<width>20</width>
<height>20</height>
<bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
<objectName>Granularize_phase</objectName>
<x>10</x>
<y>0</y>
<automationAllowed>true</automationAllowed>
<minimum>0.0</minimum>
<maximum>1.0</maximum>
<value>0.1048207</value>
<knobWidth>40</knobWidth>
<randomizable>true</randomizable>
<valueDisplayEnabled>true</valueDisplayEnabled>
<label>random</label>
<labelEnabled>true</labelEnabled>
<font>
<name>System Regular</name>
<size>12.0</size>
</font>
</bsbObject>
<bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
<objectName>Granularize_phase distribution</objectName>
<x>65</x>
<y>0</y>
<automationAllowed>true</automationAllowed>
<minimum>-2.0</minimum>
<maximum>2.0</maximum>
<value>-2.0</value>
<knobWidth>40</knobWidth>
<randomizable>true</randomizable>
<valueDisplayEnabled>true</valueDisplayEnabled>
<label>distribution</label>
<labelEnabled>true</labelEnabled>
<font>
<name>System Regular</name>
<size>12.0</size>
</font>
</bsbObject>
</bsbObject>
<bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel' version='2'>
<objectName></objectName>
<x>89</x>
<y>46</y>
<label>Num. of grains p/s</label>
<font>
<name>System Regular</name>
<size>12.0</size>
</font>
</bsbObject>
<bsbObject type='blue.orchestra.blueSynthBuilder.BSBHSlider' version='2'>
<objectName>Granularize_density coarse</objectName>
<x>70</x>
<y>55</y>
<automationAllowed>true</automationAllowed>
<minimum>0.0</minimum>
<maximum>2000.0</maximum>
<bdresolution>1E+2</bdresolution>
<value>500.0</value>
<sliderWidth>150</sliderWidth>
<randomizable>true</randomizable>
<valueDisplayEnabled>true</valueDisplayEnabled>
</bsbObject>
<bsbObject type='blue.orchestra.blueSynthBuilder.BSBVSlider' version='2'>
<objectName>Granularize_wetdry</objectName>
<x>805</x>
<y>35</y>
<automationAllowed>true</automationAllowed>
<minimum>0.0</minimum>
<maximum>1.0</maximum>
<bdresolution>0.1</bdresolution>
<value>0.5</value>
<sliderHeight>70</sliderHeight>
<randomizable>true</randomizable>
<valueDisplayEnabled>false</valueDisplayEnabled>
</bsbObject>
<bsbObject type='blue.orchestra.blueSynthBuilder.BSBGroup'>
<objectName></objectName>
<x>420</x>
<y>10</y>
<groupName>frequency variation</groupName>
<backgroundColor>0x00000033</backgroundColor>
<borderColor>0x000000ff</borderColor>
<labelTextColor>0xffffffff</labelTextColor>
<titleEnabled>true</titleEnabled>
<width>20</width>
<height>20</height>
<bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
<objectName>Granularize_FM fine</objectName>
<x>15</x>
<y>0</y>
<automationAllowed>true</automationAllowed>
<minimum>0.0</minimum>
<maximum>1.0</maximum>
<value>0.03121192</value>
<knobWidth>40</knobWidth>
<randomizable>true</randomizable>
<valueDisplayEnabled>true</valueDisplayEnabled>
<label>fine</label>
<labelEnabled>true</labelEnabled>
<font>
<name>System Regular</name>
<size>12.0</size>
</font>
</bsbObject>
<bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel' version='2'>
<objectName></objectName>
<x>105</x>
<y>25</y>
<label>coarse</label>
<font>
<name>System Regular</name>
<size>12.0</size>
</font>
</bsbObject>
<bsbObject type='blue.orchestra.blueSynthBuilder.BSBHSlider' version='2'>
<objectName>Granularize_FM coarse</objectName>
<x>60</x>
<y>30</y>
<automationAllowed>true</automationAllowed>
<minimum>0.0</minimum>
<maximum>2000.0</maximum>
<bdresolution>1</bdresolution>
<value>0.0</value>
<sliderWidth>120</sliderWidth>
<randomizable>true</randomizable>
<valueDisplayEnabled>true</valueDisplayEnabled>
</bsbObject>
</bsbObject>
<bsbObject type='blue.orchestra.blueSynthBuilder.BSBHSlider' version='2'>
<objectName>Granularize_density fine</objectName>
<x>70</x>
<y>25</y>
<automationAllowed>true</automationAllowed>
<minimum>0.0</minimum>
<maximum>100.0</maximum>
<bdresolution>1</bdresolution>
<value>30.0</value>
<sliderWidth>150</sliderWidth>
<randomizable>true</randomizable>
<valueDisplayEnabled>true</valueDisplayEnabled>
</bsbObject>
<bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel' version='2'>
<objectName></objectName>
<x>810</x>
<y>20</y>
<label>mix</label>
<font>
<name>System Regular</name>
<size>12.0</size>
</font>
</bsbObject>
</bsbObject>
</bsbObject>
</graphicInterface>
<parameterList>
<parameter uniqueId='-316918042' name='Granularize_phase' label='' min='0.0' max='1.0' bdresolution='-1' automationEnabled='false' value='0.1048207'>
<line name='' version='2' max='1.0' min='0.0' bdresolution='-1' color='-8355712' rightBound='false' endPointsLinked='false'>
<linePoint x='0.0' y='0.1048207'/>
</line>
</parameter>
<parameter uniqueId='-316918040' name='Granularize_phase distribution' label='' min='-2.0' max='2.0' bdresolution='-1' automationEnabled='false' value='-2.0'>
<line name='' version='2' max='2.0' min='-2.0' bdresolution='-1' color='-8355712' rightBound='false' endPointsLinked='false'>
<linePoint x='0.0' y='-2.0'/>
</line>
</parameter>
<parameter uniqueId='-316918038' name='Granularize_duration' label='' min='0.005' max='2.0' bdresolution='-1' automationEnabled='false' value='0.15581608482499998'>
<line name='' version='2' max='2.0' min='0.005' bdresolution='-1' color='-8355712' rightBound='false' endPointsLinked='false'>
<linePoint x='0.0' y='0.15581608482499998'/>
</line>
</parameter>
<parameter uniqueId='-316918034' name='Granularize_density fine' label='' min='0.0' max='100.0' bdresolution='1' automationEnabled='false' value='30.0'>
<line name='' version='2' max='100.0' min='0.0' bdresolution='1' color='-8355712' rightBound='false' endPointsLinked='false'>
<linePoint x='0.0' y='30.0'/>
</line>
</parameter>
<parameter uniqueId='-316918032' name='Granularize_FM fine' label='' min='0.0' max='1.0' bdresolution='-1' automationEnabled='false' value='0.03121192'>
<line name='' version='2' max='1.0' min='0.0' bdresolution='-1' color='-8355712' rightBound='false' endPointsLinked='false'>
<linePoint x='0.0' y='0.03121192'/>
</line>
</parameter>
<parameter uniqueId='-316918030' name='Granularize_FM coarse' label='' min='0.0' max='2000.0' bdresolution='1' automationEnabled='false' value='0.0'>
<line name='' version='2' max='2000.0' min='0.0' bdresolution='1' color='-8355712' rightBound='false' endPointsLinked='false'>
<linePoint x='0.0' y='0.0'/>
</line>
</parameter>
<parameter uniqueId='-316918028' name='Granularize_wetdry' label='' min='0.0' max='1.0' bdresolution='0.1' automationEnabled='false' value='0.5'>
<line name='' version='2' max='1.0' min='0.0' bdresolution='0.1' color='-8355712' rightBound='false' endPointsLinked='false'>
<linePoint x='0.0' y='0.5'/>
</line>
</parameter>
<parameter uniqueId='-316918026' name='Granularize_freq Mult' label='' min='0.0' max='4.0' bdresolution='-1' automationEnabled='false' value='1.0005438'>
<line name='' version='2' max='4.0' min='0.0' bdresolution='-1' color='-8355712' rightBound='false' endPointsLinked='false'>
<linePoint x='0.0' y='1.0005438'/>
</line>
</parameter>
<parameter uniqueId='-316918024' name='Granularize_FM distribution' label='' min='-2.0' max='2.0' bdresolution='-1' automationEnabled='false' value='-0.3909154'>
<line name='' version='2' max='2.0' min='-2.0' bdresolution='-1' color='-8355712' rightBound='false' endPointsLinked='false'>
<linePoint x='0.0' y='-0.3909154'/>
</line>
</parameter>
<parameter uniqueId='-316918022' name='Granularize_density coarse' label='' min='0.0' max='2000.0' bdresolution='1E+2' automationEnabled='false' value='500.0'>
<line name='' version='2' max='2000.0' min='0.0' bdresolution='1E+2' color='-8355712' rightBound='false' endPointsLinked='false'>
<linePoint x='0.0' y='500.0'/>
</line>
</parameter>
<parameter uniqueId='-104104219' name='GranularizeON' label='' min='0.0' max='1.0' bdresolution='1' automationEnabled='false' value='1.0'>
<line name='' version='2' max='1.0' min='0.0' bdresolution='1' color='-8355712' rightBound='false' endPointsLinked='false'>
<linePoint x='0.0' y='1.0'/>
</line>
</parameter>
</parameterList>
</effect>