synthesizer 3.3.1 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -0
  3. data/examples/{metronome.rb → audio_input_metronome.rb} +8 -2
  4. data/examples/{step_editor.rb → audio_input_step_editor.rb} +10 -2
  5. data/examples/filter_band_pass.rb +73 -0
  6. data/examples/{lpf.rb → filter_serial.rb} +9 -2
  7. data/examples/oscillator_pan.rb +70 -0
  8. data/examples/{formant_vocoder.rb → oscillator_source_formant_vocoder.rb} +9 -2
  9. data/examples/{formant_vocoder_sweep.rb → oscillator_source_formant_vocoder_sweep.rb} +10 -3
  10. data/examples/{sync.rb → oscillator_sync.rb} +11 -3
  11. data/examples/oscillator_unison.rb +64 -0
  12. data/examples/oscillator_volume.rb +70 -0
  13. data/examples/{mono.rb → synth_mono.rb} +10 -2
  14. data/examples/{poly.rb → synth_poly.rb} +10 -2
  15. data/{examples → jupyter}/adsr.ipynb +20 -17
  16. data/jupyter/curves.ipynb +103 -0
  17. data/jupyter/shapes.ipynb +111 -0
  18. data/lib/audio_stream/audio_input_metronome.rb +1 -1
  19. data/lib/synthesizer/modulation/adsr.rb +12 -11
  20. data/lib/synthesizer/modulation/glide.rb +2 -2
  21. data/lib/synthesizer/modulation/lfo.rb +8 -8
  22. data/lib/synthesizer/oscillator.rb +9 -9
  23. data/lib/synthesizer/oscillator_source/formant_vocoder.rb +3 -2
  24. data/lib/synthesizer/shape.rb +4 -4
  25. data/lib/synthesizer/version.rb +1 -1
  26. data/samples/cinema.rb +730 -0
  27. data/samples/cinema_drum.wav +0 -0
  28. data/samples/daijoubu.rb +811 -0
  29. data/samples/daijoubu_drum.wav +0 -0
  30. data/samples/kira_power.rb +987 -0
  31. data/samples/kira_power_drum.wav +0 -0
  32. data/synthesizer.gemspec +1 -1
  33. metadata +29 -19
  34. data/examples/curves.ipynb +0 -105
  35. data/examples/shapes.ipynb +0 -116
