Skip to content

Instantly share code, notes, and snippets.

@Freemoth
Created January 13, 2017 02:37
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Freemoth/d30dca4c479752f0a696199d0bd73ba1 to your computer and use it in GitHub Desktop.
Random Piano No. 2
# randPiano-no.2.txt
# sonic(K) December 5, 2015
use_debug false
use_bpm 88
live_loop :pianoHigh do
a = 24.times.map{ rand(36..100) }
puts "#{a}"
with_synth :piano do
play_pattern_timed a, [0.25, 0.125].choose, stereo_width: 0.5
end
end
live_loop :pianoLow, delay: 4 do
b = 6.times.map{ rand(15..36) }
puts "b: #{b}"
with_synth :piano do
play_pattern_timed b, [0.5, 0.75], release: 0.1, stereo_width: 0.5
end
end
live_loop :interjections, delay: 48 do
c = 6.times.map{ rand(65..85) }
puts "c: #{c}"
if one_in(2)
with_synth :mod_fm do
play c[2], amp: 0.5, attack: 0.4, mod_phase: rand(0.125..0.25), depth: 2, pan: [-1, 0, 1].choose
sample [:elec_cymbal, :drum_cymbal_soft, :drum_splash_soft ].choose, amp: 0.75, pan: [-1, 0, 1].choose
sleep [1, 2, 4, 8].choose
end
else
with_synth :dsaw do
play c[3, 5].choose, amp: 0.7, attack: rand(0..0.5), detune: 0.5, cutoff: rand(75..95), pan: [-1, 0, 1].choose
sample [:elec_cymbal, :drum_cymbal_soft, :drum_splash_soft ].choose, amp: 0.75, pan: [-1, 0, 1].choose
sleep [1, 2, 4, 8].choose
end
end
end
live_loop :bassDrum, delay: 24 do
sample :bd_ada, rate: rand(1..1.1)
sleep [0.5, 1, 2, 4, 8].choose
end
live_loop :snare, delay: 36 do
sample [:drum_snare_hard, :drum_snare_soft].choose, rate: rand(1..1.5), pan: rand(-0.1..0.1)
sleep [0.25, 0.5, 1, 2, 4, 8].choose
end
@Freemoth
Copy link
Author

Code for "Random Piano No.2" by sonic(K). Audio is here https://soundcloud.com/freemoth/random-piano-no2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment