Skip to content

Commit 06877fd

Browse files
committedFeb 10, 2015
Add sonic pi code
1 parent 65f78bb commit 06877fd

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
 

‎devils_staircase.rb

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Welcome to Sonic Pi v2.0
2+
#volume, octave(frequency, finger/hand
3+
amount_fingers = 5
4+
5+
define :finger do |n|
6+
in_thread do
7+
t = 0
8+
loop do
9+
puts "finger is #{n}"
10+
if n == 0
11+
audio_level = t/11.0
12+
elsif n == amount_fingers-1
13+
audio_level = 1.0-(t/11.0)
14+
else
15+
audio_level = 1
16+
end
17+
audio_level
18+
play 12 * n + 50 + t, amp: audio_level
19+
sleep 0.5
20+
if t < 11
21+
t = t + 1
22+
else
23+
t = 0
24+
end
25+
puts t
26+
27+
end
28+
end
29+
end
30+
31+
amount_fingers.times do |n|
32+
finger(n)
33+
end

0 commit comments

Comments
 (0)
Please sign in to comment.