@@ -0,0 +1,987 @@
1
+ $LOAD_PATH << File.dirname(__FILE__) + "/../lib"
2
+ $LOAD_PATH << File.dirname(__FILE__) + "/../../ruby-audio_stream/lib"
3
+
4
+ require 'synthesizer'
5
+ require 'audio_stream'
6
+
7
+ include AudioStream
8
+ include AudioStream::Fx
9
+ include Synthesizer
10
+
11
+
12
+ class KiraPower
13
+ def initialize
14
+ @soundinfo = SoundInfo.new(
15
+ channels: 2,
16
+ samplerate: 44100,
17
+ window_size: 1024,
18
+ format: RubyAudio::FORMAT_WAV|RubyAudio::FORMAT_PCM_16,
19
+ bpm: 139.0
20
+ )
21
+
22
+ @default_amp = Amplifier.new(
23
+ volume: ModulationValue.new(1.0)
24
+ .add(Modulation::Adsr.new(
25
+ attack: Rate.sec(0.05),
26
+ hold: Rate.sec(0.1),
27
+ decay: Rate.sec(0.4),
28
+ sustain: 0.8,
29
+ release: Rate.sec(0.3)
30
+ ), depth: 1.0),
31
+ )
32
+
33
+ @vocal_vibrato = Modulation::Lfo.new(
34
+ shape: Shape::Sine,
35
+ delay: Rate.sec(0.0),
36
+ attack: Rate::SYNC_1_8D,
37
+ attack_curve: Modulation::Curve::EaseIn,
38
+ phase: 0.0,
39
+ rate: Rate::SYNC_1_8
40
+ )
41
+
42
+
43
+ @inputs = {
44
+ vocal1: create_vocal1,
45
+ vocal2: create_vocal2,
46
+ chorus: create_chorus,
47
+ chord: create_chord,
48
+ slow_chord: create_slow_chord,
49
+ arpeggio1: create_arpeggio1,
50
+ arpeggio2: create_arpeggio2,
51
+ bass: create_bass,
52
+ dub1: create_dub1,
53
+ dub2: create_dub2,
54
+ white_noise: create_white_noise,
55
+ drum: AudioInput.file(File.dirname(__FILE__)+"/kira_power_drum.wav", soundinfo: @soundinfo)
56
+ }
57
+
58
+ #@output = AudioOutput.device(soundinfo: @soundinfo)
59
+ @output = AudioOutput.file(File.dirname(__FILE__)+"/output_kira_power.wav", soundinfo: @soundinfo)
60
+ end
61
+
62
+ def create_vocal1
63
+ synth = MonoSynth.new(
64
+ oscillators: [
65
+ Oscillator.new(
66
+ source: OscillatorSource::TriangleSquare.instance,
67
+ tune_cents: ModulationValue.new(0.0)
68
+ .add(@vocal_vibrato, depth: 30.0)
69
+ ),
70
+ ],
71
+ filter: Filter::Serial.new(
72
+ Filter::BandPassFilter.new(freq: 2600, bandwidth: 2.0)
73
+ ),
74
+ amplifier: @default_amp,
75
+ soundinfo: @soundinfo,
76
+ )
77
+
78
+ se = StepEditor::StGt.new(bpm: @soundinfo.bpm) {|se|
79
+ se.step(480*4)
80
+
81
+ se.step(480*2)
82
+ se.step(240)
83
+ se.note(Note.create(:"D#", 5), gt: 1)
84
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
85
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
86
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
87
+ se.note(Note.create(:"D#", 5), gt: 1)
88
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
89
+ se.note(Note.create(:"D#", 5), st: 120, gt: 120)
90
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
91
+ se.note(Note.create(:"F#", 5), st: 240, gt: 240)
92
+ se.note(Note.create(:"F#", 5), gt: 1)
93
+ se.note(Note.create(:"G#", 5), st: 600, gt: 600)
94
+ se.step(480)
95
+
96
+ se.step(480*2)
97
+ se.step(240)
98
+ se.note(Note.create(:"D#", 5), gt: 1)
99
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
100
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
101
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
102
+ se.note(Note.create(:"G#", 5), gt: 1)
103
+ se.note(Note.create(:A, 5), st: 240, gt: 240)
104
+ se.note(Note.create(:"G#", 5), st: 120, gt: 120)
105
+ se.note(Note.create(:"F#", 5), st: 240, gt: 240)
106
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
107
+ se.note(Note.create(:"D#", 5), gt: 1)
108
+ se.note(Note.create(:E, 5), st: 600, gt: 600)
109
+ se.step(480)
110
+
111
+ se.step(480*2)
112
+ se.step(240)
113
+ se.note(Note.create(:"D#", 5), gt: 1)
114
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
115
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
116
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
117
+ se.note(Note.create(:"D#", 5), gt: 1)
118
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
119
+ se.note(Note.create(:"D#", 5), st: 120, gt: 120)
120
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
121
+ se.note(Note.create(:"F#", 5), st: 240, gt: 240)
122
+ se.note(Note.create(:"F#", 5), gt: 1)
123
+ se.note(Note.create(:"G#", 5), st: 480, gt: 480)
124
+ se.step(120)
125
+
126
+ se.note(Note.create(:"G#", 5), gt: 1)
127
+ se.note(Note.create(:A, 5), st: 480, gt: 480)
128
+ se.note(Note.create(:A, 5), gt: 1)
129
+ se.note(Note.create(:B, 5), st: 360, gt: 360)
130
+ se.note(Note.create(:E, 5), st: 360, gt: 360)
131
+ se.note(Note.create(:E, 5), st: 480, gt: 480)
132
+ se.note(Note.create(:"D#", 5), gt: 1)
133
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
134
+ se.note(Note.create(:"F#", 5), st: 240, gt: 240)
135
+ se.note(Note.create(:E, 5), st: 720, gt: 720)
136
+ se.step(240)
137
+
138
+ se.note(Note.create(:B, 4), st: 240, gt: 240)
139
+ se.note(Note.create(:E, 5), st: 360, gt: 360)
140
+ se.note(Note.create(:E, 5), gt: 1)
141
+ se.note(Note.create(:"F#", 5), st: 360, gt: 360)
142
+ se.note(Note.create(:"F#", 5), st: 2160, gt: 2160)
143
+
144
+ se.step(480*4)
145
+
146
+ se.complete
147
+ }
148
+
149
+ AudioInputStepEditor.new(synth, se)
150
+ end
151
+
152
+ def create_vocal2
153
+ synth = MonoSynth.new(
154
+ oscillators: [
155
+ Oscillator.new(
156
+ source: OscillatorSource::TriangleSquare.instance,
157
+ tune_cents: ModulationValue.new(0.0)
158
+ .add(@vocal_vibrato, depth: 30.0),
159
+ uni_num: 2,
160
+ uni_detune: 0.03,
161
+ uni_stereo: 0.4,
162
+ ),
163
+ ],
164
+ filter: Filter::Serial.new(
165
+ Filter::BandPassFilter.new(freq: 2400, bandwidth: 2.0)
166
+ ),
167
+ amplifier: @default_amp,
168
+ soundinfo: @soundinfo,
169
+ )
170
+
171
+ se = StepEditor::StGt.new(bpm: @soundinfo.bpm) {|se|
172
+ se.step(480*4)
173
+
174
+ se.step(480*2)
175
+ se.step(240)
176
+ se.note(Note.create(:B, 4), gt: 1)
177
+ se.note(Note.create(:"C#", 5), st: 240, gt: 240)
178
+ se.note(Note.create(:"C#", 5), st: 240, gt: 240)
179
+ se.note(Note.create(:"C#", 5), st: 240, gt: 240)
180
+ se.note(Note.create(:B, 4), gt: 1)
181
+ se.note(Note.create(:"C#", 5), st: 240, gt: 240)
182
+ se.note(Note.create(:B, 4), st: 120, gt: 120)
183
+ se.note(Note.create(:"C#", 5), st: 240, gt: 240)
184
+ se.note(Note.create(:"D#", 5), st: 240, gt: 240)
185
+ se.note(Note.create(:"D#", 5), gt: 1)
186
+ se.note(Note.create(:E, 5), st: 600, gt: 600)
187
+ se.step(480)
188
+
189
+ se.step(480*2)
190
+ se.step(240)
191
+ se.note(Note.create(:B, 4), gt: 1)
192
+ se.note(Note.create(:"C#", 5), st: 240, gt: 240)
193
+ se.note(Note.create(:"C#", 5), st: 240, gt: 240)
194
+ se.note(Note.create(:"C#", 5), st: 240, gt: 240)
195
+ se.note(Note.create(:E, 5), gt: 1)
196
+ se.note(Note.create(:"F#", 5), st: 240, gt: 240)
197
+ se.note(Note.create(:E, 5), st: 120, gt: 120)
198
+ se.note(Note.create(:"D#", 5), st: 240, gt: 240)
199
+ se.note(Note.create(:"C#", 5), st: 240, gt: 240)
200
+ se.note(Note.create(:B, 4), gt: 1)
201
+ se.note(Note.create(:"C#", 5), st: 600, gt: 600)
202
+ se.step(480)
203
+
204
+ se.step(480*2)
205
+ se.step(240)
206
+ se.note(Note.create(:B, 4), gt: 1)
207
+ se.note(Note.create(:"C#", 5), st: 240, gt: 240)
208
+ se.note(Note.create(:"C#", 5), st: 240, gt: 240)
209
+ se.note(Note.create(:"C#", 5), st: 240, gt: 240)
210
+ se.note(Note.create(:B, 4), gt: 1)
211
+ se.note(Note.create(:"C#", 5), st: 240, gt: 240)
212
+ se.note(Note.create(:B, 4), st: 120, gt: 120)
213
+ se.note(Note.create(:"C#", 5), st: 240, gt: 240)
214
+ se.note(Note.create(:"D#", 5), st: 240, gt: 240)
215
+ se.note(Note.create(:"D#", 5), gt: 1)
216
+ se.note(Note.create(:E, 5), st: 480, gt: 480)
217
+ se.step(120)
218
+
219
+ se.note(Note.create(:E, 5), gt: 1)
220
+ se.note(Note.create(:"F#", 5), st: 480, gt: 480)
221
+ se.note(Note.create(:"F#", 5), gt: 1)
222
+ se.note(Note.create(:"G#", 5), st: 360, gt: 360)
223
+ se.note(Note.create(:"C#", 5), st: 360, gt: 360)
224
+ se.note(Note.create(:"C#", 5), st: 480, gt: 480)
225
+ se.note(Note.create(:B, 4), gt: 1)
226
+ se.note(Note.create(:"C#", 5), st: 240, gt: 240)
227
+ se.note(Note.create(:"D#", 5), st: 240, gt: 240)
228
+ se.note(Note.create(:B, 4), st: 720, gt: 720)
229
+ se.step(240)
230
+
231
+ se.note(Note.create(:"G#", 4), st: 240, gt: 240)
232
+ se.note(Note.create(:"C#", 5), st: 360, gt: 360)
233
+ se.note(Note.create(:"D#", 5), gt: 1)
234
+ se.note(Note.create(:E, 5), st: 360, gt: 360)
235
+ se.note(Note.create(:E, 5), st: 2160, gt: 2160)
236
+
237
+ se.complete
238
+ }
239
+
240
+ AudioInputStepEditor.new(synth, se)
241
+ end
242
+
243
+ def create_chorus
244
+ synth = PolySynth.new(
245
+ oscillators: [
246
+ Oscillator.new(
247
+ source: OscillatorSource::TriangleSquare.instance,
248
+ uni_num: 6,
249
+ uni_detune: 0.12,
250
+ uni_stereo: 1.0,
251
+ ),
252
+ ],
253
+ filter: Filter::Serial.new(
254
+ Filter::HighShelfFilter.new(freq: 1000, gain: 2.0)
255
+ ),
256
+ amplifier: @default_amp,
257
+ soundinfo: @soundinfo,
258
+ )
259
+
260
+ se = StepEditor::StGt.new(bpm: @soundinfo.bpm) {|se|
261
+ se.step(480*3)
262
+ se.note(Note.create(:"G#", 4), gt: 480)
263
+ se.note(Note.create(:B, 4), gt: 480)
264
+ se.note(Note.create(:E, 5), st: 480, gt: 480)
265
+ se.note(Note.create(:E, 5), gt: 1920)
266
+ se.note(Note.create(:"G#", 5), gt: 1920)
267
+ se.note(Note.create(:B, 5), st: 1920, gt: 1920)
268
+
269
+ se.step(480*3)
270
+ se.note(Note.create(:"G#", 4), gt: 480)
271
+ se.note(Note.create(:B, 4), gt: 480)
272
+ se.note(Note.create(:E, 5), st: 480, gt: 480)
273
+ se.note(Note.create(:E, 5), gt: 720)
274
+ se.note(Note.create(:"G#", 5), gt: 720)
275
+ se.note(Note.create(:B, 5), st: 720, gt: 720)
276
+ se.note(Note.create(:"F#", 5), gt: 120)
277
+ se.note(Note.create(:A, 5), gt: 120)
278
+ se.note(Note.create(:"C#", 6), st: 120, gt: 120)
279
+ se.note(Note.create(:E, 5), gt: 1080)
280
+ se.note(Note.create(:"G#", 5), gt: 1080)
281
+ se.note(Note.create(:B, 5), st: 1080, gt: 1080)
282
+
283
+ se.step(480*3)
284
+ se.note(Note.create(:"G#", 4), gt: 480)
285
+ se.note(Note.create(:B, 4), gt: 480)
286
+ se.note(Note.create(:E, 5), st: 480, gt: 480)
287
+ se.note(Note.create(:E, 5), gt: 1920)
288
+ se.note(Note.create(:"G#", 5), gt: 1920)
289
+ se.note(Note.create(:B, 5), st: 1920, gt: 1920)
290
+
291
+ se.complete
292
+ }
293
+
294
+ AudioInputStepEditor.new(synth, se)
295
+ end
296
+
297
+ def create_chord
298
+ synth = PolySynth.new(
299
+ oscillators: [
300
+ Oscillator.new(
301
+ source: OscillatorSource::TriangleSquare.instance,
302
+ sync: 2.0,
303
+ uni_num: 4,
304
+ uni_detune: 0.05,
305
+ uni_stereo: 0.9,
306
+ ),
307
+ ],
308
+ filter: Filter::Serial.new(
309
+ Filter::HighShelfFilter.new(freq: 2100, gain: 2.0)
310
+ ),
311
+ amplifier: Amplifier.new(
312
+ volume: ModulationValue.new(1.0)
313
+ .add(Modulation::Adsr.new(
314
+ attack: Rate.sec(0.05),
315
+ hold: Rate.sec(0.0),
316
+ decay: Rate.sec(0.1),
317
+ sustain: 0.8,
318
+ release: Rate.sec(0.05)
319
+ ), depth: 1.0),
320
+ ),
321
+ soundinfo: @soundinfo,
322
+ )
323
+
324
+ se = StepEditor::StGt.new(bpm: @soundinfo.bpm) {|se|
325
+ se.step(480)
326
+ se.step(240)
327
+
328
+ #se.note(Note.create(:E, 4), gt: 720)
329
+ #se.note(Note.create(:"G#", 4), gt: 720)
330
+ #se.note(Note.create(:B, 4), st: 1200, gt: 720)
331
+ se.step(1200)
332
+
333
+ se.note(Note.create(:B, 3), gt: 300)
334
+ se.note(Note.create(:E, 4), gt: 300)
335
+ se.note(Note.create(:"G#", 4), gt: 300)
336
+ se.note(Note.create(:B, 4), st: 360, gt: 300)
337
+ se.note(Note.create(:B, 3), gt: 120)
338
+ se.note(Note.create(:E, 4), gt: 120)
339
+ se.note(Note.create(:"G#", 4), gt: 120)
340
+ se.note(Note.create(:B, 4), st: 120, gt: 120)
341
+ se.step(480*3)
342
+
343
+ se.note(Note.create(:B, 3), gt: 300)
344
+ se.note(Note.create(:E, 4), gt: 300)
345
+ se.note(Note.create(:A, 4), gt: 300)
346
+ se.note(Note.create(:B, 4), st: 360, gt: 300)
347
+ se.note(Note.create(:B, 3), gt: 120)
348
+ se.note(Note.create(:E, 4), gt: 120)
349
+ se.note(Note.create(:A, 4), gt: 120)
350
+ se.note(Note.create(:B, 4), st: 120, gt: 120)
351
+ se.step(480*3)
352
+
353
+ se.note(Note.create(:B, 3), gt: 300)
354
+ se.note(Note.create(:E, 4), gt: 300)
355
+ se.note(Note.create(:"G#", 4), gt: 300)
356
+ se.note(Note.create(:B, 4), st: 360, gt: 300)
357
+ se.note(Note.create(:B, 3), gt: 120)
358
+ se.note(Note.create(:E, 4), gt: 120)
359
+ se.note(Note.create(:"G#", 4), gt: 120)
360
+ se.note(Note.create(:B, 4), st: 120, gt: 120)
361
+ se.step(480*3)
362
+
363
+ se.note(Note.create(:B, 3), gt: 300)
364
+ se.note(Note.create(:E, 4), gt: 300)
365
+ se.note(Note.create(:A, 4), gt: 300)
366
+ se.note(Note.create(:B, 4), st: 360, gt: 300)
367
+ se.note(Note.create(:B, 3), gt: 120)
368
+ se.note(Note.create(:E, 4), gt: 120)
369
+ se.note(Note.create(:A, 4), gt: 120)
370
+ se.note(Note.create(:B, 4), st: 240, gt: 120)
371
+ se.note(Note.create(:B, 3), gt: 60)
372
+ se.note(Note.create(:E, 4), gt: 60)
373
+ se.note(Note.create(:A, 4), gt: 60)
374
+ se.note(Note.create(:B, 4), st: 360, gt: 60)
375
+ se.step(480*2)
376
+
377
+ se.step(480*4)
378
+
379
+ se.note(Note.create(:B, 3), gt: 300)
380
+ se.note(Note.create(:E, 4), gt: 300)
381
+ se.note(Note.create(:A, 4), gt: 300)
382
+ se.note(Note.create(:B, 4), st: 360, gt: 300)
383
+ se.note(Note.create(:B, 3), gt: 120)
384
+ se.note(Note.create(:E, 4), gt: 120)
385
+ se.note(Note.create(:A, 4), gt: 120)
386
+ se.note(Note.create(:B, 4), st: 120, gt: 120)
387
+ se.step(480*3)
388
+
389
+ se.note(Note.create(:E, 4), gt: 300)
390
+ se.note(Note.create(:"G#", 4), gt: 300)
391
+ se.note(Note.create(:B, 4), st: 360, gt: 300)
392
+ se.note(Note.create(:E, 4), gt: 120)
393
+ se.note(Note.create(:"G#", 4), gt: 120)
394
+ se.note(Note.create(:B, 4), st: 360, gt: 120)
395
+ se.note(Note.create(:E, 4), gt: 480)
396
+ se.note(Note.create(:A, 4), gt: 480)
397
+ se.note(Note.create(:"C#", 5), st: 480, gt: 480)
398
+ se.note(Note.create(:E, 4), gt: 240)
399
+ se.note(Note.create(:"G#", 4), gt: 240)
400
+ se.note(Note.create(:B, 4), st: 240, gt: 240)
401
+ se.note(Note.create(:E, 4), gt: 240)
402
+ se.note(Note.create(:A, 4), gt: 240)
403
+ se.note(Note.create(:"C#", 5), st: 240, gt: 240)
404
+ se.note(Note.create(:E, 4), gt: 960)
405
+ se.note(Note.create(:G, 4), gt: 960)
406
+ se.note(Note.create(:B, 4), gt: 960)
407
+ se.note(Note.create(:E, 5), st: 960, gt: 960)
408
+
409
+ se.note(Note.create(:E, 4), gt: 80)
410
+ se.note(Note.create(:B, 4), st: 80, gt: 80)
411
+ se.note(Note.create(:"F#", 4), gt: 80)
412
+ se.note(Note.create(:"C#", 5), st: 80, gt: 80)
413
+ se.note(Note.create(:"G#", 4), gt: 80)
414
+ se.note(Note.create(:D, 5), st: 80, gt: 80)
415
+ se.note(Note.create(:D, 4), gt: 360)
416
+ se.note(Note.create(:A, 4), gt: 360)
417
+ se.note(Note.create(:E, 5), st: 360, gt: 360)
418
+ se.note(Note.create(:E, 4), gt: 240)
419
+ se.note(Note.create(:B, 4), gt: 240)
420
+ se.note(Note.create(:"F#", 5), st: 360, gt: 240)
421
+ se.note(Note.create(:B, 3), gt: 240+480*4)
422
+ se.note(Note.create(:E, 4), gt: 240+480*4)
423
+ se.note(Note.create(:"F#", 4), gt: 240+480*4)
424
+ se.note(Note.create(:B, 4), gt: 240+480*4)
425
+ se.note(Note.create(:"F#", 5), st: 240+480*4, gt: 240+480*4)
426
+
427
+ se.step(480*4)
428
+
429
+ se.complete
430
+ }
431
+
432
+ AudioInputStepEditor.new(synth, se)
433
+ end
434
+
435
+ def create_slow_chord
436
+ synth = PolySynth.new(
437
+ oscillators: [
438
+ Oscillator.new(
439
+ source: OscillatorSource::SineSquare.instance,
440
+ uni_num: 4,
441
+ uni_detune: -0.23,
442
+ uni_stereo: 1.0,
443
+ ),
444
+ Oscillator.new(
445
+ source: OscillatorSource::SineSquare.instance,
446
+ tune_semis: -12,
447
+ uni_num: 4,
448
+ uni_detune: -0.23,
449
+ uni_stereo: 1.0,
450
+ ),
451
+ ],
452
+ filter: Filter::Serial.new(
453
+ Filter::HighPassFilter.new(freq: 400, q: Filter::DEFAULT_Q),
454
+ Filter::LowShelfFilter.new(freq: 2200, gain: 1.0),
455
+ Filter::LowPassFilter.new(
456
+ freq: ModulationValue.new(50.0)
457
+ .add(Modulation::Adsr.new(
458
+ attack: Rate::SYNC_1_8D,
459
+ attack_curve: Modulation::Curve::EaseIn2,
460
+ hold: Rate::SYNC_1_16,
461
+ decay: Rate::SYNC_1_16,
462
+ sustain: 1.0,
463
+ release: Rate.sec(10.0),
464
+ release_curve: Modulation::Curve::EaseIn2,
465
+ ), depth: 5000.0),
466
+ q: Filter::DEFAULT_Q
467
+ ),
468
+ ),
469
+ amplifier: Amplifier.new(
470
+ volume: ModulationValue.new(1.0)
471
+ .add(Modulation::Adsr.new(
472
+ attack: Rate.sec(0.05),
473
+ hold: Rate.sec(0.1),
474
+ decay: Rate.sec(0.4),
475
+ sustain: 0.8,
476
+ release: Rate.sec(0.0)
477
+ ), depth: 1.0),
478
+ ),
479
+ soundinfo: @soundinfo,
480
+ )
481
+
482
+ se = StepEditor::StGt.new(bpm: @soundinfo.bpm) {|se|
483
+ se.step(480*4)
484
+ se.step(480*4)
485
+ se.step(480*4)
486
+ se.step(480*4)
487
+
488
+ se.step(480)
489
+ se.note(Note.create(:B, 3), gt: 480)
490
+ se.note(Note.create(:E, 4), gt: 480)
491
+ se.note(Note.create(:A, 4), st: 480, gt: 480)
492
+ se.step(480*2)
493
+
494
+ se.note(Note.create(:"C#", 4), gt: 480*2, vel: 0.7)
495
+ se.note(Note.create(:"G#", 4), gt: 480*2, vel: 0.7)
496
+ se.note(Note.create(:B, 4), st: 480*2, gt: 480*2, vel: 0.7)
497
+ se.step(480*2)
498
+
499
+ se.step(480*3)
500
+ se.note(Note.create(:B, 3), gt: 480)
501
+ se.note(Note.create(:F, 4), gt: 480)
502
+ se.note(Note.create(:A, 4), st: 480, gt: 480)
503
+
504
+ se.step(480*4)
505
+
506
+ se.complete
507
+ }
508
+
509
+ AudioInputStepEditor.new(synth, se)
510
+ end
511
+
512
+ def create_arpeggio1
513
+ synth = PolySynth.new(
514
+ oscillators: [
515
+ Oscillator.new(
516
+ source: OscillatorSource::SineTriangle.instance,
517
+ uni_num: 2,
518
+ uni_detune: 0.2,
519
+ uni_stereo: 0.4,
520
+ ),
521
+ ],
522
+ filter: Filter::Serial.new(
523
+ Filter::HighPassFilter.new(freq: 500.0, q: Filter::DEFAULT_Q),
524
+ Filter::HighShelfFilter.new(freq: 2000.0, q: Filter::DEFAULT_Q, gain: 1.0),
525
+ Filter::HighShelfFilter.new(freq: 10000.0, q: 0.3, gain: 1.0),
526
+ ),
527
+ amplifier: Amplifier.new(
528
+ volume: ModulationValue.new(1.0)
529
+ .add(Modulation::Adsr.new(
530
+ attack: Rate.sec(0.0),
531
+ hold: Rate.sec(0.0),
532
+ decay: Rate.sec(0.0),
533
+ sustain: 1.0,
534
+ release: Rate.sec(0.1)
535
+ ), depth: 1.0),
536
+ ),
537
+ soundinfo: @soundinfo,
538
+ )
539
+
540
+ se = StepEditor::StGt.new(bpm: @soundinfo.bpm) {|se|
541
+ se.step(480*4)
542
+
543
+ 3.times {|_|
544
+ se.step(480*2)
545
+ se.step(240)
546
+
547
+ se.note(Note.create(:"D#", 4), st: 120, gt: 120)
548
+ se.note(Note.create(:E, 4), st: 120, gt: 120)
549
+ se.note(Note.create(:B, 4), st: 120, gt: 120)
550
+ se.note(Note.create(:E, 5), st: 120, gt: 120)
551
+ se.step(240)
552
+
553
+ se.step(480*4)
554
+ }
555
+
556
+ se.complete
557
+ }
558
+
559
+ AudioInputStepEditor.new(synth, se)
560
+ end
561
+
562
+ def create_arpeggio2
563
+ synth = PolySynth.new(
564
+ oscillators: [
565
+ Oscillator.new(
566
+ source: OscillatorSource::TriangleSawtooth.instance,
567
+ pan: -0.6,
568
+ tune_semis: 0,
569
+ ),
570
+ Oscillator.new(
571
+ source: OscillatorSource::TriangleSawtooth.instance,
572
+ pan: 0.6,
573
+ tune_semis: 12,
574
+ ),
575
+ ],
576
+ filter: Filter::Serial.new(
577
+ Filter::BandPassFilter.new(freq: 10000.0, bandwidth: 4.0)
578
+ ),
579
+ amplifier: @default_amp,
580
+ soundinfo: @soundinfo,
581
+ )
582
+
583
+ se = StepEditor::StGt.new(bpm: @soundinfo.bpm) {|se|
584
+ se.step(480*4)
585
+
586
+ se.step(480*4)
587
+ se.step(480*2)
588
+
589
+ se.note(Note.create(:E, 4), st: 120, gt: 120)
590
+ se.note(Note.create(:"D#", 4), st: 240, gt: 120)
591
+ se.note(Note.create(:B, 3), st: 240, gt: 120)
592
+ se.note(Note.create(:"G#", 3), st: 360, gt: 240)
593
+
594
+ se.complete
595
+ }
596
+
597
+ AudioInputStepEditor.new(synth, se)
598
+ end
599
+
600
+ def create_bass
601
+ synth = PolySynth.new(
602
+ oscillators: [
603
+ Oscillator.new(
604
+ source: OscillatorSource::SawtoothSquare.instance,
605
+ ),
606
+ ],
607
+ filter: Filter::Serial.new(
608
+ Filter::LowShelfFilter.new(freq: 600.0, gain: 2.0)
609
+ ),
610
+ amplifier: @default_amp,
611
+ soundinfo: @soundinfo,
612
+ )
613
+
614
+ se = StepEditor::StGt.new(bpm: @soundinfo.bpm) {|se|
615
+ se.step(480)
616
+ se.step(240)
617
+
618
+ se.note(Note.create(:E, 2), st: 480, gt: 480)
619
+ se.note(Note.create(:E, 2), st: 120, gt: 120)
620
+ se.note(Note.create(:E, 2), st: 120, gt: 120)
621
+ se.note(Note.create(:D, 2), st: 240, gt: 240)
622
+ se.note(Note.create(:E, 2), st: 240, gt: 240)
623
+
624
+ se.note(Note.create(:A, 1), st: 360, gt: 240)
625
+ se.note(Note.create(:A, 1), st: 240, gt: 240)
626
+ se.note(Note.create(:A, 2), st: 120, gt: 120)
627
+ se.note(Note.create(:E, 2), st: 120, gt: 120)
628
+ se.note(Note.create(:B, 1), st: 120, gt: 120)
629
+ se.note(Note.create(:A, 1), st: 480*2, gt: 480)
630
+
631
+ se.note(Note.create(:B, 1), st: 240, gt: 240)
632
+ se.note(Note.create(:B, 2), st: 360, gt: 240)
633
+ se.note(Note.create(:B, 2), st: 120, gt: 120)
634
+ se.note(Note.create(:B, 1), st: 240, gt: 240)
635
+ se.note(Note.create(:"C#", 2), st: 240, gt: 240)
636
+ se.note(Note.create(:"G#", 2), st: 240, gt: 120)
637
+ se.note(Note.create(:"C#", 2), st: 480, gt: 480)
638
+
639
+ se.note(Note.create(:A, 1), st: 360, gt: 240)
640
+ se.note(Note.create(:A, 1), st: 240, gt: 240)
641
+ se.note(Note.create(:A, 2), st: 120, gt: 120)
642
+ se.note(Note.create(:E, 2), st: 120, gt: 120)
643
+ se.note(Note.create(:B, 1), st: 120, gt: 120)
644
+ se.note(Note.create(:A, 1), st: 480*2, gt: 480*2)
645
+
646
+ se.note(Note.create(:B, 1), st: 240, gt: 240)
647
+ se.note(Note.create(:B, 2), st: 360, gt: 240)
648
+ se.note(Note.create(:B, 2), st: 120, gt: 120)
649
+ se.note(Note.create(:B, 1), st: 240, gt: 240)
650
+ se.note(Note.create(:"C#", 2), st: 480, gt: 480)
651
+ se.note(Note.create(:B, 1), st: 160, gt: 160)
652
+ se.note(Note.create(:B, 1), st: 160, gt: 160)
653
+ se.note(Note.create(:B, 1), st: 160, gt: 160)
654
+
655
+ se.note(Note.create(:A, 1), st: 840, gt: 840)
656
+ se.note(Note.create(:A, 1), st: 120, gt: 120)
657
+ se.note(Note.create(:A, 2), st: 480, gt: 480)
658
+ se.note(Note.create(:A, 1), st: 480, gt: 480)
659
+
660
+ se.note(Note.create(:B, 1), st: 240, gt: 240)
661
+ se.note(Note.create(:B, 2), st: 360, gt: 240)
662
+ se.note(Note.create(:A, 2), st: 120, gt: 120)
663
+ se.note(Note.create(:B, 1), st: 240, gt: 240)
664
+ se.note(Note.create(:"C#", 2), st: 480, gt: 480)
665
+ se.note(Note.create(:B, 1), st: 480, gt: 480)
666
+
667
+ se.note(Note.create(:A, 1), st: 720, gt: 480)
668
+ se.note(Note.create(:B, 1), st: 960, gt: 960)
669
+ se.note(Note.create(:C, 2), st: 1200, gt: 1200)
670
+ se.note(Note.create(:D, 2), st: 360, gt: 360)
671
+ se.note(Note.create(:D, 2), st: 360, gt: 240)
672
+
673
+ se.note(Note.create(:B, 1), st: 480, gt: 480)
674
+ se.note(Note.create(:B, 1), st: 240, gt: 240)
675
+ se.note(Note.create(:B, 1), st: 120, gt: 120)
676
+ se.note(Note.create(:B, 2), st: 120, gt: 120)
677
+ se.note(Note.create(:B, 1), st: 240, gt: 240)
678
+ se.note(Note.create(:B, 1), st: 240, gt: 240)
679
+ se.note(Note.create(:B, 1), st: 240, gt: 240)
680
+ se.note(Note.create(:B, 1), st: 240, gt: 240)
681
+ se.note(Note.create(:B, 1), st: 240, gt: 240)
682
+
683
+ se.step(480*4)
684
+
685
+ se.complete
686
+ }
687
+
688
+ AudioInputStepEditor.new(synth, se)
689
+ end
690
+
691
+ def create_dub1
692
+ lfo1 = Modulation::Lfo.new(
693
+ shape: Shape::Sine,
694
+ delay: Rate.sec(0.0),
695
+ attack: Rate.sec(0.0),
696
+ attack_curve: Modulation::Curve::EaseIn,
697
+ phase: 0.0,
698
+ rate: Rate::SYNC_1_128
699
+ )
700
+ adsr2 = Modulation::Adsr.new(
701
+ attack: Rate.sec(0.1),
702
+ attack_curve: Modulation::Curve::Straight,
703
+ decay: Rate.sec(0.0),
704
+ sustain: 1.0,
705
+ release: Rate.sec(0.1),
706
+ release_curve: Modulation::Curve::EaseOut,
707
+ )
708
+
709
+ synth = PolySynth.new(
710
+ oscillators: [
711
+ Oscillator.new(
712
+ source: OscillatorSource::Sawtooth.instance,
713
+ volume: ModulationValue.new(1.0)
714
+ .add(lfo1, depth: 1.0),
715
+ tune_semis: ModulationValue.new(0.0)
716
+ .add(adsr2, depth: 12.0),
717
+ sync: ModulationValue.new(0.0)
718
+ .add(adsr2, depth: 10.0),
719
+ ),
720
+ Oscillator.new(
721
+ source: OscillatorSource::Sawtooth.instance,
722
+ volume: ModulationValue.new(1.0)
723
+ .add(adsr2, depth: 1.0),
724
+ tune_semis: ModulationValue.new(-12.0)
725
+ .add(adsr2, depth: 12.0),
726
+ sync: ModulationValue.new(0.0)
727
+ .add(lfo1, depth: 10.0),
728
+ ),
729
+ ],
730
+ filter: Filter::Serial.new(
731
+ Filter::HighPassFilter.new(freq: 1000.0, q: Filter::DEFAULT_Q),
732
+ Filter::HighShelfFilter.new(freq: 4000.0, q: Filter::DEFAULT_Q, gain: 0.5),
733
+ ),
734
+ amplifier: Amplifier.new(
735
+ volume: ModulationValue.new(1.0)
736
+ .add(Modulation::Adsr.new(
737
+ attack: Rate.sec(0.0),
738
+ hold: Rate.sec(0.0),
739
+ decay: Rate.sec(0.0),
740
+ sustain: 1.0,
741
+ release: Rate.sec(0.3)
742
+ ), depth: 1.0),
743
+ ),
744
+ quality: Quality::HIGH,
745
+ soundinfo: @soundinfo,
746
+ )
747
+
748
+
749
+ se = StepEditor::StGt.new(bpm: @soundinfo.bpm) {|se|
750
+ se.step(480*4)
751
+
752
+ se.step(480*2)
753
+ se.note(Note.create(:"C#", 5), st: 480, gt: 480)
754
+ se.step(480)
755
+ se.step(480*4)
756
+
757
+ se.step(480*2)
758
+ se.note(Note.create(:"C#", 5), st: 480, gt: 480)
759
+ se.step(480)
760
+
761
+ se.step(480*2)
762
+ se.note(Note.create(:"C#", 5), st: 480, gt: 480)
763
+ se.step(480)
764
+
765
+ se.step(480*2)
766
+ se.note(Note.create(:"C#", 5), st: 480, gt: 480)
767
+ se.step(480)
768
+
769
+ se.step(480*2)
770
+ se.note(Note.create(:"C#", 5), st: 480, gt: 480)
771
+ se.step(480)
772
+
773
+ se.complete
774
+ }
775
+
776
+ AudioInputStepEditor.new(synth, se)
777
+ end
778
+
779
+ def create_dub2
780
+ lfo1 = Modulation::Lfo.new(
781
+ shape: Shape::Sine,
782
+ delay: Rate.sec(0.0),
783
+ attack: Rate.sec(0.0),
784
+ attack_curve: Modulation::Curve::EaseIn,
785
+ phase: 0.0,
786
+ rate: Rate::SYNC_1_64
787
+ )
788
+ adsr1 = Modulation::Adsr.new(
789
+ attack: Rate.sec(0.1),
790
+ attack_curve: Modulation::Curve::EaseOut,
791
+ decay: Rate.sec(0.0),
792
+ sustain: 1.0,
793
+ release: Rate.sec(10.0),
794
+ release_curve: Modulation::Curve::EaseIn,
795
+ )
796
+
797
+ synth = PolySynth.new(
798
+ oscillators: [
799
+ Oscillator.new(
800
+ source: OscillatorSource::Sawtooth.instance,
801
+ volume: ModulationValue.new(1.0)
802
+ .add(lfo1, depth: 1.0),
803
+ tune_semis: ModulationValue.new(3.0)
804
+ .add(adsr1, depth: -3.0),
805
+ #sync: ModulationValue.new(0.0)
806
+ # .add(adsr1, depth: 6.0),
807
+ ),
808
+ Oscillator.new(
809
+ source: OscillatorSource::Sawtooth.instance,
810
+ volume: ModulationValue.new(1.0)
811
+ .add(lfo1, depth: 1.0),
812
+ tune_semis: ModulationValue.new(3.0-12.0)
813
+ .add(adsr1, depth: -3.0),
814
+ sync: ModulationValue.new(0.0)
815
+ .add(lfo1, depth: 6.0),
816
+ ),
817
+ Oscillator.new(
818
+ source: OscillatorSource::FormantVocoder.new(
819
+ vowels: [:i, :o],
820
+ pronunciation: ModulationValue.new(0.0)
821
+ .add(adsr1, depth: 1.0),
822
+ ),
823
+ volume: ModulationValue.new(1.0)
824
+ .add(lfo1, depth: 1.0),
825
+ tune_semis: ModulationValue.new(3.0-12.0)
826
+ .add(adsr1, depth: -3.0),
827
+ ),
828
+ ],
829
+ filter: Filter::Serial.new(
830
+ Filter::HighPassFilter.new(freq: 500.0, q: Filter::DEFAULT_Q),
831
+ Filter::PeakingFilter.new(freq: 2000, bandwidth: 4.0, gain: 15),
832
+ ),
833
+ amplifier: @default_amp,
834
+ quality: Quality::HIGH,
835
+ soundinfo: @soundinfo,
836
+ )
837
+
838
+ se = StepEditor::StGt.new(bpm: @soundinfo.bpm) {|se|
839
+ se.step(480*4)
840
+
841
+ se.step(480*3)
842
+ se.note(Note.create(:B, 3), st: 480, gt: 480)
843
+ se.step(480*4)
844
+
845
+ se.step(480*3)
846
+ se.note(Note.create(:B, 3), st: 480, gt: 480)
847
+
848
+ se.step(480*3)
849
+ se.note(Note.create(:B, 3), st: 160, gt: 120)
850
+ se.note(Note.create(:B, 3), st: 160, gt: 120)
851
+ se.note(Note.create(:B, 3), st: 160, gt: 120)
852
+
853
+ se.step(480*3)
854
+ se.note(Note.create(:B, 3), st: 480, gt: 480)
855
+
856
+ se.step(480*3)
857
+ se.note(Note.create(:B, 3), st: 480, gt: 480)
858
+
859
+ se.complete
860
+ }
861
+
862
+ AudioInputStepEditor.new(synth, se)
863
+ end
864
+
865
+ def create_white_noise
866
+ freq_adsr = Modulation::Adsr.new(
867
+ attack: Rate::SYNC_3,
868
+ attack_curve: Modulation::Curve::EaseIn2,
869
+ decay: Rate.sec(0.0),
870
+ sustain: 1.0,
871
+ release: Rate.sec(10.0),
872
+ release_curve: Modulation::Curve::EaseIn2,
873
+ )
874
+
875
+ synth = PolySynth.new(
876
+ oscillators: [
877
+ Oscillator.new(
878
+ source: OscillatorSource::WhiteNoise.instance,
879
+ pan: -1.0,
880
+ ),
881
+ Oscillator.new(
882
+ source: OscillatorSource::WhiteNoise.instance,
883
+ pan: 1.0,
884
+ ),
885
+ ],
886
+ filter: Filter::Serial.new(
887
+ Filter::BandPassFilter.new(
888
+ freq: ModulationValue.new(100)
889
+ .add(freq_adsr, depth: 20000),
890
+ bandwidth: 1.0)
891
+ ),
892
+ amplifier: Amplifier.new(
893
+ volume: ModulationValue.new(1.0)
894
+ .add(Modulation::Adsr.new(
895
+ attack: Rate::SYNC_3,
896
+ attack_curve: Modulation::Curve::EaseOut,
897
+ decay: Rate.sec(0.0),
898
+ sustain: 0.8,
899
+ release: Rate.sec(0.3)
900
+ ), depth: 1.0),
901
+ ),
902
+ soundinfo: @soundinfo,
903
+ )
904
+
905
+ se = StepEditor::StGt.new(bpm: @soundinfo.bpm) {|se|
906
+ se.step(480*4*7)
907
+ se.note(Note.create(:A, 4), st: 480*4*3, gt: 480*4*3)
908
+ se.step(480*4)
909
+
910
+ se.complete
911
+ }
912
+
913
+ AudioInputStepEditor.new(synth, se)
914
+ end
915
+
916
+ def mixer
917
+ bus1 = AudioBus.new
918
+ bus2 = AudioBus.new
919
+
920
+ @inputs[:vocal1]
921
+ .send_to(bus1, gain: -14.0, pan: 0.0)
922
+
923
+ @inputs[:vocal2]
924
+ .send_to(bus1, gain: -16.0, pan: 0.0)
925
+
926
+ @inputs[:chorus]
927
+ .fx(Chorus.new(@soundinfo, depth: 100, rate: 4))
928
+ .send_to(bus1, gain: -16.0, pan: 0.0)
929
+
930
+ @inputs[:chord]
931
+ .fx(Delay.new(@soundinfo, time: Rate::SYNC_1_8, level: -10.0, feedback: -16.0))
932
+ .send_to(bus1, gain: -16.0, pan: 0.1)
933
+
934
+ @inputs[:slow_chord]
935
+ .fx(Phaser.new(@soundinfo, rate: Rate.freq(1.4), depth: 3.5, freq: 2123, dry: -6, wet: -6))
936
+ .fx(Phaser.new(@soundinfo, rate: Rate.freq(1.83), depth: 3.5, freq: 1357, dry: -6, wet: -6))
937
+ .send_to(bus2, gain: -10.0, pan: 0.1)
938
+
939
+
940
+ @inputs[:arpeggio1]
941
+ .send_to(bus1, gain: -10.0, pan: -0.4)
942
+
943
+
944
+ @inputs[:arpeggio2]
945
+ .fx(Phaser.new(@soundinfo, rate: Rate.freq(1.4), depth: 3.5, freq: 800, dry: 0.5, wet: 0.5))
946
+ .send_to(bus1, gain: -14.0, pan: 0.3)
947
+
948
+
949
+ @inputs[:bass]
950
+ .send_to(bus2, gain: -20.0, pan: 0.0)
951
+
952
+
953
+ @inputs[:dub1]
954
+ .send_to(bus2, gain: -20.0, pan: -0.6)
955
+
956
+ @inputs[:dub2]
957
+ .send_to(bus2, gain: -30.0, pan: 0.6)
958
+
959
+ @inputs[:white_noise]
960
+ .send_to(bus2, gain: -18.0, pan: 0.0)
961
+
962
+
963
+ bus1
964
+ .fx(Compressor.new(threshold: 0.5, ratio: 0.8))
965
+ .fx(SchroederReverb.new(@soundinfo, dry: -1.0, wet: -20.0))
966
+ .send_to(@output, gain: -8.0)
967
+
968
+ bus2
969
+ .fx(Compressor.new(threshold: 0.5, ratio: 0.8))
970
+ .send_to(@output, gain: -10.0)
971
+
972
+ @inputs[:drum]
973
+ .send_to(@output, gain: -1.0)
974
+
975
+
976
+
977
+ conductor = Conductor.new(
978
+ input: @inputs.values,
979
+ output: @output
980
+ )
981
+ conductor.connect
982
+ conductor.join
983
+ end
984
+ end
985
+
986
+
987
+ KiraPower.new.mixer