Created
April 14, 2017 12:42
-
-
Save RemyPorter/55d5f80ee8f485b8ac9815a63288e88b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#A Fizzbuzz implementation for SonicPi | |
use_bpm 120 | |
live_loop :fizzbuzz do | |
fb = tick :fb | |
if fb % 3 == 0 | |
sample :bd_klub | |
end | |
if fb % 5 == 0 | |
sample :sn_zome | |
end | |
sleep 0.25 | |
end | |
f = (range(0,128).inject({:'3'=>[], :'5'=>[]}) do |acc,i| | |
puts acc | |
if i % 3 == 0 | |
acc[:'3'] <<= i | |
end | |
if i % 5 == 0 | |
acc[:'5'] <<= i | |
end | |
acc | |
end) | |
live_loop :fizz_m do | |
sync :fizzbuzz | |
fizz = tick(:fizz) | |
fs = (ring *f[:'3']).shuffle() | |
use_synth :hoover | |
use_synth_defaults cutoff: 100, sustain_level: 0.5 | |
if false #fizz % 3 == 0 | |
play fs[fizz] | |
control note: fs[fizz+1], note_slide: 0.75 if one_in(10) | |
end | |
end | |
live_loop :buzz_m do | |
sync :fizzbuzz | |
buzz = tick(:buzz) | |
use_synth :tb303 | |
use_synth_defaults cutoff: 110, cutoff_min: 60, res: 0.99, wave: 1, pulse_width: 0.2, sustain_level: 0.5 | |
bs = (ring *f[:'5']).shuffle | |
if false #buzz % 5 == 0 | |
play bs[buzz] | |
control note: bs[buzz+1], note_slide: 0.75 if one_in(10) | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment