Last active
February 18, 2018 20:07
-
-
Save srdjan-m/b4c539d255d0ae1248b97a688ca2a571 to your computer and use it in GitHub Desktop.
sonic_pi: the song of the sea
This file contains hidden or 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
# Sonic Pi 2.11 | |
set_volume! 1 | |
##| Link to the samples folder: | |
samples_dir = "/Users/srdjan/Dropbox Srdjan/Dropbox/Projects/Sonic_Pi/song_by_sea/samples/" | |
##| There is 99.9999% chance that your link is different. Change it to point to your dir... | |
use_synth_defaults pulse_width: 0.99, coef: 0.45 | |
# -------------------- CONTROL -------------------- | |
in_thread do | |
1.times {cue :drums; sleep 4} | |
16.times {cue :part1; sleep 4} | |
8.times {cue :chorus; sleep 4} | |
16.times {cue :part2; sleep 4} | |
8.times {cue :chorus; sleep 4} | |
16.times {cue :drums2; sleep 4} | |
16.times {cue :chorus; sleep 4} | |
end | |
# -------------------- :drums -------------------- | |
# Ryhtm | |
in_thread do | |
with_fx :reverb, room: 1 do | |
with_fx :reverb, room: 1 do | |
with_fx :rbpf, res: 0, mix: 0.7 do | |
##| with_fx :gverb, mix: 0.2, room: 0.7 do | |
loop do | |
sync :drums | |
sample :loop_safari, amp: 1, finish: 0.5, pan: 0.5 | |
end | |
end | |
end | |
end | |
end | |
# -------------------- :drums2 -------------------- | |
# Ryhtm | |
in_thread do | |
with_fx :rbpf, res: 0, mix: 0.5 do | |
with_fx :reverb, room: 1, damp: 0.9 do | |
loop do | |
sync :drums2 | |
sample :loop_safari, amp: 2, finish: 0.5 | |
end | |
end | |
end | |
end | |
# FX | |
fxCount3 = 0 | |
use_random_seed 771 | |
p = [:e4, :fs4, :a4, :b4, :e5, :fs5, :a5, :b5].pick(32).shuffle.ring | |
s = [0.25, 0.5, 1, 2].pick(32).shuffle.ring | |
in_thread do | |
with_fx :echo do | |
with_fx :reverb, room: 1 do | |
loop do | |
sync :drums2 | |
use_synth :mod_beep | |
p = [:e4, :fs4, :a4, :b4, :e5, :fs5, :a5, :b5].pick(6).shuffle.ring | |
s = [0.125, 0.125, 0.25, 0.25, 0.5, 1].pick(6).shuffle.ring | |
play_pattern_timed p, s, attack: 0.3, release: rrand(0.7, 2), amp: 0.18, pan: rrand(0,2) - 1 if fxCount3 > 3 | |
fxCount3 += 1 | |
end | |
end | |
end | |
end | |
# Flute | |
flutePan = 1 | |
in_thread do | |
##| with_fx :reverb, room: 1 do | |
with_fx :reverb, room: 1 do | |
2.times do | |
2.times do | |
sync :drums2 | |
with_fx :echo, decay: 0.25 do | |
with_fx :reverb, room: 1 do | |
sleep 2 | |
sample samples_dir, "200419__franeknflute__xun-sample", amp: 0.35, rate: 1.4, compress: 1, finish: 0.75, release: 2, pan: flutePan | |
flutePan = -1 | |
end | |
end | |
end | |
sleep 32 | |
end | |
end | |
##| end | |
end | |
# -------------------- :part1 -------------------- | |
# Ryhtm | |
in_thread do | |
with_fx :rbpf, res: 0, mix: 0.5 do | |
with_fx :reverb, room: 1 do | |
loop do | |
sync :part1 | |
sample :loop_safari, amp: 2, finish: 0.5 | |
end | |
end | |
end | |
end | |
# Bass 1 | |
use_random_seed 302 | |
bassNotes = [:a2, :b2, :d3].pick(10).shuffle.ring | |
bassSleep = [1, 1, 1, 0.5, 0.5].ring | |
sustainA = [0.1, 0.1, 0.1, 1, 1].ring | |
in_thread do | |
use_synth :fm | |
loop do | |
sync :part1 | |
play_pattern_timed bassNotes, bassSleep, sustain: 0.2, release: 1, cutoff: 44, amp: 1 | |
end | |
end | |
# "Guitar" | |
use_random_seed 13 | |
pluckA = (scale :e2, :egyptian, num_octaves: 5).pick(32).ring.shuffle | |
use_random_seed 23 | |
pluckB = (scale :e2, :egyptian, num_octaves: 5).pick(32).ring.shuffle | |
in_thread do | |
with_fx :reverb, room: 0.5 do | |
use_synth :pluck | |
loop do | |
sync :part1 | |
32.times do | |
if one_in(2) | |
play pluckA.tick, amp: 1, pan: 0.5 | |
else | |
play pluckB.tick, amp: 1, pan: -0.5 | |
end | |
sleep 0.125 | |
end | |
end | |
end | |
end | |
# FX | |
fxCount = 0 | |
use_random_seed 33 | |
p = [:e5, :fs5, :a5, :b5].pick(32).shuffle.ring | |
s = [0.25, 0.5, 1, 2].pick(32).shuffle.ring | |
in_thread do | |
##| with_fx :reverb, room: 1 do | |
with_fx :reverb, room: 1 do | |
loop do | |
sync :part1 | |
use_synth :mod_beep | |
p = [:e5, :fs5, :a5, :b5].pick(4).shuffle.ring | |
s = [0.125, 0.125, 0.25, 0.25, 0.5, 1].pick(4).shuffle.ring | |
play_pattern_timed p, s, attack: 0.3, release: rrand(0.7, 2), amp: 0.18, pan: rrand(0,2) - 1 if fxCount > 7 | |
fxCount += 1 | |
end | |
end | |
end | |
##| end | |
# -------------------- :part2 -------------------- | |
# Ryhtm | |
in_thread do | |
with_fx :rbpf, res: 0, mix: 0.5 do | |
with_fx :reverb, room: 1 do | |
loop do | |
sync :part2 | |
sample :loop_safari, amp: 2, finish: 0.5 | |
end | |
end | |
end | |
end | |
# Bass 1 | |
use_random_seed 302 | |
bassNotes = [:a2, :b2, :d3].pick(10).shuffle.ring | |
bassSleep = [1, 1, 1, 0.5, 0.5].ring | |
sustainA = [0.1, 0.1, 0.1, 1, 1].ring | |
in_thread do | |
use_synth :fm | |
loop do | |
sync :part2 | |
play_pattern_timed bassNotes, bassSleep, sustain: 0.2, release: 1, cutoff: 44, amp: 1 | |
end | |
end | |
# Ambient | |
use_random_seed 33 | |
ambiChords = (scale :e4, :egyptian, num_octaves: 2).pick(32).ring.shuffle | |
in_thread do | |
use_synth :fm | |
with_fx :gverb do | |
loop do | |
sync :part2 | |
play ambiChords.tick, attack: 2, release: 5, env_curve: 3, amp: 0.3, cutoff: 66.6, pan: rrand_i(0, 2) - 1 | |
end | |
end | |
end | |
# "Guitar" | |
use_random_seed 13 | |
pluckA = (scale :e2, :egyptian, num_octaves: 5).pick(32).ring.shuffle | |
use_random_seed 23 | |
pluckB = (scale :e2, :egyptian, num_octaves: 5).pick(32).ring.shuffle | |
in_thread do | |
with_fx :reverb, amp: 0.8, room: 1, damp: 1 do | |
loop do | |
sync :part2 | |
use_synth :pluck | |
32.times do | |
if one_in(2) | |
play pluckA.tick, amp: 1, pan: 0.5 | |
else | |
play pluckB.tick, amp: 1, pan: -0.5 | |
end | |
sleep 0.125 | |
end | |
end | |
end | |
end | |
# FX | |
fxCount2 = 0 | |
use_random_seed 33 | |
p = [:e5, :fs5, :a5, :b5].pick(32).shuffle.ring | |
s = [0.25, 0.5, 1, 2].pick(32).shuffle.ring | |
in_thread do | |
with_fx :reverb, room: 1 do | |
loop do | |
sync :part2 | |
use_synth :mod_beep | |
p = [:e5, :fs5, :a5, :b5].pick(4).shuffle.ring | |
s = [0.125, 0.125, 0.25, 0.25, 0.5, 1].pick(4).shuffle.ring | |
play_pattern_timed p, s, attack: 0.3, release: rrand(0.7, 2), amp: 0.18, pan: rrand(0,2) - 1 if fxCount2 > 7 | |
fxCount2 += 1 | |
end | |
end | |
end | |
# -------------------- :chorus -------------------- | |
# Bass & bass drum | |
drumEcho = 0 | |
in_thread do | |
with_fx :reverb, room: 1 do | |
loop do | |
if drumEcho < 2 | |
sync :chorus | |
sample :bd_ada, amp: 6 | |
sleep 2 | |
sample :bd_pure, amp: 5 | |
sleep 2 | |
else | |
##| with_fx :echo, decay: 1.25, phase: 0.285, mix: 0.075 do | |
sync :chorus | |
sample :bd_ada, amp: 8, pan: 0.5 | |
sleep 2 | |
sample :bd_ada, amp: 7, pan: -0.5 | |
sleep 2 | |
##| end | |
end | |
drumEcho += 1 | |
sample :bd_pure, amp: 5 | |
sleep 2 | |
end | |
end | |
end | |
# Ryhtm | |
in_thread do | |
loop do | |
sync :chorus | |
sample :loop_safari, amp: 3, finish: 0.5 | |
end | |
end | |
# Marimba | |
in_thread do | |
with_fx :echo do | |
with_fx :reverb, room: 1 do | |
use_synth :pretty_bell | |
loop do | |
sync :chorus | |
use_random_seed 800 | |
notes = (scale :e2, :egyptian, num_octaves: 3) | |
32.times do | |
play notes.choose, release: [0.1, 0.05, 0.25, 0.125, 0.15, 0.175, 0.2].choose, amp: 1.4 | |
sleep [0.125, 0.25, 0.5, 0.75].choose | |
end | |
end | |
end | |
end | |
end | |
# Marimba ex | |
marimbaex = true | |
in_thread do | |
loop do | |
sync :chorus | |
if marimbaex then | |
with_fx :compressor do | |
sample :guit_harmonics, rate: 0.504, window_size: 0.1, pan: -1, amp: 6 | |
end | |
else | |
sample :guit_e_slide, pan: 1, amp: 1.25 | |
end | |
marimbaex = !marimbaex | |
sleep 4 | |
end | |
end | |
# Synth | |
whichPattern = 1 | |
in_thread do | |
with_synth :tb303 do | |
with_fx :reverb, room: 1 do | |
with_fx :reverb, room: 1 do | |
loop do | |
sync :chorus | |
case whichPattern | |
when 5, 7, 9, 11, 13, 15, 17 | |
play (chord :a4, :major), release: 2, cutoff: 99, amp: 0.45 | |
sleep 2 | |
play (chord :b4, :major), release: 3.5, cutoff: 101, amp: 0.35 | |
sleep 2 | |
play (chord :d4, :major), attack: 1.5, release: 2, cutoff: 77, amp: 0.75 | |
sleep 4 | |
when 6, 8, 10, 12, 14, 16, 18 | |
##| play (chord :d4, :major), attack: 0.5, release: 3 | |
##| sleep 2 | |
play (chord :d4, :major), release: 3, cutoff: 99, amp: 0.45 | |
sleep 2 | |
play (chord :e4, :major), release: 4, cutoff: 101, amp: 0.35 | |
sleep 2 | |
play (chord :b3, :major), attack: 4, release: 0, cutoff: 120, amp: 1 | |
sleep 4 | |
end | |
whichPattern += 1 | |
end | |
end | |
end | |
end | |
end | |
# Bass | |
in_thread do | |
loop do | |
sync :chorus | |
use_random_seed 400 | |
use_synth :fm | |
notes = (scale :e1, :egyptian, num_octaves: 1) | |
4.times do | |
if one_in(2) | |
play_pattern_timed [:b2, :e3, :a2, :e3, :d3, :a2], [2, 2, 2, 1, 0.5, 0.5], sustain: 0.1, release: 0.4, amp: 1 | |
else | |
play_pattern_timed [:b2, :b2, :a2, :b2, :e3, :a2, :e3, :d3, :a2], [0.75, 0.5, 0.25, 0.5, 2, 2, 1, 0.5, 0.5], sustain: 0.2, release: 0.6, amp: 1 | |
end | |
end | |
end | |
end | |
# You'll need the following free sample (put it in the samples folder): | |
# FREESOUND Samples | |
# Flute - franeknflute: | |
# https://www.freesound.org/people/franeknflute/sounds/200419/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment