-
Notifications
You must be signed in to change notification settings - Fork 1
/
spiegel.rb
64 lines (55 loc) · 1.23 KB
/
spiegel.rb
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
# Coded by Viktor Pavlov
# Piano part from Arvo Pärt's "Spiegel im Spiegel"
use_bpm 80
set :sequence, []
live_loop :receive_sequence do
use_real_time
seq = sync "/osc*/gen/sequence"
s = sync "/osc*/gen/steps"
set :sequence, seq.zip(s)
end
live_loop :metronome do
sleep 1
end
with_fx :reverb, room: 1 do
live_loop :piano_part, sync: :metronome do
F = (ring :C5, :F5, :A5)
Gm7 = (ring :As4, :F5, :G5)
Bbmaj7 = (ring :D5, :A5, :Bb5)
use_synth :piano
use_synth_defaults sustain: 0.8, release: 0.2, hard: 0.1
18.times do
play F.tick
sleep 1
end
6.times do
play Gm7.tick
sleep 1
end
24.times do
play F.tick
sleep 1
end
6.times do
play Bbmaj7.tick
sleep 1
end
end
live_loop :play_gen_sequence, sync: :metronome do
notes = get[:sequence] || []
puts notes
if notes.empty?
sleep 1
else
notes.each do |note, step|
use_synth :blade
use_synth_defaults amp: 0.4, attack: step * 0.4, decay: step * 0.1,
sustain: step * 0.3, release: step * 0.2, vibrato_rate: 7
play note
use_synth :square
play note, amp: 0.03
sleep step
end
end
end
end