Desktop Raver.
Inspired by raving at your desktop in winter.
# Title: Desktop Raver
# Artist: Binarysweets
# Date: November 2020
# License: cc-by
# Sonic Pi v3.2.2 (Win 10)
# Settings
use_bpm 125
bar_length = 4
use_random_seed 1713.20201118
swing = (ring 0.01, -0.01)
root = "C:/Users/LeeBridge/OneDrive/Sonic Pi/Samples/"
# Scales
scl = scale(:fs2, :minor, num_octaves: 3)
# 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 :beats do |length = 8, pattern = 1|
in_thread do
s = root + "Urban Technologies/SLOWER BREAKS/UT_060_SLWR BRK_98_D#.wav"
slices = (ring 0,1,2,3, 2,7,8,9) if pattern == 1
slices = (ring 0,1,2,3, 2,7,8,9, 0,1,2,3, 10,11,12,13) if pattern == 2
slices = (ring 0,1,2,2) if pattern == 3 # (ring 0,1,2,3, 0,9,8,7)
slices = (ring 0,1,1,1, 0,2,2,2, 0,3,3,3, 0,4,4,4) if pattern == 4
((bar_length * length) * 4).times do ; tick
sample s, amp: rrand(0.9, 1.0), slice: slices.look,
num_slices: 32
#pan: (ring 0,0,0,0 -1,0,-0.5,0, 0,0,0,0, 1,0,0.5,0).look
sleep 0.25 + swing.look
end
end
end
define :beats_2 do |length = 8, pattern = 1|
in_thread do
s = root + "Urban Technologies/SLOWER BREAKS/UT_061_SLWR BRK_99_F#.wav"
slices = (ring 0,1,2,3, 16,17,18,19, 20,21,22,23, 4,5,6,7,
11,10,9,8, 16,17,18,19, 20,21,22,23, 24,25,26,27) if pattern == 1
slices = (line 0, 31, steps: 32, inclusive: true) if pattern == 2
((bar_length * length) * 4).times do ; tick
sample s, amp: rrand(0.4, 0.5), slice: slices.look,
num_slices: 64, beat_stretch: 21,
pan: (ring 0,0,0,0 -1,0,-0.5,0, 0,0,0,0, 1,0,0.5,0).look
sleep 0.25 + swing.look
end
end
end
define :sq_bass do |length = 8, pattern = 1|
in_thread do
notes = (ring scl[0], scl[0], scl[0], scl[1]).repeat(14) +
(ring scl[5], scl[4], scl[3], scl[2]).repeat(2)
((bar_length * length) * 4).times do ; tick
with_synth :square do
with_octave -1 do
if pattern == 2
play notes.look,
amp: rrand(0.4, 0.5),
release: (line 0.5, 0.75, steps: 128).look if bools(1,0,0,0, 1,0,0,0, 1,0,0,0, 0,0,0,1).look
end
with_synth :sine do
play notes.look,
amp: rrand(0.4, 0.5),
sustain: 1,
release: 0.25 if bools(1,0,0,0, 1,0,0,0, 1,0,0,0, 0,0,0,1).look
end
end
end
sleep 0.25 + swing.look
end
end
end
define :some_chords do |length = 8, pattern = 1|
in_thread do
with_fx :hpf, cutoff: 50 do
((bar_length * length) / 16).times do ; tick
with_synth :hollow do
play chord(scl[0], (ring :minor7, :m9).look), sustain: 15, release: 1, amp: rrand(0.9, 1.1), pan: 0.5
if pattern == 2
play chord(scl[7], (ring :minor7, :m9).look), sustain: 15, release: 1, amp: rrand(0.9, 1.1), pan: -0.5
end
end
sleep 16 + swing.look
end
end
end
end
define :sub_bass do |length = 8|
in_thread do
notes = [scl[4], scl[4], scl[3], scl[1]].ring
((bar_length * length) / 8).times do ; tick
if bools(1,0,1,1).look
play notes.look-12, sustain: (ring 15,7,7,7).look, amp: rrand(0.2, 0.3), pan: 0.5
play notes.look-12, sustain: (ring 15,7,7,7).look, amp: rrand(0.2, 0.3), pan: -0.8
end
sleep 8
end
end
end
define :rave_riff do |length = 8, pattern = 1|
in_thread do
if pattern == 1
s = root + "Breakbusters/synth loops/synth loops 140bpm/breaks_synthloop_140_cheesytrafic_F#.wav"
base_note = 54
_s = 0.156
_f = 0.169
notes = [scl[7], scl[7], scl[7], scl[7],
scl[7], scl[7], scl[7], scl[7],
scl[7], scl[7], scl[7], scl[7],
scl[7], scl[7], scl[7], scl[7],
scl[7], scl[7], scl[7], scl[7],
scl[7], scl[7], scl[7], scl[7],
scl[7], scl[7], scl[7], scl[7],
scl[0], scl[1], scl[2], scl[3]].ring
end
if pattern == 2
s = root + "Breakbusters/synth loops/synth loops 140bpm/breaks_synthloop_140_chiizomeeta_E.wav"
base_note = 52
_s = 0
_f = 0.025
notes = [scl[7], scl[7], scl[7], scl[6],
scl[7], scl[7], scl[7], scl[5],
scl[7], scl[7], scl[7], scl[4],
scl[7], scl[7], scl[7], scl[3],
scl[7], scl[7], scl[7], scl[2],
scl[7], scl[7], scl[7], scl[1],
scl[7], scl[7], scl[7], scl[7],
scl[0], scl[1], scl[2], scl[3]].ring
end
with_fx :ping_pong, feedback: 0.7 do
((bar_length * length) * 4).times do ; tick
if bools(1,0,0,1, 1,0,0,0, 1,1,1,1, 1,0,1,0).look
sample s, amp: rrand(0.5, 0.6), start: _s, finish: _f,
num_slices: 32, rate: [1,-1].choose,
rpitch: get_pitch_from_note(notes.look, base_note, 0)
end
sleep 0.25 + swing.look
end
end
end
end
define :atmos do |length = 8, pattern = 1|
in_thread do
s = root + "Urban Technologies/SOUND LOOPS/AMBIENT ONE SHOT/UT_036_AMB SND_154_F.wav"
((bar_length * length) / 4).times do ; tick
sample s, amp: rrand(0.8, 0.9),
rpitch: get_pitch_from_note(scl[7], 53, 0),
pan: -0.8 if bools(1,0,0,0, 0,0,0,0).look
sleep 4 + swing.look
end
end
end
define :atmos_2 do |length = 8, pattern = 1|
in_thread do
s = root + "Urban Technologies/SOUND LOOPS/AMBIENT ONE SHOT/UT_030_AMB SND_141_F#.wav"
notes = (ring scl[7], scl[7], scl[5], scl[6], scl[4])
note_index = 0
((bar_length * length) / 2).times do ; tick
if bools(0,1,0,1, 0,0,0,0, 0,1,0,1, 0,1,0,0).look
sample s, amp: rrand(0.5, 0.6),
rpitch: get_pitch_from_note(notes[note_index], 55, 0),
pan: 0.7,
attack: 0.25
note_index += 1
end
sleep 2 + swing.look
end
end
end
# Structure
with_fx :compressor, threshold: 0.3 do
atmos ; atmos_2 ; bar
atmos ; atmos_2 ; bar(7) ; beats(1,1) ; bar(1)
atmos ; atmos_2 ; beats(8,1) ; bar
atmos ; atmos_2 ; beats(7,2) ; bar(7) ; beats_2(1,1) ; bar(1)
atmos ; beats(7,2) ; rave_riff(8,1) ; bar(7) ; beats_2(1,1) ; bar(1)
beats(7,2) ; sq_bass ; rave_riff(8,1) ; beats_2 ; bar
beats(8,3) ; sq_bass ; rave_riff(8,1) ; beats_2 ; bar
beats(8,3) ; sq_bass(8,2) ; rave_riff(8,2) ; beats_2 ; bar(7) ; beats(1,4) ; bar(1)
beats(7,2) ; sq_bass(8,2) ; rave_riff(8,2) ; beats_2 ; bar
beats(8,3) ; sq_bass(8,2) ; rave_riff(8,2) ; bar(7) ; beats(1,4) ; bar(1)
beats(8,2) ; sq_bass(8,2) ; beats_2 ; bar
beats(7,2) ; sq_bass(8,2) ; beats_2 ; bar # ?
some_chords ; bar
sub_bass ; some_chords; bar
sub_bass ; beats(8,1) ; some_chords(8,2) ; bar
sub_bass ; beats(7,1) ; some_chords(8,2) ; beats_2(8,2) ; bar
sub_bass ; beats(8,2) ; some_chords(8,2) ; rave_riff(8,1) ; beats_2(8,2) ; bar
sub_bass ; beats(7,3) ; some_chords(8,2) ; rave_riff(8,1) ; beats_2 ; bar
beats(8,3) ; sq_bass(8,2) ; rave_riff(8,2) ; beats_2 ; bar(7) ; beats(1,4) ; bar(1)
beats(7,3) ; sq_bass(8,2) ; rave_riff(8,2) ; beats_2 ; bar
sq_bass(8,2) ; rave_riff(8,2) ; bar(7) ; beats(1,4) ; bar(1)
end