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,811 @@
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
+ class Daijoubu
12
+ def initialize
13
+ @soundinfo = SoundInfo.new(
14
+ channels: 2,
15
+ samplerate: 44100,
16
+ window_size: 1024,
17
+ format: RubyAudio::FORMAT_WAV|RubyAudio::FORMAT_PCM_16,
18
+ bpm: 130
19
+ )
20
+
21
+ @default_amp = Amplifier.new(
22
+ volume: ModulationValue.new(1.0)
23
+ .add(Modulation::Adsr.new(
24
+ attack: Rate.sec(0.05),
25
+ hold: Rate.sec(0.1),
26
+ decay: Rate.sec(0.4),
27
+ sustain: 0.8,
28
+ release: Rate.sec(0.3)
29
+ ), depth: 1.0),
30
+ )
31
+
32
+ @inputs = {
33
+ up_noise: create_up_noise,
34
+ intro_arpeggio: create_intro_arpeggio,
35
+ vocal1: create_vocal1,
36
+ vocal2: create_vocal2,
37
+ lead1: create_lead1,
38
+ lead_mono: create_lead_mono,
39
+ lead_wide: create_lead_wide,
40
+ chord: create_chord,
41
+ bass: create_bass,
42
+ drum: AudioInput.file(File.dirname(__FILE__)+"/daijoubu_drum.wav", soundinfo: @soundinfo),
43
+ }
44
+
45
+ #@output = AudioOutput.device(soundinfo: @soundinfo)
46
+ @output = AudioOutput.file(File.dirname(__FILE__)+"/output_daijoubu.wav", soundinfo: @soundinfo)
47
+ end
48
+
49
+ def create_up_noise
50
+ synth = PolySynth.new(
51
+ oscillators: [
52
+ Oscillator.new(
53
+ source: OscillatorSource::WhiteNoise.instance
54
+ ),
55
+ ],
56
+ filter: Filter::BandPassFilter.new(
57
+ freq: ModulationValue.new(100.0)
58
+ .add(Modulation::Adsr.new(
59
+ attack: Rate::SYNC_2,
60
+ attack_curve: Modulation::Curve::Straight,
61
+ hold: Rate.sec(0.0),
62
+ decay: Rate.sec(0.0),
63
+ sustain: 0.0,
64
+ release: Rate.sec(2.0)
65
+ ), depth: 6000.0),
66
+ bandwidth: 0.3,
67
+ ),
68
+ amplifier: Amplifier.new(
69
+ volume: ModulationValue.new(1.0)
70
+ .add(Modulation::Adsr.new(
71
+ attack: Rate::SYNC_6,
72
+ attack_curve: Modulation::Curve::Straight,
73
+ hold: Rate.sec(0.1),
74
+ decay: Rate.sec(0.0),
75
+ sustain: 1.0,
76
+ release: Rate.sec(0.2)
77
+ ), depth: 1.0),
78
+ ),
79
+ soundinfo: @soundinfo,
80
+ )
81
+
82
+ se = StepEditor::StGt.new(bpm: @soundinfo.bpm) {|se|
83
+ se.step(480*2)
84
+
85
+ se.note(Note.new(64), st: 480, gt: 480*8)
86
+ se.note(Note.new(62), st: 480, gt: 480*7)
87
+ se.note(Note.new(60), st: 480*6, gt: 480*6)
88
+
89
+ se.step(480*2)
90
+ se.complete
91
+ }
92
+
93
+ AudioInputStepEditor.new(synth, se)
94
+ end
95
+
96
+ def create_intro_arpeggio
97
+ synth = PolySynth.new(
98
+ oscillators: [
99
+ Oscillator.new(
100
+ source: OscillatorSource::SawtoothSine.instance,
101
+ uni_num: 4,
102
+ uni_detune: 0.1,
103
+ ),
104
+ ],
105
+ amplifier: @default_amp,
106
+ soundinfo: @soundinfo,
107
+ )
108
+
109
+ se = StepEditor::StGt.new(bpm: @soundinfo.bpm) {|se|
110
+ se.step(480*2)
111
+
112
+ se.step(480*2)
113
+
114
+ 2.times {|i|
115
+ se.note(Note.create(:B, 5), gt: 120, vel: 0.1*(i+1))
116
+ se.step(120)
117
+ se.note(Note.create(:A, 5), gt: 120, vel: 0.1*(i+1))
118
+ se.step(120)
119
+ se.note(Note.create(:"G#", 5), gt: 120, vel: 0.1*(i+1))
120
+ se.step(120)
121
+ se.note(Note.create(:E, 5), gt: 120, vel: 0.1*(i+1))
122
+ se.step(120)
123
+ }
124
+
125
+ 3.times {|i|
126
+ se.note(Note.create(:B, 5), gt: 120, vel: 0.1*(i+3))
127
+ se.note(Note.create(:B, 3), gt: 120, vel: 0.1*(i+1))
128
+ se.step(120)
129
+ se.note(Note.create(:A, 5), gt: 120, vel: 0.1*(i+3))
130
+ se.note(Note.create(:A, 3), gt: 120, vel: 0.1*(i+1))
131
+ se.step(120)
132
+ se.note(Note.create(:"G#", 5), gt: 120, vel: 0.1*(i+3))
133
+ se.note(Note.create(:"G#", 3), gt: 120, vel: 0.1*(i+1))
134
+ se.step(120)
135
+ se.note(Note.create(:E, 5), gt: 120, vel: 0.1*(i+3))
136
+ se.note(Note.create(:E, 3), gt: 120, vel: 0.1*(i+1))
137
+ se.step(120)
138
+ }
139
+
140
+ se.note(Note.create(:B, 5), gt: 120, vel: 0.6)
141
+ se.note(Note.create(:E, 4), gt: 120, vel: 0.4)
142
+ se.step(120)
143
+ se.note(Note.create(:A, 5), gt: 120, vel: 0.6)
144
+ se.note(Note.create(:"G#", 4), gt: 120, vel: 0.4)
145
+ se.step(120)
146
+ se.note(Note.create(:"G#", 5), gt: 120, vel: 0.6)
147
+ se.note(Note.create(:E, 4), gt: 120, vel: 0.4)
148
+ se.step(120)
149
+ se.note(Note.create(:E, 5), gt: 120, vel: 0.6)
150
+ se.note(Note.create(:B, 3), gt: 120, vel: 0.4)
151
+ se.step(120)
152
+
153
+ se.step(480*2)
154
+ se.complete
155
+ }
156
+
157
+ AudioInputStepEditor.new(synth, se)
158
+ end
159
+
160
+ def create_vocal1
161
+ synth = MonoSynth.new(
162
+ oscillators: [
163
+ Oscillator.new(
164
+ source: OscillatorSource::SquareSine.instance,
165
+ ),
166
+ ],
167
+ amplifier: @default_amp,
168
+ glide: Rate.sec(0.08),
169
+ soundinfo: @soundinfo,
170
+ )
171
+
172
+ se = StepEditor::StGt.new(bpm: @soundinfo.bpm) {|se|
173
+ se.step(480*2)
174
+
175
+ se.step(480*8)
176
+ se.note(Note.create(:"A#", 5), st: 60, gt: 120)
177
+ se.note(Note.create(:B, 5), st: 420, gt: 420)
178
+ se.note(Note.create(:B, 5), st: 240, gt: 240)
179
+ se.note(Note.create(:"D#", 5), st: 120, gt: 120)
180
+ se.note(Note.create(:E, 5), st: 1080, gt: 360)
181
+ se.step(480*4)
182
+
183
+ se.note(Note.create(:"A#", 5), st: 60, gt: 120)
184
+ se.note(Note.create(:B, 5), st: 420, gt: 420)
185
+ se.note(Note.create(:B, 5), st: 240, gt: 240)
186
+ se.note(Note.create(:"D#", 5), st: 120, gt: 120)
187
+ se.note(Note.create(:E, 5), st: 360, gt: 360)
188
+ se.note(Note.create(:B, 4), st: 240, gt: 240)
189
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
190
+ se.note(Note.create(:"C#", 6), st: 240, gt: 240)
191
+ se.note(Note.create(:B, 5), st: 240, gt: 240)
192
+ se.note(Note.create(:A, 5), st: 240, gt: 240)
193
+ se.note(Note.create(:"G#", 5), st: 240, gt: 240)
194
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
195
+ se.note(Note.create(:"F#", 5), st: 360, gt: 360)
196
+ se.note(Note.create(:G, 5), st: 60, gt: 120)
197
+ se.note(Note.create(:"G#", 5), st: 300, gt: 300)
198
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
199
+
200
+ se.step(240)
201
+ se.note(Note.create(:B, 4), st: 240, gt: 240)
202
+ se.note(Note.create(:"D#", 5), st: 240, gt: 240)
203
+ se.note(Note.create(:E, 5), st: 120, gt: 120)
204
+ se.note(Note.create(:F, 5), st: 60, gt: 120)
205
+ se.note(Note.create(:"F#", 5), st: 300, gt: 300)
206
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
207
+ se.note(Note.create(:"F#", 5), st: 240, gt: 240)
208
+ se.note(Note.create(:"G#", 5), st: 240, gt: 240)
209
+ se.note(Note.create(:"F#", 5), st: 360, gt: 360)
210
+ se.note(Note.create(:E, 5), st: 360, gt: 360)
211
+ se.note(Note.create(:"F#", 5), st: 480, gt: 480)
212
+ se.note(Note.create(:"G#", 5), st: 240, gt: 240)
213
+ se.note(Note.create(:"F#", 5), st: 240, gt: 240)
214
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
215
+
216
+ se.note(Note.create(:"A#", 5), st: 60, gt: 120)
217
+ se.note(Note.create(:B, 5), st: 420, gt: 420)
218
+ se.note(Note.create(:B, 5), st: 240, gt: 240)
219
+ se.note(Note.create(:"D#", 5), st: 120, gt: 120)
220
+ se.note(Note.create(:E, 5), st: 360, gt: 360)
221
+ se.note(Note.create(:B, 4), st: 240, gt: 240)
222
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
223
+ se.note(Note.create(:"C#", 6), st: 240, gt: 240)
224
+ se.note(Note.create(:B, 5), st: 240, gt: 240)
225
+ se.note(Note.create(:A, 5), st: 240, gt: 240)
226
+ se.note(Note.create(:"G#", 5), st: 240, gt: 240)
227
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
228
+ se.note(Note.create(:"F#", 5), st: 360, gt: 360)
229
+ se.note(Note.create(:G, 5), st: 60, gt: 120)
230
+ se.note(Note.create(:"G#", 5), st: 300, gt: 300)
231
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
232
+
233
+ se.step(240)
234
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
235
+ se.note(Note.create(:"D#", 5), st: 240, gt: 240)
236
+ se.note(Note.create(:E, 5), st: 480, gt: 240)
237
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
238
+ se.note(Note.create(:B, 5), st: 240, gt: 240)
239
+ se.note(Note.create(:E, 5), st: 480, gt: 240)
240
+ se.note(Note.create(:B, 4), st: 240, gt: 240)
241
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
242
+ se.note(Note.create(:B, 5), st: 240, gt: 240)
243
+ se.note(Note.create(:A, 5), st: 240, gt: 240)
244
+ se.note(Note.create(:"G#", 5), st: 240, gt: 240)
245
+ se.note(Note.create(:"F#", 5), st: 240, gt: 240)
246
+ se.note(Note.create(:"G#", 5), st: 240, gt: 240)
247
+ se.note(Note.create(:"F#", 5), st: 240, gt: 240)
248
+ se.note(Note.create(:"G#", 5), st: 120, gt: 120)
249
+ se.note(Note.create(:E, 5), st: 1080, gt: 1080)
250
+
251
+ se.step(480*2)
252
+ se.complete
253
+ }
254
+
255
+ AudioInputStepEditor.new(synth, se)
256
+ end
257
+
258
+ def create_vocal2
259
+ synth = MonoSynth.new(
260
+ oscillators: [
261
+ Oscillator.new(
262
+ source: OscillatorSource::SquareSine.instance,
263
+ uni_num: 4,
264
+ uni_detune: 0.1,
265
+ ),
266
+ ],
267
+ amplifier: @default_amp,
268
+ glide: Rate.sec(0.08),
269
+ soundinfo: @soundinfo,
270
+ )
271
+
272
+ se = StepEditor::StGt.new(bpm: @soundinfo.bpm) {|se|
273
+ se.step(480*2)
274
+
275
+ se.step(480*8)
276
+ se.step(480*2)
277
+ se.note(Note.create(:"A#", 5), st: 60, gt: 120)
278
+ se.note(Note.create(:B, 5), st: 420, gt: 420)
279
+ se.note(Note.create(:B, 5), st: 240, gt: 240)
280
+ se.note(Note.create(:"D#", 5), st: 120, gt: 120)
281
+ se.note(Note.create(:E, 5), st: 1080, gt: 360)
282
+
283
+ se.step(480*2)
284
+ se.complete
285
+ }
286
+
287
+ AudioInputStepEditor.new(synth, se)
288
+ end
289
+
290
+ def create_lead1
291
+ synth = PolySynth.new(
292
+ oscillators: [
293
+ Oscillator.new(
294
+ source: OscillatorSource::SawtoothTriangle.instance,
295
+ ),
296
+ ],
297
+ amplifier: @default_amp,
298
+ soundinfo: @soundinfo,
299
+ )
300
+
301
+ se = StepEditor::StGt.new(bpm: @soundinfo.bpm) {|se|
302
+ se.step(480*2)
303
+
304
+ se.step(480*8)
305
+ se.step(480*3)
306
+ se.note(Note.create(:"C#", 5), st: 240, gt: 120)
307
+ se.note(Note.create(:"D#", 5), st: 240, gt: 120)
308
+ se.note(Note.create(:E, 5), st: 380, gt: 380)
309
+ se.note(Note.create(:"F#", 5), st: 380, gt: 380)
310
+ se.note(Note.create(:"G#", 5), st: 480, gt: 480)
311
+ se.note(Note.create(:E, 5), st: 240, gt: 240)
312
+ se.note(Note.create(:B, 5), st: 480, gt: 480)
313
+
314
+ se.step(480*2)
315
+ se.complete
316
+ }
317
+
318
+ AudioInputStepEditor.new(synth, se)
319
+ end
320
+
321
+ def create_lead_mono
322
+ synth = MonoSynth.new(
323
+ oscillators: [
324
+ Oscillator.new(
325
+ source: OscillatorSource::SawtoothTriangle.instance,
326
+ ),
327
+ ],
328
+ amplifier: @default_amp,
329
+ glide: Rate.sec(0.15),
330
+ soundinfo: @soundinfo,
331
+ )
332
+
333
+ se = StepEditor::StGt.new(bpm: @soundinfo.bpm) {|se|
334
+ se.step(480*2)
335
+
336
+ se.step(480*16)
337
+
338
+ se.note(Note.create(:B, 5), st: 480, gt: 481)
339
+ se.note(Note.create(:E, 5), st: 480, gt: 481)
340
+ se.note(Note.create(:"F#", 5), st: 480, gt: 481)
341
+ se.note(Note.create(:A, 5), st: 480, gt: 481)
342
+ se.note(Note.create(:"G#", 5), st: 480, gt: 481)
343
+ se.note(Note.create(:E, 5), st: 480, gt: 481)
344
+ se.note(Note.create(:"F#", 5), st: 480, gt: 481)
345
+ se.note(Note.create(:E, 5), st: 480, gt: 481)
346
+
347
+ se.note(Note.create(:B, 5), st: 480, gt: 481)
348
+ se.note(Note.create(:E, 5), st: 480, gt: 481)
349
+ se.note(Note.create(:"F#", 5), st: 480, gt: 481)
350
+ se.note(Note.create(:A, 5), st: 480, gt: 481)
351
+ se.note(Note.create(:"G#", 5), st: 480, gt: 481)
352
+ se.note(Note.create(:A, 5), st: 480, gt: 481)
353
+ se.note(Note.create(:B, 5), st: 480, gt: 481)
354
+ se.note(Note.create(:E, 6), st: 480, gt: 481)
355
+
356
+ se.note(Note.create(:B, 5), st: 480, gt: 481)
357
+ se.note(Note.create(:E, 5), st: 480, gt: 481)
358
+ se.note(Note.create(:"F#", 5), st: 480, gt: 481)
359
+ se.note(Note.create(:A, 5), st: 480, gt: 481)
360
+ se.note(Note.create(:"G#", 5), st: 480, gt: 481)
361
+ se.note(Note.create(:E, 5), st: 480, gt: 481)
362
+ se.note(Note.create(:"F#", 5), st: 480, gt: 481)
363
+ se.note(Note.create(:E, 5), st: 480, gt: 481)
364
+
365
+ se.note(Note.create(:"C#", 6), st: 960, gt: 961)
366
+ se.note(Note.create(:"D#", 6), st: 960, gt: 961)
367
+ se.note(Note.create(:E, 6), st: 960, gt: 961)
368
+ se.note(Note.create(:B, 6), st: 960, gt: 960)
369
+
370
+ se.step(480)
371
+ se.note(Note.create(:B, 5), st: 480, gt: 481)
372
+ se.note(Note.create(:E, 6), st: 480, gt: 481)
373
+ se.note(Note.create(:"G#", 6), st: 480, gt: 481)
374
+ se.note(Note.create(:A, 6), st: 960, gt: 960)
375
+
376
+ se.step(480*2)
377
+ se.complete
378
+ }
379
+
380
+ AudioInputStepEditor.new(synth, se)
381
+ end
382
+
383
+ def create_lead_wide
384
+ synth = PolySynth.new(
385
+ oscillators: [
386
+ Oscillator.new(
387
+ source: OscillatorSource::Sawtooth.instance,
388
+ pan: -0.5,
389
+ uni_num: 8,
390
+ uni_detune: 0.07,
391
+ ),
392
+ Oscillator.new(
393
+ source: OscillatorSource::Square.instance,
394
+ pan: 0.5,
395
+ uni_num: 8,
396
+ uni_detune: 0.07,
397
+ ),
398
+ ],
399
+ filter: Filter::Serial.new(
400
+ Filter::HighShelfFilter.new(freq: 1500, gain: 2.0)
401
+ ),
402
+ amplifier: @default_amp,
403
+ soundinfo: @soundinfo,
404
+ )
405
+
406
+ se = StepEditor::StGt.new(bpm: @soundinfo.bpm) {|se|
407
+ se.step(480*2)
408
+
409
+ se.step(480*16)
410
+
411
+ 2.times {|_|
412
+ se.step(480*4)
413
+ se.note(Note.create(:E, 5), st: 120, gt: 60)
414
+ se.note(Note.create(:E, 5), st: 120, gt: 60)
415
+ se.note(Note.create(:E, 5), st: 120, gt: 60)
416
+ se.note(Note.create(:E, 5), st: 120, gt: 60)
417
+ se.note(Note.create(:E, 5), st: 240, gt: 180)
418
+ se.note(Note.create(:B, 4), st: 120, gt: 60)
419
+ se.note(Note.create(:B, 4), st: 120, gt: 60)
420
+ se.note(Note.create(:B, 4), st: 120, gt: 60)
421
+ se.note(Note.create(:B, 4), st: 120, gt: 60)
422
+ se.note(Note.create(:B, 4), st: 240, gt: 180)
423
+ se.note(Note.create(:B, 4), st: 240, gt: 180)
424
+ se.note(Note.create(:B, 4), st: 120, gt: 60)
425
+ se.note(Note.create(:B, 4), st: 120, gt: 60)
426
+
427
+ se.step(480*4)
428
+ se.note(Note.create(:E, 5), st: 240, gt: 120)
429
+ se.note(Note.create(:"D#", 5), st: 240, gt: 120)
430
+ se.note(Note.create(:"C#", 5), st: 240, gt: 120)
431
+ se.note(Note.create(:B, 4), st: 240, gt: 120)
432
+ se.note(Note.create(:E, 5), st: 240, gt: 120)
433
+ se.note(Note.create(:"D#", 5), st: 240, gt: 120)
434
+ se.note(Note.create(:"C#", 5), st: 240, gt: 120)
435
+ se.note(Note.create(:B, 4), st: 240, gt: 120)
436
+ }
437
+
438
+ se.step(480*4)
439
+ se.note(Note.create(:A, 5), st: 360, gt: 120)
440
+ se.note(Note.create(:A, 5), st: 240, gt: 120)
441
+ se.note(Note.create(:A, 5), st: 240, gt: 120)
442
+ se.note(Note.create(:"G#", 5), st: 120, gt: 120)
443
+
444
+ se.step(480*2)
445
+ se.complete
446
+ }
447
+
448
+ AudioInputStepEditor.new(synth, se)
449
+ end
450
+
451
+ def create_chord
452
+ synth = PolySynth.new(
453
+ oscillators: [
454
+ Oscillator.new(
455
+ source: OscillatorSource::Square.instance,
456
+ pan: -0.5,
457
+ uni_num: 4,
458
+ uni_detune: 0.1,
459
+ ),
460
+ Oscillator.new(
461
+ source: OscillatorSource::Sawtooth.instance,
462
+ pan: 0.5,
463
+ uni_num: 4,
464
+ uni_detune: 0.1,
465
+ ),
466
+ ],
467
+ filter: Filter::Serial.new(
468
+ Filter::HighShelfFilter.new(freq: 2000, gain: 2.0)
469
+ ),
470
+ amplifier: Amplifier.new(
471
+ volume: ModulationValue.new(1.0)
472
+ .add(Modulation::Adsr.new(
473
+ attack: Rate.sec(0.05),
474
+ hold: Rate.sec(0.0),
475
+ decay: Rate.sec(0.1),
476
+ sustain: 0.8,
477
+ release: Rate.sec(0.05)
478
+ ), depth: 1.0),
479
+ ),
480
+ soundinfo: @soundinfo,
481
+ )
482
+
483
+ se = StepEditor::StGt.new(bpm: @soundinfo.bpm) {|se|
484
+ se.step(480*2)
485
+ se.step(480*12)
486
+
487
+ se.note(Note.create(:E, 3), gt: 240)
488
+ se.note(Note.create(:"G#", 3), gt: 240)
489
+ se.note(Note.create(:B, 3), st: 360, gt: 240)
490
+ se.note(Note.create(:E, 3), gt: 240)
491
+ se.note(Note.create(:"G#", 3), gt: 240)
492
+ se.note(Note.create(:B, 3), st: 360, gt: 240)
493
+ se.note(Note.create(:E, 3), gt: 240)
494
+ se.note(Note.create(:"G#", 3), gt: 240)
495
+ se.note(Note.create(:B, 3), st: 480, gt: 240)
496
+ se.note(Note.create(:E, 3), gt: 240)
497
+ se.note(Note.create(:"G#", 3), gt: 240)
498
+ se.note(Note.create(:B, 3), st: 240, gt: 240)
499
+ se.note(Note.create(:E, 3), gt: 240)
500
+ se.note(Note.create(:"G#", 3), gt: 240)
501
+ se.note(Note.create(:B, 3), st: 480, gt: 240)
502
+
503
+ 2.times {|_|
504
+ se.note(Note.create(:A, 4), gt: 360)
505
+ se.note(Note.create(:"C#", 5), gt: 360)
506
+ se.note(Note.create(:E, 5), st: 480, gt: 360)
507
+ se.note(Note.create(:A, 4), gt: 240)
508
+ se.note(Note.create(:"C#", 5), gt: 240)
509
+ se.note(Note.create(:E, 5), st: 600, gt: 240)
510
+ se.note(Note.create(:B, 4), gt: 240)
511
+ se.note(Note.create(:"D#", 5), gt: 240)
512
+ se.note(Note.create(:"F#", 5), st: 360, gt: 240)
513
+ se.note(Note.create(:B, 4), gt: 120)
514
+ se.note(Note.create(:"D#", 5), gt: 120)
515
+ se.note(Note.create(:"F#", 5), st: 240, gt: 120)
516
+ se.note(Note.create(:B, 4), gt: 60)
517
+ se.note(Note.create(:"D#", 5), gt: 60)
518
+ se.note(Note.create(:"F#", 5), st: 120, gt: 60)
519
+ se.note(Note.create(:B, 4), gt: 60)
520
+ se.note(Note.create(:"D#", 5), gt: 60)
521
+ se.note(Note.create(:"F#", 5), st: 120, gt: 60)
522
+
523
+ se.step(240)
524
+ se.note(Note.create(:E, 5), gt: 240)
525
+ se.note(Note.create(:"G#", 5), gt: 240)
526
+ se.note(Note.create(:B, 5), st: 480, gt: 240)
527
+ se.note(Note.create(:E, 5), gt: 240)
528
+ se.note(Note.create(:"G#", 5), gt: 240)
529
+ se.note(Note.create(:B, 5), st: 360, gt: 240)
530
+ se.note(Note.create(:"C#", 5), gt: 240)
531
+ se.note(Note.create(:E, 5), gt: 240)
532
+ se.note(Note.create(:"G#", 5), st: 360, gt: 240)
533
+ se.note(Note.create(:"C#", 5), gt: 120)
534
+ se.note(Note.create(:E, 5), gt: 120)
535
+ se.note(Note.create(:"G#", 5), st: 240, gt: 120)
536
+ se.note(Note.create(:"C#", 5), gt: 60)
537
+ se.note(Note.create(:E, 5), gt: 60)
538
+ se.note(Note.create(:"G#", 5), st: 120, gt: 60)
539
+ se.note(Note.create(:"C#", 5), gt: 60)
540
+ se.note(Note.create(:E, 5), gt: 60)
541
+ se.note(Note.create(:"G#", 5), st: 120, gt: 60)
542
+ }
543
+
544
+ se.note(Note.create(:A, 4), gt: 360)
545
+ se.note(Note.create(:"C#", 5), gt: 360)
546
+ se.note(Note.create(:E, 5), st: 480, gt: 360)
547
+ se.note(Note.create(:A, 4), gt: 240)
548
+ se.note(Note.create(:"C#", 5), gt: 240)
549
+ se.note(Note.create(:E, 5), st: 600, gt: 240)
550
+ se.note(Note.create(:B, 4), gt: 240)
551
+ se.note(Note.create(:"D#", 5), gt: 240)
552
+ se.note(Note.create(:"F#", 5), st: 360, gt: 240)
553
+ se.note(Note.create(:B, 4), gt: 120)
554
+ se.note(Note.create(:"D#", 5), gt: 120)
555
+ se.note(Note.create(:"F#", 5), st: 240, gt: 120)
556
+ se.note(Note.create(:B, 4), gt: 60)
557
+ se.note(Note.create(:"D#", 5), gt: 60)
558
+ se.note(Note.create(:"F#", 5), st: 120, gt: 60)
559
+ se.note(Note.create(:B, 4), gt: 60)
560
+ se.note(Note.create(:"D#", 5), gt: 60)
561
+ se.note(Note.create(:"F#", 5), st: 120, gt: 60)
562
+
563
+ se.note(Note.create(:B, 4), gt: 240)
564
+ se.note(Note.create(:E, 5), gt: 240)
565
+ se.note(Note.create(:"G#", 5), st: 480, gt: 240)
566
+ se.note(Note.create(:B, 4), gt: 240)
567
+ se.note(Note.create(:E, 5), gt: 240)
568
+ se.note(Note.create(:"G#", 5), st: 480, gt: 240)
569
+ se.note(Note.create(:"C#", 5), gt: 240)
570
+ se.note(Note.create(:E, 5), gt: 240)
571
+ se.note(Note.create(:"G#", 5), st: 480, gt: 240)
572
+ se.note(Note.create(:"C#", 5), gt: 240)
573
+ se.note(Note.create(:E, 5), gt: 240)
574
+ se.note(Note.create(:"G#", 5), st: 480, gt: 240)
575
+
576
+ se.note(Note.create(:"F#", 4), gt: 360)
577
+ se.note(Note.create(:A, 4), gt: 360)
578
+ se.note(Note.create(:"C#", 5), st: 480, gt: 360)
579
+ se.note(Note.create(:"F#", 4), gt: 240)
580
+ se.note(Note.create(:A, 4), gt: 240)
581
+ se.note(Note.create(:"C#", 5), st: 600, gt: 240)
582
+ se.note(Note.create(:"G#", 4), gt: 240)
583
+ se.note(Note.create(:B, 4), gt: 240)
584
+ se.note(Note.create(:"D#", 5), st: 360, gt: 240)
585
+ se.note(Note.create(:"G#", 4), gt: 120)
586
+ se.note(Note.create(:B, 4), gt: 120)
587
+ se.note(Note.create(:"D#", 5), st: 240, gt: 120)
588
+ se.note(Note.create(:"G#", 4), gt: 60)
589
+ se.note(Note.create(:B, 4), gt: 60)
590
+ se.note(Note.create(:"D#", 5), st: 120, gt: 60)
591
+ se.note(Note.create(:"G#", 4), gt: 60)
592
+ se.note(Note.create(:B, 4), gt: 60)
593
+ se.note(Note.create(:"D#", 5), st: 120, gt: 60)
594
+
595
+ se.note(Note.create(:A, 4), gt: 240)
596
+ se.note(Note.create(:"C#", 5), gt: 240)
597
+ se.note(Note.create(:E, 5), st: 480, gt: 240)
598
+ se.note(Note.create(:A, 4), gt: 240)
599
+ se.note(Note.create(:"C#", 5), gt: 240)
600
+ se.note(Note.create(:E, 5), st: 480, gt: 240)
601
+ se.note(Note.create(:B, 4), gt: 240)
602
+ se.note(Note.create(:"D#", 5), gt: 240)
603
+ se.note(Note.create(:"F#", 5), st: 480, gt: 240)
604
+ se.note(Note.create(:B, 4), gt: 240)
605
+ se.note(Note.create(:"D#", 5), gt: 240)
606
+ se.note(Note.create(:"F#", 5), st: 480, gt: 240)
607
+
608
+ se.note(Note.create(:E, 5), gt: 360)
609
+ se.note(Note.create(:"G#", 5), gt: 360)
610
+ se.note(Note.create(:B, 5), st: 480, gt: 360)
611
+ se.note(Note.create(:E, 5), gt: 480)
612
+ se.note(Note.create(:"G#", 5), gt: 480)
613
+ se.note(Note.create(:B, 5), st: 600, gt: 480)
614
+ se.note(Note.create(:E, 5), gt: 240)
615
+ se.note(Note.create(:"G#", 5), gt: 240)
616
+ se.note(Note.create(:B, 5), st: 360, gt: 240)
617
+ se.note(Note.create(:E, 5), gt: 120)
618
+ se.note(Note.create(:"G#", 5), gt: 120)
619
+ se.note(Note.create(:B, 5), st: 240, gt: 120)
620
+ se.note(Note.create(:E, 5), gt: 60)
621
+ se.note(Note.create(:"G#", 5), gt: 60)
622
+ se.note(Note.create(:B, 5), st: 120, gt: 60)
623
+ se.note(Note.create(:E, 5), gt: 60)
624
+ se.note(Note.create(:"G#", 5), gt: 60)
625
+ se.note(Note.create(:B, 5), st: 120, gt: 60)
626
+
627
+ se.note(Note.create(:E, 5), gt: 240)
628
+ se.note(Note.create(:"G#", 5), gt: 240)
629
+ se.note(Note.create(:B, 5), st: 360, gt: 240)
630
+ se.note(Note.create(:E, 5), gt: 120)
631
+ se.note(Note.create(:"G#", 5), gt: 120)
632
+ se.note(Note.create(:B, 5), st: 240, gt: 120)
633
+ se.note(Note.create(:E, 5), gt: 120)
634
+ se.note(Note.create(:"G#", 5), gt: 120)
635
+ se.note(Note.create(:B, 5), st: 240, gt: 120)
636
+ se.note(Note.create(:E, 5), gt: 360)
637
+ se.note(Note.create(:"G#", 5), gt: 360)
638
+ se.note(Note.create(:B, 5), st: 480, gt: 360)
639
+
640
+ se.step(480*2)
641
+ se.complete
642
+ }
643
+
644
+ AudioInputStepEditor.new(synth, se)
645
+ end
646
+
647
+ def create_bass
648
+ synth = PolySynth.new(
649
+ oscillators: [
650
+ Oscillator.new(
651
+ #source: OscillatorSource::Sawtooth.instance,
652
+ source: OscillatorSource::SquareTriangle.instance,
653
+ uni_num: 1,
654
+ uni_detune: 0.1,
655
+ ),
656
+ ],
657
+ filter: Filter::Serial.new(
658
+ Filter::LowPassFilter.new(freq: 300.0)
659
+ ),
660
+ amplifier: @default_amp,
661
+ soundinfo: @soundinfo,
662
+ )
663
+
664
+ se = StepEditor::StGt.new(bpm: @soundinfo.bpm) {|se|
665
+ se.step(480*2)
666
+
667
+ se.step(480*8)
668
+
669
+ se.note(Note.create(:A, 1), st: 480, gt: 480)
670
+ se.note(Note.create(:A, 1), st: 480, gt: 480)
671
+ se.note(Note.create(:B, 1), st: 480, gt: 480)
672
+ se.note(Note.create(:B, 1), st: 480, gt: 480)
673
+ se.note(Note.create(:E, 2), st: 360, gt: 240)
674
+ se.note(Note.create(:E, 2), st: 360, gt: 240)
675
+ se.note(Note.create(:E, 2), st: 480, gt: 360)
676
+ se.note(Note.create(:E, 2), st: 240, gt: 240)
677
+ se.note(Note.create(:E, 2), st: 480, gt: 480)
678
+
679
+ 2.times {|_|
680
+ se.note(Note.create(:A, 1), st: 240, gt: 240)
681
+ se.note(Note.create(:A, 2), st: 240, gt: 240)
682
+ se.note(Note.create(:A, 1), st: 240, gt: 240)
683
+ se.note(Note.create(:A, 2), st: 240, gt: 240)
684
+ se.note(Note.create(:B, 1), st: 240, gt: 240)
685
+ se.note(Note.create(:B, 2), st: 240, gt: 240)
686
+ se.note(Note.create(:B, 1), st: 240, gt: 240)
687
+ se.note(Note.create(:B, 2), st: 240, gt: 240)
688
+ se.note(Note.create(:E, 1), st: 240, gt: 240)
689
+ se.note(Note.create(:E, 2), st: 240, gt: 240)
690
+ se.note(Note.create(:E, 1), st: 240, gt: 240)
691
+ se.note(Note.create(:E, 2), st: 240, gt: 240)
692
+ se.note(Note.create(:"C#", 1), st: 240, gt: 240)
693
+ se.note(Note.create(:"C#", 2), st: 240, gt: 240)
694
+ se.note(Note.create(:"C#", 3), st: 240, gt: 240)
695
+ se.note(Note.create(:"C#", 2), st: 240, gt: 240)
696
+ }
697
+
698
+ se.note(Note.create(:A, 1), st: 240, gt: 240)
699
+ se.note(Note.create(:A, 2), st: 240, gt: 240)
700
+ se.note(Note.create(:A, 1), st: 240, gt: 240)
701
+ se.note(Note.create(:A, 2), st: 240, gt: 240)
702
+ se.note(Note.create(:B, 1), st: 240, gt: 240)
703
+ se.note(Note.create(:B, 2), st: 240, gt: 240)
704
+ se.note(Note.create(:B, 1), st: 240, gt: 240)
705
+ se.note(Note.create(:B, 2), st: 240, gt: 240)
706
+ se.note(Note.create(:C, 2), st: 240, gt: 240)
707
+ se.note(Note.create(:C, 3), st: 240, gt: 240)
708
+ se.note(Note.create(:C, 2), st: 240, gt: 240)
709
+ se.note(Note.create(:C, 3), st: 240, gt: 240)
710
+ se.note(Note.create(:"C#", 2), st: 240, gt: 240)
711
+ se.note(Note.create(:"C#", 3), st: 240, gt: 240)
712
+ se.note(Note.create(:"C#", 4), st: 240, gt: 240)
713
+ se.note(Note.create(:"G#", 3), st: 240, gt: 240)
714
+
715
+ se.note(Note.create(:"F#", 1), st: 240, gt: 240)
716
+ se.note(Note.create(:"F#", 2), st: 240, gt: 240)
717
+ se.note(Note.create(:"F#", 1), st: 240, gt: 240)
718
+ se.note(Note.create(:"F#", 2), st: 240, gt: 240)
719
+ se.note(Note.create(:"G#", 1), st: 240, gt: 240)
720
+ se.note(Note.create(:"G#", 2), st: 240, gt: 240)
721
+ se.note(Note.create(:"G#", 1), st: 240, gt: 240)
722
+ se.note(Note.create(:"G#", 2), st: 240, gt: 240)
723
+ se.note(Note.create(:A, 1), st: 240, gt: 240)
724
+ se.note(Note.create(:A, 2), st: 240, gt: 240)
725
+ se.note(Note.create(:A, 1), st: 240, gt: 240)
726
+ se.note(Note.create(:A, 2), st: 240, gt: 240)
727
+ se.note(Note.create(:B, 1), st: 240, gt: 240)
728
+ se.note(Note.create(:B, 2), st: 120, gt: 120)
729
+ se.note(Note.create(:"F#", 3), st: 120, gt: 120)
730
+ se.note(Note.create(:B, 3), st: 240, gt: 240)
731
+ se.note(Note.create(:B, 2), st: 240, gt: 240)
732
+
733
+ se.note(Note.create(:E, 1), st: 240, gt: 240)
734
+ se.note(Note.create(:E, 2), st: 240, gt: 240)
735
+ se.note(Note.create(:E, 1), st: 240, gt: 240)
736
+ se.note(Note.create(:E, 2), st: 240, gt: 240)
737
+ se.note(Note.create(:E, 1), st: 240, gt: 240)
738
+ se.note(Note.create(:E, 2), st: 240, gt: 240)
739
+ se.note(Note.create(:E, 1), st: 240, gt: 240)
740
+ se.note(Note.create(:E, 2), st: 240, gt: 240)
741
+ se.note(Note.create(:E, 2), st: 960, gt: 960)
742
+ se.note(Note.create(:E, 3), st: 240, gt: 240)
743
+
744
+ se.step(480*4)
745
+
746
+ se.complete
747
+ }
748
+
749
+ AudioInputStepEditor.new(synth, se)
750
+ end
751
+
752
+ def mixer
753
+ bus1 = AudioBus.new
754
+
755
+ @inputs[:up_noise]
756
+ .fx(Compressor.new(threshold: 0.5, ratio: 0.6))
757
+ .send_to(bus1, gain: -16.5)
758
+
759
+ @inputs[:intro_arpeggio]
760
+ .fx(Compressor.new(threshold: 0.5, ratio: 0.6))
761
+ .send_to(bus1, gain: -12)
762
+
763
+ @inputs[:vocal1]
764
+ .send_to(bus1, gain: -14)
765
+
766
+ @inputs[:vocal2]
767
+ .send_to(bus1, gain: -12)
768
+
769
+ @inputs[:lead1]
770
+ .send_to(bus1, gain: -14)
771
+
772
+ @inputs[:lead_mono]
773
+ .send_to(bus1, gain: -17, pan: -0.5)
774
+
775
+ @inputs[:lead_wide]
776
+ .fx(Delay.new(@soundinfo, time: Rate.sec(0.25*1.5), level: -6, feedback: -100))
777
+ .send_to(bus1, gain: -13, pan: 0.4)
778
+
779
+ @inputs[:chord]
780
+ .fx(Delay.new(@soundinfo, time: Rate.sec(0.3), level: -10, feedback: -10))
781
+ .send_to(bus1, gain: -17, pan: 0.2)
782
+
783
+
784
+ @inputs[:bass]
785
+ .send_to(bus1, gain: -14)
786
+
787
+
788
+ #impulse = AudioInput.file(File.dirname(__FILE__)+"/../../ruby-audio_stream/examples/IMreverbs/Small Drum Room.wav", soundinfo: @soundinfo).connect.to_a
789
+ #impulse = AudioInput.file(File.dirname(__FILE__)+"/../../ruby-audio_stream/examples/IMreverbs/Direct Cabinet N2.wav", soundinfo: @soundinfo).connect.to_a
790
+ #impulse = AudioInput.file(File.dirname(__FILE__)+"/../../ruby-audio_stream/examples/IMreverbs/Masonic Lodge.wav", soundinfo: @soundinfo).connect.to_a
791
+
792
+ bus1
793
+ .fx(Compressor.new(threshold: 0.5, ratio: 0.8))
794
+ .send_to(@output, gain: -8)
795
+
796
+ #.fx(ConvolutionReverb.new(impulse, dry: 0.9, wet: 0.5))
797
+
798
+ @inputs[:drum]
799
+ .send_to(@output, gain: 0)
800
+
801
+
802
+ conductor = Conductor.new(
803
+ input: @inputs.values,
804
+ output: @output
805
+ )
806
+ conductor.connect
807
+ conductor.join
808
+ end
809
+ end
810
+
811
+ Daijoubu.new.mixer