Skip to content

Instantly share code, notes, and snippets.

@bengm
Created November 12, 2015 00:34
Show Gist options
  • Save bengm/11a9a384ca4dfc358e6e to your computer and use it in GitHub Desktop.
Save bengm/11a9a384ca4dfc358e6e to your computer and use it in GitHub Desktop.
Playing with creating an endless drum solo in Sonic Pi, iteration 1
# Sonic Pi Reference
bass_drums = [:bd_ada,:bd_pure,:bd_808,:bd_zum,:bd_gas,:bd_sone,:bd_haus,:bd_zome,:bd_boom,:bd_klub,:bd_fat,:bd_tek]
drums = [:drum_heavy_kick,:drum_tom_mid_soft,:drum_tom_mid_hard,:drum_tom_lo_soft,:drum_tom_lo_hard,:drum_tom_hi_soft,:drum_tom_hi_hard,:drum_splash_soft,:drum_splash_hard,:drum_snare_soft,:drum_snare_hard,:drum_cymbal_soft,:drum_cymbal_hard,:drum_cymbal_open,:drum_cymbal_closed,:drum_cymbal_pedal,:drum_bass_soft,:drum_bass_hard]
electric_sounds = [:elec_triangle,:elec_snare,:elec_lo_snare,:elec_hi_snare,:elec_mid_snare,:elec_cymbal,:elec_soft_kick,:elec_filt_snare,:elec_fuzz_tom,:elec_chime,:elec_bong,:elec_twang,:elec_wood,:elec_pop,:elec_beep,:elec_blip,:elec_blip2,:elec_ping,:elec_bell,:elec_flip,:elec_tick,:elec_hollow_kick,:elec_twip,:elec_plip,:elec_blup]
percs = [:perc_bell,:perc_snap,:perc_snap2]
# configuration options
hits_dist = [0,0,1,2,2,2,2,2,2,2,2,2,2,4,4,4,4,8,16]
loop_length = 0.5
bass_drum_set = bass_drums
sample_1_set = drums
sample_2_set = drums + percs + electric_sounds
# the loop...
live_loop :foo do
bass_drum = bass_drum_set.sample
sample_1 = sample_1_set.sample
sample_2 = sample_2_set.sample
sample :ambi_choir, pan: rrand(-1,1), rate: rrand(-2,1) if rand < 0.2
4.times do
hits = hits_dist.sample
if hits == 0
sleep loop_length
else
hits.times do |h|
sample bass_drum if h == 0
s = (h % 2) ? sample_1 : sample_2
sample s
sleep loop_length / hits
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment