synthesizer 3.1.0 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/examples/{metronome.rb → audio_input_metronome.rb} +8 -2
- data/examples/{step_editor.rb → audio_input_step_editor.rb} +10 -2
- data/examples/filter_band_pass.rb +73 -0
- data/examples/{lpf.rb → filter_serial.rb} +9 -2
- data/examples/oscillator_pan.rb +70 -0
- data/examples/{formant_vocoder.rb → oscillator_source_formant_vocoder.rb} +10 -3
- data/examples/{formant_vocoder_sweep.rb → oscillator_source_formant_vocoder_sweep.rb} +13 -6
- data/examples/oscillator_sync.rb +71 -0
- data/examples/oscillator_unison.rb +64 -0
- data/examples/oscillator_volume.rb +70 -0
- data/examples/{mono.rb → synth_mono.rb} +10 -2
- data/examples/{poly.rb → synth_poly.rb} +10 -2
- data/{examples → jupyter}/adsr.ipynb +20 -17
- data/jupyter/curves.ipynb +103 -0
- data/jupyter/shapes.ipynb +111 -0
- data/lib/audio_stream/audio_input_metronome.rb +1 -1
- data/lib/synthesizer/amplifier.rb +4 -1
- data/lib/synthesizer/filter/band_pass_filter.rb +3 -3
- data/lib/synthesizer/filter/high_pass_filter.rb +3 -3
- data/lib/synthesizer/filter/high_shelf_filter.rb +4 -4
- data/lib/synthesizer/filter/low_pass_filter.rb +3 -3
- data/lib/synthesizer/filter/low_shelf_filter.rb +4 -4
- data/lib/synthesizer/filter/parallel.rb +2 -2
- data/lib/synthesizer/filter/peaking_filter.rb +5 -5
- data/lib/synthesizer/filter/serial.rb +2 -2
- data/lib/synthesizer/modulation/adsr.rb +37 -35
- data/lib/synthesizer/modulation/curve.rb +3 -0
- data/lib/synthesizer/modulation/glide.rb +9 -8
- data/lib/synthesizer/modulation/lfo.rb +23 -23
- data/lib/synthesizer/modulation_value.rb +5 -5
- data/lib/synthesizer/mono_synth.rb +7 -2
- data/lib/synthesizer/oscillator.rb +11 -9
- data/lib/synthesizer/oscillator_source/base.rb +35 -5
- data/lib/synthesizer/oscillator_source/formant_vocoder.rb +27 -19
- data/lib/synthesizer/oscillator_source/pulse.rb +11 -3
- data/lib/synthesizer/poly_synth.rb +5 -2
- data/lib/synthesizer/processor/high.rb +63 -0
- data/lib/synthesizer/processor/low.rb +59 -0
- data/lib/synthesizer/processor.rb +6 -44
- data/lib/synthesizer/quality.rb +6 -0
- data/lib/synthesizer/shape.rb +4 -4
- data/lib/synthesizer/shape_pos.rb +22 -19
- data/lib/synthesizer/unison.rb +28 -16
- data/lib/synthesizer/version.rb +1 -1
- data/lib/synthesizer.rb +1 -0
- data/samples/cinema.rb +730 -0
- data/samples/cinema_drum.wav +0 -0
- data/samples/daijoubu.rb +811 -0
- data/samples/daijoubu_drum.wav +0 -0
- data/samples/kira_power.rb +987 -0
- data/samples/kira_power_drum.wav +0 -0
- data/synthesizer.gemspec +1 -1
- metadata +32 -18
- data/examples/curves.ipynb +0 -105
- data/examples/shapes.ipynb +0 -116
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7fa2f344702317c6c1c8b713314d9462b99df22e1badf9060cd40e99a46d307
|
4
|
+
data.tar.gz: 375c35843ed1a20c3df9ef5f788df905939c182f5408e38fc8c8c717fd3b0ce2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: daccd539aa122c187a494abc7404ef04cb577eff981be9aab8d2a6e07cd36df638ec05c559a563c45ba55fa0c324a6f6a5ab138711e082d0b269a42c668cdc65
|
7
|
+
data.tar.gz: 150e0eb898db3763cfddd29f7ec5801e3be7d6ef6a07e329405cc6e41509a7b3f59f9e51b61a6472e5ed8b7dcc4495d7e3ead167d532c219134c6ee47c530d0d
|
data/.gitignore
CHANGED
@@ -1,13 +1,19 @@
|
|
1
|
+
$LOAD_PATH << File.dirname(__FILE__) + "/../lib"
|
2
|
+
$LOAD_PATH << File.dirname(__FILE__) + "/../../ruby-audio_stream/lib"
|
3
|
+
|
1
4
|
require 'synthesizer'
|
2
5
|
require 'audio_stream'
|
3
6
|
|
4
7
|
include AudioStream
|
5
8
|
include AudioStream::Fx
|
6
9
|
|
10
|
+
samplerate_list = [44100, 48000]
|
11
|
+
available_samplerates = CoreAudio.default_output_device.available_sample_rate.flatten.uniq
|
12
|
+
samplerate = samplerate_list.find {|rate| available_samplerates.include?(rate)} || available_samplerates.max
|
7
13
|
|
8
14
|
soundinfo = SoundInfo.new(
|
9
15
|
channels: 2,
|
10
|
-
samplerate:
|
16
|
+
samplerate: samplerate,
|
11
17
|
window_size: 1024,
|
12
18
|
format: RubyAudio::FORMAT_WAV|RubyAudio::FORMAT_PCM_16
|
13
19
|
)
|
@@ -24,7 +30,7 @@ track1 = AudioInputMetronome.new(
|
|
24
30
|
|
25
31
|
# Audio FX
|
26
32
|
|
27
|
-
gain = AGain.new(level:
|
33
|
+
gain = AGain.new(level: -15)
|
28
34
|
|
29
35
|
|
30
36
|
# Bus
|
@@ -1,16 +1,24 @@
|
|
1
|
+
$LOAD_PATH << File.dirname(__FILE__) + "/../lib"
|
2
|
+
$LOAD_PATH << File.dirname(__FILE__) + "/../../ruby-audio_stream/lib"
|
3
|
+
|
1
4
|
require 'synthesizer'
|
2
5
|
require 'audio_stream'
|
3
6
|
|
4
7
|
include AudioStream
|
5
8
|
include Synthesizer
|
6
9
|
|
10
|
+
samplerate_list = [44100, 48000]
|
11
|
+
available_samplerates = CoreAudio.default_output_device.available_sample_rate.flatten.uniq
|
12
|
+
samplerate = samplerate_list.find {|rate| available_samplerates.include?(rate)} || available_samplerates.max
|
13
|
+
|
7
14
|
soundinfo = SoundInfo.new(
|
8
15
|
channels: 2,
|
9
|
-
samplerate:
|
16
|
+
samplerate: samplerate,
|
10
17
|
window_size: 1024,
|
11
18
|
format: RubyAudio::FORMAT_WAV|RubyAudio::FORMAT_PCM_16
|
12
19
|
)
|
13
20
|
|
21
|
+
|
14
22
|
synth = PolySynth.new(
|
15
23
|
oscillators: [
|
16
24
|
Oscillator.new(
|
@@ -44,7 +52,7 @@ track1 = AudioInputStepEditor.new(synth, se)
|
|
44
52
|
stereo_out = AudioOutput.device(soundinfo: soundinfo)
|
45
53
|
|
46
54
|
track1
|
47
|
-
.send_to(stereo_out, gain:
|
55
|
+
.send_to(stereo_out, gain: -6)
|
48
56
|
|
49
57
|
|
50
58
|
conductor = Conductor.new(
|
@@ -0,0 +1,73 @@
|
|
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 Synthesizer
|
9
|
+
|
10
|
+
samplerate_list = [44100, 48000]
|
11
|
+
available_samplerates = CoreAudio.default_output_device.available_sample_rate.flatten.uniq
|
12
|
+
samplerate = samplerate_list.find {|rate| available_samplerates.include?(rate)} || available_samplerates.max
|
13
|
+
|
14
|
+
soundinfo = SoundInfo.new(
|
15
|
+
channels: 2,
|
16
|
+
samplerate: samplerate,
|
17
|
+
window_size: 1024,
|
18
|
+
format: RubyAudio::FORMAT_WAV|RubyAudio::FORMAT_PCM_16
|
19
|
+
)
|
20
|
+
|
21
|
+
synth = PolySynth.new(
|
22
|
+
oscillators: [
|
23
|
+
Oscillator.new(
|
24
|
+
source: OscillatorSource::Sawtooth.instance,
|
25
|
+
),
|
26
|
+
],
|
27
|
+
filter: Filter::BandPassFilter.new(
|
28
|
+
freq: ModulationValue.new(1100.0)
|
29
|
+
.add(Modulation::Lfo.new(
|
30
|
+
shape: Shape::Sine,
|
31
|
+
delay: 0.0,
|
32
|
+
attack: 0.0,
|
33
|
+
attack_curve: Modulation::Curve::Straight,
|
34
|
+
phase: 0.0,
|
35
|
+
rate: 1.0
|
36
|
+
), depth: 1000.0),
|
37
|
+
bandwidth: 1.0
|
38
|
+
),
|
39
|
+
amplifier: Amplifier.new(
|
40
|
+
volume: ModulationValue.new(1.0)
|
41
|
+
.add(Modulation::Adsr.new(
|
42
|
+
attack: 0.05,
|
43
|
+
hold: 0.1,
|
44
|
+
decay: 0.4,
|
45
|
+
sustain: 0.8,
|
46
|
+
release: 0.2
|
47
|
+
), depth: 1.0),
|
48
|
+
),
|
49
|
+
soundinfo: soundinfo,
|
50
|
+
)
|
51
|
+
bufs = []
|
52
|
+
|
53
|
+
bufs += 50.times.map {|_| synth.next}
|
54
|
+
synth.note_on(Note.new(60))
|
55
|
+
bufs += 200.times.map {|_| synth.next}
|
56
|
+
synth.note_off(Note.new(60))
|
57
|
+
bufs += 50.times.map {|_| synth.next}
|
58
|
+
|
59
|
+
|
60
|
+
track1 = AudioInput.buffer(bufs)
|
61
|
+
|
62
|
+
stereo_out = AudioOutput.device(soundinfo: soundinfo)
|
63
|
+
|
64
|
+
track1
|
65
|
+
.send_to(stereo_out, gain: -15)
|
66
|
+
|
67
|
+
|
68
|
+
conductor = Conductor.new(
|
69
|
+
input: [track1],
|
70
|
+
output: [stereo_out]
|
71
|
+
)
|
72
|
+
conductor.connect
|
73
|
+
conductor.join
|
@@ -1,12 +1,19 @@
|
|
1
|
+
$LOAD_PATH << File.dirname(__FILE__) + "/../lib"
|
2
|
+
$LOAD_PATH << File.dirname(__FILE__) + "/../../ruby-audio_stream/lib"
|
3
|
+
|
1
4
|
require 'synthesizer'
|
2
5
|
require 'audio_stream'
|
3
6
|
|
4
7
|
include AudioStream
|
5
8
|
include Synthesizer
|
6
9
|
|
10
|
+
samplerate_list = [44100, 48000]
|
11
|
+
available_samplerates = CoreAudio.default_output_device.available_sample_rate.flatten.uniq
|
12
|
+
samplerate = samplerate_list.find {|rate| available_samplerates.include?(rate)} || available_samplerates.max
|
13
|
+
|
7
14
|
soundinfo = SoundInfo.new(
|
8
15
|
channels: 2,
|
9
|
-
samplerate:
|
16
|
+
samplerate: samplerate,
|
10
17
|
window_size: 1024,
|
11
18
|
format: RubyAudio::FORMAT_WAV|RubyAudio::FORMAT_PCM_16
|
12
19
|
)
|
@@ -65,7 +72,7 @@ track1 = AudioInput.buffer(bufs)
|
|
65
72
|
stereo_out = AudioOutput.device(soundinfo: soundinfo)
|
66
73
|
|
67
74
|
track1
|
68
|
-
.send_to(stereo_out, gain:
|
75
|
+
.send_to(stereo_out, gain: -6)
|
69
76
|
|
70
77
|
|
71
78
|
conductor = Conductor.new(
|
@@ -0,0 +1,70 @@
|
|
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 Synthesizer
|
9
|
+
|
10
|
+
samplerate_list = [44100, 48000]
|
11
|
+
available_samplerates = CoreAudio.default_output_device.available_sample_rate.flatten.uniq
|
12
|
+
samplerate = samplerate_list.find {|rate| available_samplerates.include?(rate)} || available_samplerates.max
|
13
|
+
|
14
|
+
soundinfo = SoundInfo.new(
|
15
|
+
channels: 2,
|
16
|
+
samplerate: samplerate,
|
17
|
+
window_size: 1024,
|
18
|
+
format: RubyAudio::FORMAT_WAV|RubyAudio::FORMAT_PCM_16
|
19
|
+
)
|
20
|
+
|
21
|
+
synth = PolySynth.new(
|
22
|
+
oscillators: [
|
23
|
+
Oscillator.new(
|
24
|
+
source: OscillatorSource::Sawtooth.instance,
|
25
|
+
pan: ModulationValue.new(0.0)
|
26
|
+
.add(Modulation::Lfo.new(
|
27
|
+
shape: Shape::Sine,
|
28
|
+
delay: 0.0,
|
29
|
+
attack: 0.0,
|
30
|
+
attack_curve: Modulation::Curve::Straight,
|
31
|
+
phase: 0.0,
|
32
|
+
rate: 1.0
|
33
|
+
), depth: 1),
|
34
|
+
),
|
35
|
+
],
|
36
|
+
amplifier: Amplifier.new(
|
37
|
+
volume: ModulationValue.new(1.0)
|
38
|
+
.add(Modulation::Adsr.new(
|
39
|
+
attack: 0.05,
|
40
|
+
hold: 0.1,
|
41
|
+
decay: 0.4,
|
42
|
+
sustain: 0.8,
|
43
|
+
release: 0.2
|
44
|
+
), depth: 1.0),
|
45
|
+
),
|
46
|
+
soundinfo: soundinfo,
|
47
|
+
)
|
48
|
+
bufs = []
|
49
|
+
|
50
|
+
bufs += 50.times.map {|_| synth.next}
|
51
|
+
synth.note_on(Note.new(60))
|
52
|
+
bufs += 200.times.map {|_| synth.next}
|
53
|
+
synth.note_off(Note.new(60))
|
54
|
+
bufs += 50.times.map {|_| synth.next}
|
55
|
+
|
56
|
+
|
57
|
+
track1 = AudioInput.buffer(bufs)
|
58
|
+
|
59
|
+
stereo_out = AudioOutput.device(soundinfo: soundinfo)
|
60
|
+
|
61
|
+
track1
|
62
|
+
.send_to(stereo_out, gain: -15)
|
63
|
+
|
64
|
+
|
65
|
+
conductor = Conductor.new(
|
66
|
+
input: [track1],
|
67
|
+
output: [stereo_out]
|
68
|
+
)
|
69
|
+
conductor.connect
|
70
|
+
conductor.join
|
@@ -1,12 +1,19 @@
|
|
1
|
+
$LOAD_PATH << File.dirname(__FILE__) + "/../lib"
|
2
|
+
$LOAD_PATH << File.dirname(__FILE__) + "/../../ruby-audio_stream/lib"
|
3
|
+
|
1
4
|
require 'synthesizer'
|
2
5
|
require 'audio_stream'
|
3
6
|
|
4
7
|
include AudioStream
|
5
8
|
include Synthesizer
|
6
9
|
|
10
|
+
samplerate_list = [44100, 48000]
|
11
|
+
available_samplerates = CoreAudio.default_output_device.available_sample_rate.flatten.uniq
|
12
|
+
samplerate = samplerate_list.find {|rate| available_samplerates.include?(rate)} || available_samplerates.max
|
13
|
+
|
7
14
|
soundinfo = SoundInfo.new(
|
8
15
|
channels: 2,
|
9
|
-
samplerate:
|
16
|
+
samplerate: samplerate,
|
10
17
|
window_size: 1024,
|
11
18
|
format: RubyAudio::FORMAT_WAV|RubyAudio::FORMAT_PCM_16
|
12
19
|
)
|
@@ -72,10 +79,10 @@ bufs += 50.times.map {|_| synth.next}
|
|
72
79
|
track1 = AudioInput.buffer(bufs)
|
73
80
|
|
74
81
|
stereo_out = AudioOutput.device(soundinfo: soundinfo)
|
75
|
-
#stereo_out = AudioOutput.file("
|
82
|
+
#stereo_out = AudioOutput.file("formant_vocoder.wav", soundinfo: soundinfo)
|
76
83
|
|
77
84
|
track1
|
78
|
-
.send_to(stereo_out, gain:
|
85
|
+
.send_to(stereo_out, gain: -6)
|
79
86
|
|
80
87
|
|
81
88
|
conductor = Conductor.new(
|
@@ -1,12 +1,19 @@
|
|
1
|
+
$LOAD_PATH << File.dirname(__FILE__) + "/../lib"
|
2
|
+
$LOAD_PATH << File.dirname(__FILE__) + "/../../ruby-audio_stream/lib"
|
3
|
+
|
1
4
|
require 'synthesizer'
|
2
5
|
require 'audio_stream'
|
3
6
|
|
4
7
|
include AudioStream
|
5
8
|
include Synthesizer
|
6
9
|
|
10
|
+
samplerate_list = [44100, 48000]
|
11
|
+
available_samplerates = CoreAudio.default_output_device.available_sample_rate.flatten.uniq
|
12
|
+
samplerate = samplerate_list.find {|rate| available_samplerates.include?(rate)} || available_samplerates.max
|
13
|
+
|
7
14
|
soundinfo = SoundInfo.new(
|
8
15
|
channels: 2,
|
9
|
-
samplerate:
|
16
|
+
samplerate: samplerate,
|
10
17
|
window_size: 1024,
|
11
18
|
format: RubyAudio::FORMAT_WAV|RubyAudio::FORMAT_PCM_16
|
12
19
|
)
|
@@ -21,7 +28,7 @@ synth = PolySynth.new(
|
|
21
28
|
.add(Modulation::Lfo.new(
|
22
29
|
shape: Shape::ForeverRampUp,
|
23
30
|
rate: 2.0,
|
24
|
-
)),
|
31
|
+
), depth: 5),
|
25
32
|
),
|
26
33
|
phase: 0.0,
|
27
34
|
),
|
@@ -51,9 +58,9 @@ bufs += 100.times.map {|_| synth.next}
|
|
51
58
|
synth.note_off(Note.new(base+4))
|
52
59
|
bufs += 20.times.map {|_| synth.next}
|
53
60
|
|
54
|
-
synth.note_on(Note.new(base+
|
61
|
+
synth.note_on(Note.new(base+7))
|
55
62
|
bufs += 100.times.map {|_| synth.next}
|
56
|
-
synth.note_off(Note.new(base+
|
63
|
+
synth.note_off(Note.new(base+7))
|
57
64
|
bufs += 20.times.map {|_| synth.next}
|
58
65
|
|
59
66
|
bufs += 50.times.map {|_| synth.next}
|
@@ -62,10 +69,10 @@ bufs += 50.times.map {|_| synth.next}
|
|
62
69
|
track1 = AudioInput.buffer(bufs)
|
63
70
|
|
64
71
|
stereo_out = AudioOutput.device(soundinfo: soundinfo)
|
65
|
-
#stereo_out = AudioOutput.file("
|
72
|
+
#stereo_out = AudioOutput.file("formant_vocoder_sweep.wav", soundinfo: soundinfo)
|
66
73
|
|
67
74
|
track1
|
68
|
-
.send_to(stereo_out, gain:
|
75
|
+
.send_to(stereo_out, gain: -6)
|
69
76
|
|
70
77
|
|
71
78
|
conductor = Conductor.new(
|
@@ -0,0 +1,71 @@
|
|
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 Synthesizer
|
9
|
+
|
10
|
+
samplerate_list = [44100, 48000]
|
11
|
+
available_samplerates = CoreAudio.default_output_device.available_sample_rate.flatten.uniq
|
12
|
+
samplerate = samplerate_list.find {|rate| available_samplerates.include?(rate)} || available_samplerates.max
|
13
|
+
|
14
|
+
soundinfo = SoundInfo.new(
|
15
|
+
channels: 2,
|
16
|
+
samplerate: samplerate,
|
17
|
+
window_size: 1024,
|
18
|
+
format: RubyAudio::FORMAT_WAV|RubyAudio::FORMAT_PCM_16
|
19
|
+
)
|
20
|
+
|
21
|
+
synth = PolySynth.new(
|
22
|
+
oscillators: [
|
23
|
+
Oscillator.new(
|
24
|
+
source: OscillatorSource::Sawtooth.instance,
|
25
|
+
sync: ModulationValue.new(0.0)
|
26
|
+
.add(Modulation::Lfo.new(
|
27
|
+
shape: Shape::PositiveRampUp,
|
28
|
+
#shape: Shape::Sine,
|
29
|
+
delay: 0.0,
|
30
|
+
attack: 0.0,
|
31
|
+
attack_curve: Modulation::Curve::Straight,
|
32
|
+
phase: 0.0,
|
33
|
+
rate: 2.0
|
34
|
+
), depth: 48),
|
35
|
+
),
|
36
|
+
],
|
37
|
+
amplifier: Amplifier.new(
|
38
|
+
volume: ModulationValue.new(1.0)
|
39
|
+
.add(Modulation::Adsr.new(
|
40
|
+
attack: 0.05,
|
41
|
+
hold: 0.1,
|
42
|
+
decay: 0.4,
|
43
|
+
sustain: 0.8,
|
44
|
+
release: 0.2
|
45
|
+
), depth: 1.0),
|
46
|
+
),
|
47
|
+
soundinfo: soundinfo,
|
48
|
+
)
|
49
|
+
bufs = []
|
50
|
+
|
51
|
+
bufs += 50.times.map {|_| synth.next}
|
52
|
+
synth.note_on(Note.new(60))
|
53
|
+
bufs += 200.times.map {|_| synth.next}
|
54
|
+
synth.note_off(Note.new(60))
|
55
|
+
bufs += 50.times.map {|_| synth.next}
|
56
|
+
|
57
|
+
|
58
|
+
track1 = AudioInput.buffer(bufs)
|
59
|
+
|
60
|
+
stereo_out = AudioOutput.device(soundinfo: soundinfo)
|
61
|
+
|
62
|
+
track1
|
63
|
+
.send_to(stereo_out, gain: -15)
|
64
|
+
|
65
|
+
|
66
|
+
conductor = Conductor.new(
|
67
|
+
input: [track1],
|
68
|
+
output: [stereo_out]
|
69
|
+
)
|
70
|
+
conductor.connect
|
71
|
+
conductor.join
|
@@ -0,0 +1,64 @@
|
|
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 Synthesizer
|
9
|
+
|
10
|
+
samplerate_list = [44100, 48000]
|
11
|
+
available_samplerates = CoreAudio.default_output_device.available_sample_rate.flatten.uniq
|
12
|
+
samplerate = samplerate_list.find {|rate| available_samplerates.include?(rate)} || available_samplerates.max
|
13
|
+
|
14
|
+
soundinfo = SoundInfo.new(
|
15
|
+
channels: 2,
|
16
|
+
samplerate: samplerate,
|
17
|
+
window_size: 1024,
|
18
|
+
format: RubyAudio::FORMAT_WAV|RubyAudio::FORMAT_PCM_16
|
19
|
+
)
|
20
|
+
|
21
|
+
synth = PolySynth.new(
|
22
|
+
oscillators: [
|
23
|
+
Oscillator.new(
|
24
|
+
source: OscillatorSource::Sawtooth.instance,
|
25
|
+
uni_num: 3,
|
26
|
+
uni_detune: 0.3,
|
27
|
+
uni_stereo: 1.0,
|
28
|
+
),
|
29
|
+
],
|
30
|
+
amplifier: Amplifier.new(
|
31
|
+
volume: ModulationValue.new(1.0)
|
32
|
+
.add(Modulation::Adsr.new(
|
33
|
+
attack: 0.05,
|
34
|
+
hold: 0.1,
|
35
|
+
decay: 0.4,
|
36
|
+
sustain: 0.8,
|
37
|
+
release: 0.2
|
38
|
+
), depth: 1.0),
|
39
|
+
),
|
40
|
+
soundinfo: soundinfo,
|
41
|
+
)
|
42
|
+
bufs = []
|
43
|
+
|
44
|
+
bufs += 50.times.map {|_| synth.next}
|
45
|
+
synth.note_on(Note.new(60))
|
46
|
+
bufs += 200.times.map {|_| synth.next}
|
47
|
+
synth.note_off(Note.new(60))
|
48
|
+
bufs += 50.times.map {|_| synth.next}
|
49
|
+
|
50
|
+
|
51
|
+
track1 = AudioInput.buffer(bufs)
|
52
|
+
|
53
|
+
stereo_out = AudioOutput.device(soundinfo: soundinfo)
|
54
|
+
|
55
|
+
track1
|
56
|
+
.send_to(stereo_out, gain: -15)
|
57
|
+
|
58
|
+
|
59
|
+
conductor = Conductor.new(
|
60
|
+
input: [track1],
|
61
|
+
output: [stereo_out]
|
62
|
+
)
|
63
|
+
conductor.connect
|
64
|
+
conductor.join
|
@@ -0,0 +1,70 @@
|
|
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 Synthesizer
|
9
|
+
|
10
|
+
samplerate_list = [44100, 48000]
|
11
|
+
available_samplerates = CoreAudio.default_output_device.available_sample_rate.flatten.uniq
|
12
|
+
samplerate = samplerate_list.find {|rate| available_samplerates.include?(rate)} || available_samplerates.max
|
13
|
+
|
14
|
+
soundinfo = SoundInfo.new(
|
15
|
+
channels: 2,
|
16
|
+
samplerate: samplerate,
|
17
|
+
window_size: 1024,
|
18
|
+
format: RubyAudio::FORMAT_WAV|RubyAudio::FORMAT_PCM_16
|
19
|
+
)
|
20
|
+
|
21
|
+
synth = PolySynth.new(
|
22
|
+
oscillators: [
|
23
|
+
Oscillator.new(
|
24
|
+
source: OscillatorSource::Sawtooth.instance,
|
25
|
+
volume: ModulationValue.new(0.0)
|
26
|
+
.add(Modulation::Lfo.new(
|
27
|
+
shape: Shape::Sine,
|
28
|
+
delay: 0.0,
|
29
|
+
attack: 0.0,
|
30
|
+
attack_curve: Modulation::Curve::Straight,
|
31
|
+
phase: 0.0,
|
32
|
+
rate: 0.5
|
33
|
+
), depth: 1),
|
34
|
+
),
|
35
|
+
],
|
36
|
+
amplifier: Amplifier.new(
|
37
|
+
volume: ModulationValue.new(1.0)
|
38
|
+
.add(Modulation::Adsr.new(
|
39
|
+
attack: 0.05,
|
40
|
+
hold: 0.1,
|
41
|
+
decay: 0.4,
|
42
|
+
sustain: 0.8,
|
43
|
+
release: 0.2
|
44
|
+
), depth: 1.0),
|
45
|
+
),
|
46
|
+
soundinfo: soundinfo,
|
47
|
+
)
|
48
|
+
bufs = []
|
49
|
+
|
50
|
+
bufs += 50.times.map {|_| synth.next}
|
51
|
+
synth.note_on(Note.new(60))
|
52
|
+
bufs += 200.times.map {|_| synth.next}
|
53
|
+
synth.note_off(Note.new(60))
|
54
|
+
bufs += 50.times.map {|_| synth.next}
|
55
|
+
|
56
|
+
|
57
|
+
track1 = AudioInput.buffer(bufs)
|
58
|
+
|
59
|
+
stereo_out = AudioOutput.device(soundinfo: soundinfo)
|
60
|
+
|
61
|
+
track1
|
62
|
+
.send_to(stereo_out, gain: -15)
|
63
|
+
|
64
|
+
|
65
|
+
conductor = Conductor.new(
|
66
|
+
input: [track1],
|
67
|
+
output: [stereo_out]
|
68
|
+
)
|
69
|
+
conductor.connect
|
70
|
+
conductor.join
|
@@ -1,12 +1,20 @@
|
|
1
|
+
$LOAD_PATH << File.dirname(__FILE__) + "/../lib"
|
2
|
+
$LOAD_PATH << File.dirname(__FILE__) + "/../../ruby-audio_stream/lib"
|
3
|
+
|
1
4
|
require 'synthesizer'
|
2
5
|
require 'audio_stream'
|
3
6
|
|
4
7
|
include AudioStream
|
8
|
+
include AudioStream::Fx
|
5
9
|
include Synthesizer
|
6
10
|
|
11
|
+
samplerate_list = [44100, 48000]
|
12
|
+
available_samplerates = CoreAudio.default_output_device.available_sample_rate.flatten.uniq
|
13
|
+
samplerate = samplerate_list.find {|rate| available_samplerates.include?(rate)} || available_samplerates.max
|
14
|
+
|
7
15
|
soundinfo = SoundInfo.new(
|
8
16
|
channels: 2,
|
9
|
-
samplerate:
|
17
|
+
samplerate: samplerate,
|
10
18
|
window_size: 1024,
|
11
19
|
format: RubyAudio::FORMAT_WAV|RubyAudio::FORMAT_PCM_16
|
12
20
|
)
|
@@ -73,7 +81,7 @@ track1 = AudioInput.buffer(bufs)
|
|
73
81
|
stereo_out = AudioOutput.device(soundinfo: soundinfo)
|
74
82
|
|
75
83
|
track1
|
76
|
-
.send_to(stereo_out, gain:
|
84
|
+
.send_to(stereo_out, gain: -6)
|
77
85
|
|
78
86
|
|
79
87
|
conductor = Conductor.new(
|
@@ -1,12 +1,20 @@
|
|
1
|
+
$LOAD_PATH << File.dirname(__FILE__) + "/../lib"
|
2
|
+
$LOAD_PATH << File.dirname(__FILE__) + "/../../ruby-audio_stream/lib"
|
3
|
+
|
1
4
|
require 'synthesizer'
|
2
5
|
require 'audio_stream'
|
3
6
|
|
4
7
|
include AudioStream
|
8
|
+
include AudioStream::Fx
|
5
9
|
include Synthesizer
|
6
10
|
|
11
|
+
samplerate_list = [44100, 48000]
|
12
|
+
available_samplerates = CoreAudio.default_output_device.available_sample_rate.flatten.uniq
|
13
|
+
samplerate = samplerate_list.find {|rate| available_samplerates.include?(rate)} || available_samplerates.max
|
14
|
+
|
7
15
|
soundinfo = SoundInfo.new(
|
8
16
|
channels: 2,
|
9
|
-
samplerate:
|
17
|
+
samplerate: samplerate,
|
10
18
|
window_size: 1024,
|
11
19
|
format: RubyAudio::FORMAT_WAV|RubyAudio::FORMAT_PCM_16
|
12
20
|
)
|
@@ -67,7 +75,7 @@ track1 = AudioInput.buffer(bufs)
|
|
67
75
|
stereo_out = AudioOutput.device(soundinfo: soundinfo)
|
68
76
|
|
69
77
|
track1
|
70
|
-
.send_to(stereo_out, gain:
|
78
|
+
.send_to(stereo_out, gain: -15)
|
71
79
|
|
72
80
|
|
73
81
|
conductor = Conductor.new(
|