Thanks!
I have no problem sharing the code but I’m not sure how useful it will be since I am almost exclusively using external samples.
I started the song by defining all the sample libraries to be used and then arrange them using time_warps, sleep, and spread. I also use line and mirror to create LFO’s and repeating ramps. For individual instrument volume control I added variables which control the Level FX. I also added a variable called part which I can use to control sound variation. I also added modifiers for rate and sleep but never ended up using them in the end result, however they are pretty fun to play with…
Here’s the code:
# INITIALIZE MASTER VALUES
use_bpm 42
counter0 = 0
# LOAD IN SAMPLE LIBRARIES
mabinogi = "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/Mabinogi" #[0-2]
win95 = "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/W95" #[0-4]
mgsMenu = "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MG/Menu/" #[0-87]
drumSamp = "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/Free Drums 1/" #[0-59]
outrun = "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/Outrun 1/" #[0-39]
slomo = "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/Slomo 1/" #[0-18]
otacon = "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MG/O/" #[0-87]
weapon = "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MG/W/" #[0-18]
# PART
part = 0
# LEVELS
windows95_lvl = 0
euclid_lvl = 1
euclid2_lvl = 1
exo_lvl = 1
exo2_lvl = 0
kick_lvl = 0
ticker_lvl = 1
slap_lvl = 0
camera_lvl = 0
thin_lvl = 0
thin2_lvl = 0
thin3_lvl = 0
elevator_lvl = 1
trap_lvl = 0
# MODIFIERS
trap_sleep_mod = 1
rate_mod = 1
# AUTOMATION
line_Riser0 = (line 10, 0, inclusive: true, steps: 16)
line_Riser1 = (line 8, 0, inclusive: true, steps: 128)
line_Riser2 = (line 10, 0, inclusive: true, steps: 32)
lfo0 = (line 1, 100, inclusive: true, steps: 4).mirror #Mirror makes the LFO rise then fall
lfo1 = (line 100, 130, inclusive: true, steps: 8).mirror #Mirror makes the LFO rise then fall
pan0 = (line -1, 1, inclusive: true, steps: 128).mirror #Mirror makes the LFO rise then fall
pan1 = (line -1, 1, inclusive: true, steps: 2)
live_loop :windows95 do
if part == 0
with_fx :level, amp: windows95_lvl do
sample mabinogi, 1, rate: 0.2*rate_mod, beat_stretch: 0.01, attack: 0, pan: 0.2
end
puts line_Riser0.look
puts tick
end
if part == 1
with_fx :level, amp: windows95_lvl do
sample mabinogi, 2, rate: 0.02*rate_mod, beat_stretch: 0.01, attack: 0.6, pan: -0.4
end
puts line_Riser0.look
puts tick
end
sleep 16
end
live_loop :euclid do
if part == 0
puts tick
with_fx :level, amp: euclid_lvl do
sample mabinogi, 2, rate: (ring 0.7, 0.8)[counter0]*rate_mod, pan: -0.2 if (spread 2, 16).look
end
with_fx :level, amp: euclid2_lvl do
sample mabinogi, 0, rate: 0.5*rate_mod, pan: -0.2 if (spread 1, 16).look
end
# Counter for pitch variation
if (spread 1, 8).look
counter0 = counter0+1
end
end
if part == 1
puts tick
with_fx :level, amp: euclid2_lvl do
with_fx :panslicer do
sample mabinogi, 0, rate: 0.5*rate_mod, pan: -0.2 if (spread 1, 16).look
end
end
if (spread 1, 8).look
counter0 = counter0+1
end
end
sleep 1
end
live_loop :exo do
if part == 0
puts tick
time_warp 2.5 do
with_fx :level, amp: exo_lvl do
sample mgsMenu, 10, rate: 0.4*rate_mod, pan: 0.5 if (spread 2, 16).look
end
time_warp 6 do
with_fx :level, amp: exo2_lvl do
with_fx :echo, mix: 0.4 do
sample mgsMenu, 48, rate: 1.2*rate_mod, pan: 0.5 if (spread 1, 16).look
end
end
end
end
end
if part == 1
puts tick
time_warp 2.5 do
with_fx :level, amp: exo_lvl do
with_fx :ixi_techno do
sample mgsMenu, 9, rate: 0.2*rate_mod, pan: 0.8 if (spread 1, 16).look
end
end
time_warp 4 do
with_fx :level, amp: exo2_lvl do
with_fx :echo, mix: 0.4 do
sample mgsMenu, 44, rate: 0.5*rate_mod, pan: -0.3, finish: 0.47 if (spread 1, 16).look
end
end
end
end
end
sleep 1
end
# KICK
live_loop :kick do
if part == 1
puts tick
with_fx :level, amp: kick_lvl do
sample :bd_haus, rate: 1*rate_mod, cutoff: 50, pan: 0.1
sample drumSamp, 11, cutoff: 90, rate: 1*rate_mod , pan: -0.1 if (spread 8, 16).look
end
sleep 2
end
if part == 0
puts tick
with_fx :level, amp: kick_lvl do
sample :bd_haus, rate: 1*rate_mod, cutoff: 30, pan: 0.1
with_fx :echo, phase: 0.25, mix: 0.2 do
sample otacon, 10, rate: 2*rate_mod, cutoff: (ring 90, 0, 130, 130).look, pan: (ring -0.1, 0, -1, -0.5).look, attack: (ring 0, 100, 30, 20).look
end
sleep 0.125
/ with_fx :krush do/
/sample :bd_haus, rate: 1*rate_mod, cutoff: 35, pan: 0/
sample :bd_haus, rate: 1*rate_mod, cutoff: 75, pan: 0
/end/
end
sleep 1.875
end
end
# TICKER
live_loop :ticker do
if part == 1
puts tick
with_fx :level, amp: ticker_lvl do
sample mgsMenu, 5, attack: line_Riser1.tick, beat_stretch: 0.1, rate: 1*rate_mod, pan: -0.1 if (spread 16, 16).look
end
end
if part == 0
puts tick
with_fx :level, amp: ticker_lvl do
sample mgsMenu, 8, attack: line_Riser2.tick, beat_stretch: 0.1, rate: 1*rate_mod, pan: pan0.look if (spread 16, 16).look
end
end
sleep 0.125
end
# SLAP
live_loop :slap do
if part == 0
sync :exo
puts tick
with_fx :level, amp: slap_lvl do
with_fx :lpf, cutoff: lfo1.look do
with_fx :echo, mix: 0.05 do
sample outrun, 23, amp: 0.5, rate: 0.7*rate_mod, pan: -0.1 if (spread 8, 16).look
end
end
end
/sleep 1/
end
if part == 1
puts tick
time_warp 0 do
with_fx :level, amp: slap_lvl do
with_fx :lpf, cutoff: lfo1.look do
with_fx :ixi_techno, phase: 0.25, mix: 0.05 do
sample weapon, 4, amp: 0.5, rate: 2*rate_mod, pan: pan1.look*0.6 if (spread 6, 16).look
end
end
end
end
sleep 0.25
end
end
# CAMERA
live_loop :camera do
if part == 0
time_warp 7.25 do
puts tick
with_fx :level, amp: camera_lvl do
sample mgsMenu, 51, rate: 1.2*rate_mod, pan: choose([-0.4, -0.3, -0.15, 0.15, 0.3, 0.4]) if (spread 1, 16).look
end
end
sleep 1
end
if part == 1
time_warp 7.25 do
puts tick
with_fx :level, amp: camera_lvl do
sample win95, 0, rate: 2*rate_mod, finish: 0.1, pan: choose([-0.3, 0.3]) if (spread 3, 16).look
sleep 0.5
sample weapon, 12, rate: 4*rate_mod, cutoff: 120, pan: choose([-0.15, 0.15]) if (spread 1, 16).look
end
end
end
sleep 0.5
end
# THIN
live_loop :thin do
if part == 1
time_warp 1 do
puts tick
with_fx :level, amp: thin_lvl do
sample mgsMenu, 58, rate: 1.4*rate_mod, pan: -0.38 if (spread 6, 32).look
end
time_warp 5 do
with_fx :level, amp: thin2_lvl do
sample mgsMenu, 66, rate: 0.3*rate_mod, pan: 0.48 if (spread 1, 32).look
end
end
time_warp 0.46 do
with_fx :level, amp: thin3_lvl do
sample mgsMenu, 68, rate: 1*rate_mod, pan: -0.5 if (spread 1, 16, rotate:1).look
end
end
end
end
if part == 0
time_warp 1 do
puts tick
with_fx :level, amp: thin_lvl do
sample mgsMenu, 12, rate: 3.4*rate_mod, pan: (ring -0.38, -0.12, 0.6).look if (spread 6, 32).look
end
time_warp 10.25 do
with_fx :level, amp: thin2_lvl do
with_fx :echo, phase: 0.125 do
sample mgsMenu, 5, rate: 2*rate_mod, finish: 0.2, cutoff: 100, pan: -0.15 if (spread 1, 32).look
end
end
end
end
end
sleep 1
end
# ELEVATOR
live_loop :elevator do
if part == 0
time_warp 4 do
with_fx :level, amp: elevator_lvl do
with_fx :gverb, mix: 0.2 do
puts tick
sample mgsMenu, 45, rate: 0.4*rate_mod, pan: 0.4 if (spread 1, 16).look
end
end
end
end
if part == 1
time_warp 4 do
with_fx :level, amp: elevator_lvl do
with_fx :gverb, mix: 0.2 do
puts tick
sample slomo, 8, rate: 0.4*rate_mod, pan: 0.4 if (spread 1, 16).look
end
end
end
end
sleep 1
end
define :trap_hats do |smp, div, s_rate, e_rate|
with_sample_defaults sustain: 0.015, release: 0.015, amp: 2 do
rate_div = (s_rate - e_rate) / div.to_f
div.times do
sample smp, sustain: 0.02, amp: rrand(0.5, 0.9), rate: s_rate*rate_mod
sleep (0.5/div)*trap_sleep_mod
s_rate = s_rate - rate_div
end
end
end
live_loop :hats do
trap0 = mgsMenu, choose([10,11])
with_fx :level, amp: trap_lvl*0.5 do
with_fx :flanger, wave: choose([0, 1, 2, 3, 4]) do
trap_hats(:perc_till, [1, 2, 3, 4, 6, 8, 12, 16].choose, rrand(0.7, 1.3), rrand(0.7, 1.3))
trap_hats(trap0, [1, 2, 3, 4].choose, rrand(0.7, 1.3), rrand(0.7, 1.3))
end
end
end
I then execute the code and record myself playing freestyle. I take the freestyle and chop it into short bar segments. Then I made a second code which arranges my best chops into a song (I discard the bad chops).
Here’s the second code of the arranged chops:
# INITIALIZE MASTER VALUES
use_bpm 42
counter0 = 0
# LOAD IN SAMPLE LIBRARIES
mgsChop = "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/Chops 1" #[0-51]
2. times do
1.times do
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.3.wav"
sleep 8
end
1.times do
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.5.wav"
sleep 8
end
end
1.times do
s0 = 0.75
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.3.wav",
start: 0, finish: 0.0625
sleep 0.5
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.3.wav",
start: 0, finish: 0.0625
sleep 0.5
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.3.wav",
start: 0, finish: 0.0625, rate: -1
sleep 0.5
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.5.wav",
start: s0, finish: s0 + 0.0625*0.25, rate: -1
/sleep 0.25/
3.times do
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.5.wav",
start: s0, finish: s0 + 0.0625*0.25, rate: -1
sleep 0.125
end
sleep 0.0625
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.3.wav",
start: 0, finish: 0.125, rate: 0.5
sleep 2
/Total = 4/
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.7.wav",
start: s0, finish: s0+0.25
sleep 2
/Total = /
end
1.times do
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.23.wav",
rate: 0.5
sleep 8
end
1.times do
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.25.wav"
sleep 8
end
1.times do
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.23.wav",
start: 0.5, finish: 0.85, rate: 0.5
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.25.wav"
sleep 8
end
1.times do
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.27.wav"
sleep 8
end
1.times do
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.29.wav"
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.23.wav",
start: 0.5, finish: 0.9, rate: -0.5
sleep 8
end
2.times do
1.times do
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.91.wav"
sleep 8
end
1.times do
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.5.wav"
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.101.wav",
start: 0, finish: 1, rate: -0.5
sleep 8
end
end
1.times do
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.39.wav"
sleep 8
end
1.times do
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.41.wav"
sleep 1
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.37.wav",
start: 0, finish: 0.25, rate: -0.5
sleep 7
end
1.times do
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.75.wav"
sleep 0.0625
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.37.wav",
start: 0, finish: 0.25, rate: -0.5
sleep 7.9375
end
1.times do
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.5.wav"
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.21.wav",
start: 0.275, finish: 0.75, rate: -0.5
sleep 8
end
1.times do
s0 = 0.75
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.93.wav",
start: 0, finish: 0.125, rate: -0.5
sleep 0.125
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.35.wav",
start: s0, finish: s0 + 0.0625*0.25, rate: -1
/sleep 0.25/
1.times do
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.97.wav",
start: s0, finish: s0 + 0.0625*0.25, rate: -1
sleep 0.125
end
sleep 0.0625
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.3.wav",
start: 0, finish: 0.125, rate: 0.5
sleep 2
/Total = 4/
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.7.wav",
start: s0, finish: s0+0.25
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.19.wav",
start: 0, finish: 0.25, rate: -0.5
sleep 2
/Total = /
end
1.times do
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.101.wav",
start: 0.5, finish: 1, rate: -0.5
sample "/Users/sheamkennedy/Desktop/Sonic Pi Files/SPi - Samples/MGS Chops 1/MGS 1 Take 1.13.wav",
start: 0.25, finish: 0.5, rate: -0.5
sleep 8
end
I hope that helps. I’m sure the code won’t offer much insight but maybe understanding how I resampled chops from a take and arranged them with a new code will help someone.