Created
July 14, 2021 16:24
-
-
Save binarysweets/3503d980a8aa5525b8d869fb450fbd79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Title: Balancing Act (Binarysweets Remix) | |
# Artist: Incentive | |
# Date: July 2021 | |
# License: cc-by | |
# Sonic Pi v3.2.2 (Win 10) | |
# https://binarysweets.bandcamp.com/ | |
# Settings | |
use_bpm 84 | |
bar_length = 4 | |
use_random_seed 20210712 | |
swing = (ring 0.01, -0.01) | |
sample_root = "~/Balancing Act Remix/Samples/" | |
sample_folder = "~/Sonic Pi/Samples/" | |
# Scale | |
mode = :minor | |
scl = scale(:e1, mode, num_octaves: 4) | |
# Functions | |
define :get_pitch_from_note do |note, sample_base_note, fine_tune| | |
return note - sample_base_note + fine_tune | |
end | |
define :bar do |length = 8| | |
sleep bar_length * length | |
end | |
# Loops | |
define :bass do |length = 8, pattern = 1| | |
in_thread do | |
s = sample_root + "twobass.wav" | |
notes = (ring 7,8,7,6) | |
((bar_length * length)).times do ; tick | |
sample s, rpitch: get_pitch_from_note(scl[notes.tick(:n)], 40, 0), | |
amp: rrand(1.4, 1.6), pan: -0.2 if pattern == 1 and bools(1,0,1,0).look | |
with_synth [:square, :growl].look do | |
play scl[notes.look(:n)], | |
amp: 0.1, | |
attack: 0, | |
sustain: 1, | |
release: 0, | |
pan: -0.2 | |
end | |
sleep 1 + swing.look | |
end | |
end | |
end | |
define :long_bass do |length = 8, pattern = 1| | |
in_thread do | |
s = sample_root + "twobass.wav" | |
notes = (ring 7,8,7,6, 7,8,9,10) | |
((bar_length * length / 4)).times do ; tick | |
sample s, rpitch: get_pitch_from_note(scl[notes.tick(:n)], 40, 0), | |
amp: rrand(1.4, 1.6), pan: -0.2 | |
with_synth [:square, :growl].look do | |
play scl[notes.look(:n)], | |
amp: 0.1, | |
attack: 0, | |
sustain: 4, | |
release: 0, | |
pan: -0.2 | |
end | |
sleep 4 + swing.look | |
end | |
end | |
end | |
define :spin do |length = 8, pattern = 1| | |
in_thread do | |
s = sample_root + "spin.wav" | |
idx = get[:lead_counter] | |
phase_line = (line 8, 1, steps: 128, inclusive: true) + | |
(knit 1, 64) + (line 1, 4, steps: 64, inclusive: true) | |
((bar_length * length * 4)).times do ; tick | |
with_fx :ixi_techno, phase: phase_line[idx] do | |
sample s, slice: look, num_slices: 32, amp: rrand(1.8, 2.1) | |
end | |
sleep 0.25 + swing.look | |
set :lead_counter, idx += 1 | |
end | |
end | |
end | |
define :fart_moves do |length = 8, pattern = 1| | |
in_thread do | |
s = sample_root + "fart_moves.wav" | |
slices = (line 4, 7, steps: 4, inclusive: true).mirror | |
with_fx :eq, low_note: 42, low: -1 do | |
((bar_length * length * 4)).times do ; tick | |
sample s, slice: slices.look, num_slices: 32, amp: rrand(1.3, 1.5), release: 1 | |
sleep 0.25 + swing.look | |
end | |
end | |
end | |
end | |
define :dang do |length = 8, pattern = 1| | |
in_thread do | |
s = sample_root + "dang.wav" | |
((bar_length * length * 4)).times do ; tick | |
sample s, amp: rrand(1.0, 1.2), slice: pick, num_slices: 32, release: 1, rate: -1 | |
sleep 0.25 + swing.look | |
end | |
end | |
end | |
define :breakbeat do |length = 8, pattern = 1| | |
in_thread do | |
s = sample_folder + "UT_011_STRNGR BRK_95_A#.wav" | |
slices = (line 0, 15, steps: 16, inclusive: true) if pattern == 1 | |
slices = (line 0, 7, steps: 8, inclusive: true) if pattern == 2 | |
slices = (line 0, 15, steps: 16, inclusive: true).shuffle if pattern == 3 | |
sample_rate = 1 | |
sample_rate = 0.5 if pattern == 3 | |
((bar_length * length) * 4).times do ; tick | |
beat_stretch = 8 #[16,16,16,17].choose | |
sample s, slice: slices.look, amp: rrand(0.9, 1.2), | |
rpitch: 0.02, pan: 1 | |
sample s, slice: slices.look, num_slices: 16, amp: rrand(0.9, 1.2), | |
rpitch: -0.02, pan: -1 | |
sleep 0.25 + swing.look | |
end | |
end | |
end | |
define :breakbeat2 do |length = 8, pattern = 1| | |
in_thread do | |
s = sample_folder + "UT_008_STRNGR BRK_90_E.wav" | |
slices = (line 0, 15, steps: 16, inclusive: true) if pattern == 1 | |
((bar_length * length) * 4).times do ; tick | |
beat_stretch = [16,8].choose #[16,16,16,17].choose | |
sample s, slice: slices.look, amp: rrand(0.2, 0.4), num_slices: 32, | |
beat_stretch: beat_stretch, | |
rpitch: 0.02, pan: 1 | |
sample s, slice: slices.look, num_slices: 32, amp: rrand(0.2, 0.4), | |
beat_stretch: beat_stretch, | |
rpitch: -0.02, pan: -1 | |
sleep 0.25 + swing.look | |
end | |
end | |
end | |
define :bleeps do |length = 8, pattern = 1| | |
in_thread do | |
notes = (ring 28,21) | |
((bar_length * length / 2)).times do ; tick | |
with_fx :ping_pong, feedback: 0.8 do | |
play scl[notes.look], release: 1, amp: (line 0.01, 0.1, steps: 16).look | |
end | |
sleep 2 + swing.look | |
end | |
end | |
end | |
# Reset globals | |
set :lead_counter, 0 | |
# Structure | |
with_fx :compressor, threshold: 0.5 do | |
breakbeat(8,1) ; bleeps ; bar | |
breakbeat(8,1) ; breakbeat2(8,1) ; bar | |
fart_moves(7,1) ; bar(7) ; dang(1,1) ; bar(1) | |
bass(8,1) ; breakbeat(7,1) ; breakbeat2(8,1) ; bar | |
bass(8,2) ; breakbeat(7,1) ; breakbeat2(8,1) ; bleeps ; bar | |
bass(8,1) ; breakbeat(8,1) ; breakbeat2(8,1) ; spin ; bar | |
long_bass(8,1) ; breakbeat(8,1) ; breakbeat2(8,1) ; spin ; bar | |
long_bass(8,1) ; breakbeat(8,1) ; fart_moves ; bar | |
long_bass(8,1) ; bar | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment