Skip to content

Instantly share code, notes, and snippets.

@AlexandreRangel
Created November 28, 2016 21:31
Show Gist options
  • Save AlexandreRangel/ac7ea3d7399a7f8ffc33baba291256c6 to your computer and use it in GitHub Desktop.
Save AlexandreRangel/ac7ea3d7399a7f8ffc33baba291256c6 to your computer and use it in GitHub Desktop.
Sonic Pi music code
# Alexandre rANGEL 'this is a trip' v10
# www.quasecinema.org
# 27-Nov-2016
# Sonic Pi 2.11
set_recording_bit_depth! 32
set_sched_ahead_time! 4
use_bpm 96
note1 = 60
note2 = 63
arrangement = true
live_loop :perc do
note1previous = note1
note1 = scale(-16,:blues_minor,num_octaves: 3).tick if one_in(2)
note1 = note1previous - 1 if one_in(6)
note1 = note1previous - 2 if one_in(11)
note1 = note1previous if one_in(8)
note2previous = note2
note2 = scale(-16,:blues_minor,num_octaves: 3).choose if one_in(2)
note2 = note2previous - 1 if one_in(4)
note2 = note2previous - 2 if one_in(8)
note2 = note2previous if one_in(6)
print "note1: #{note1}"
print "note2: #{note2}"
with_fx :bitcrusher, sample_rate: rrand(100,44000),
mix: rrand(0.2,0.8) do
if one_in(3)
#note1 = scale(-16,:blues_minor,num_octaves: 3).tick if one_in(2)
sample [:elec_plip,:elec_ping].choose,
rpitch: note1,
amp: 2.0+rand(0.5)
else
#note2 = scale(-16,:blues_minor,num_octaves: 3).choose if one_in(2)
sample [:elec_plip,:elec_ping].choose,
rpitch: note2,
amp: 2.0+rand(0.5)
end
end
sleep 0.25
end
sleep 18 if arrangement == true
live_loop :arp1 do
t3 = tick
use_synth [:piano,:beep,:chiplead,:chiplead,:hollow,:pluck].choose if one_in(4)
with_fx :flanger, phase: [1,2,4].choose,
phase_slide: [1,2].choose, mix: 0.5 do
with_fx :ring_mod, freq: rrand(30,90), freq_slide: 1,
phase: [0.25,0.5].choose, mix: rrand(0.3,0.6) do
with_fx :ring_mod, freq: rand(100), freq_slide: 1,
phase: [0.25,0.5].choose, mix: rrand(0.3,0.6) do
with_fx :slicer, phase: [0.25,0.5].choose do
if one_in(3)
play scale((ring :e2,:g2,:c3)[t3/24],:blues_major,num_octaves: 1)[t3],
release: 2.5 * [1,1,1,2].choose
else
play scale((ring (ring :e2,:f3)[t3/64],:g2)[t3/16],:blues_major,num_octaves: 1).choose,
release: 2.5 * [1,1,1,2].choose
end
end
end
end
end
sleep 1.5
sleep 1.5 if one_in(16)
sleep 3 if one_in(24)
end
sleep 12 if arrangement == true
##| live_loop :kick do
##| sample :bd_fat, amp: 3+rand(1) if one_in([3,4].choose)
##| sleep 0.25
##| end
sleep 12 if arrangement == true
sleep 0.25
live_loop :drums do
with_fx :compressor do
sample :bd_klub, amp: 8+rand(0.4)
sample :drum_bass_soft, amp: 2+rand(1.4)
end
sleep 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment