Skip to content

Instantly share code, notes, and snippets.

@odiak
Created July 31, 2021 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odiak/5f4ee09e2ab97480a4a71edce640f4d5 to your computer and use it in GitHub Desktop.
Save odiak/5f4ee09e2ab97480a4a71edce640f4d5 to your computer and use it in GitHub Desktop.
# Welcome to Sonic Pi
use_random_seed 1
use_bpm 120
int = 1.0 / 8
d1 = [1, 0, 0, 0, 0.05, 0, 0, 0]
d2 = [0, 0, 0, 0, 1, 0, 0.1, 0]
d3 = [0, 0, 0.05, 0, 0, 0, 0, 0]
live_loop :d1 do
d1.each do |d|
if d == 1 or rand < d
sample :bd_ada
end
sleep int
end
end
live_loop :d2 do
d2.each do |d|
if d == 1 or rand < d
sample :drum_cymbal_closed, amp: 0.9
end
sleep int
end
end
live_loop :d3 do
d3.each do |d|
if d == 1 or rand < d
sample :drum_cymbal_pedal
end
sleep int
end
end
my_scale = scale(:c4, :major_pentatonic)
notes = []
7.times do
notes << choose(my_scale)
end
notes << nil
live_loop :m1 do
use_synth :fm
notes.each do |n|
play n unless n.nil?
sleep 1/4r
end
if rand < 0.8
i = rand(0..6)
notes[i] = choose(my_scale)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment