Last active
May 9, 2016 00:41
-
-
Save AlexandreRangel/08cbdde19878eda068071682f7986ad4 to your computer and use it in GitHub Desktop.
Sonic Pi music code
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
# Alexandre rANGEL | |
# www.quasecinema.org | |
# "mother gave me wings" v05 | |
# 8 May 2016 | |
# Sonic Pi 2.10 | |
use_bpm 60 | |
set_volume! 0.8 | |
sample_birds = '/Users/rangel/pisamples/birds.flac' | |
#http://www.freesound.org/people/dwareing/sounds/187775/ | |
load_samples [sample_birds, :drum_cowbell, :bd_fat, :bd_klub, | |
:drum_cowbell, :drum_tom_lo_soft] | |
r1 = 0 # ring iterator | |
r2 = 0 # ring iterator | |
x = 0 | |
y = 0 | |
############################################################# | |
p = 0 | |
live_loop :metro do | |
clock = tick(:metro) | |
bar = clock / 4 | |
puts "bar : #{bar}" | |
puts (ring "1 |","2 | |","3 | | |","4 | | | |")[clock] | |
p = rrand(-0.7,0.7) | |
sleep 1 | |
end #metro | |
############################################################# | |
b = 0 | |
d = sample_duration sample_birds | |
live_loop :birds do | |
sample sample_birds, rate: (ring 0.25/2, 0.25, 0.5, 1)[b], | |
attack: (ring 4,2,1,1)[b], | |
release: 1, | |
amp: (ring 28, 18, rrand(13,15), 9)[b] | |
sleep (ring 1, d*4, d*2, d*2)[b] | |
b = b + 1 | |
end | |
############################################################# | |
sleep 6 | |
############################################################# | |
live_loop :myNotes1 do | |
use_synth :tb303 | |
if one_in(2) | |
play_pattern_timed [:c2,:d2,:e2], [1.0], cutoff: rrand(70,110), cutoff_slide: 0.3, | |
sustain: 2.0, release: 2.0, attack: [0,1.5,0.5,1,2].choose, | |
amp: 0.75 | |
else | |
play_pattern_timed [:c2,:e2,:d2], [1.0], cutoff: rrand(70,110), cutoff_slide: 0.3, | |
sustain: 2.0, release: 2.0, attack: [0.5,1,0.25].choose, | |
amp: 0.75 | |
end | |
sleep rrand_i(0,1) | |
end | |
############################################################# | |
sleep 2 | |
############################################################# | |
live_loop :myNotes2 do | |
use_synth :square | |
with_fx :ring_mod, mix: rrand(0.5,1.0), freq: rrand(10,50), freq_slide: 0.3 do | |
if one_in(4) | |
with_fx :echo do | |
play_pattern_timed [:f4,:g4], [1.0], attack: 0.01, release: 0.2, | |
amp: rrand(0.7,0.8) | |
end | |
else | |
play_pattern_timed [:f4,:g4], [1.0], attack: 0.01, release: 0.2, | |
amp: rrand(0.7,0.9) | |
end | |
end | |
sleep rrand_i(0,8) | |
end | |
############################################################# | |
sleep 2 | |
############################################################# | |
live_loop :cowbellA do | |
with_fx :echo, phase: 0.5, reps: 1, mix: 0.7 do | |
with_fx :gverb, mix: 0.7 do | |
18.times do | |
ampVal = (ring 0.0,0.01,0.0,0.02,0.04,0.06,0.07,0.10) [r1.to_int] | |
if ampVal > 0.0 | |
ampVal = ampVal + rrand(0.0,0.05) | |
end | |
sample :drum_cowbell, | |
amp: ampVal, | |
pan: p, pan_slide: 0.05 | |
sleep 1.0/3 | |
end | |
end | |
end | |
r1 = r1 + 0.75 | |
sleep 6 if one_in(5) | |
end | |
############################################################# | |
sleep 8 | |
############################################################# | |
live_loop :cowbellB do | |
12.times do | |
ampVal = (ring 0.0,0.0,0.0,0.02,0.04,0.06,0.08,0.10) [r2] *0.75 | |
if ampVal > 0.0 | |
ampVal = ampVal + rrand(0.10,0.24) | |
end | |
sample :drum_cowbell, | |
amp: ampVal, | |
pan: -p | |
sleep 1.0/3 | |
end | |
r2 = r2 + 1 | |
sleep 6 if one_in(5) | |
end | |
############################################################# | |
sleep 8 | |
############################################################# | |
live_loop :mySynth1 do | |
with_fx :bitcrusher, bits: [6,7,8,9,10,11,12,13,14,15,16].choose do | |
with_fx :flanger, phase: [0.25,0.5,1.0].choose do | |
use_synth :beep | |
2.times do | |
play_pattern_timed [:c2,:c2,:c1,:c2,:c2,:c1], | |
0.25, amp: 0.87, release: [0.5,1.0].choose, pan: -1 if one_in(2) | |
play_pattern_timed [:c2,:c2,:c1,:c2,:c2,:c1], | |
0.25, amp: 0.87, release: [0.5,1.0].choose, pan: -1 if one_in(2) | |
play_pattern_timed [:e2,:e2,:f1,:e2,:e2,:f2], | |
0.25, amp: 0.87, release: [0.5,1.0].choose, pan: -1 if one_in(6) | |
sleep (ring 0.25,0.25,0.25,0.5) [x] | |
x = x + 1 | |
end | |
end | |
end | |
with_fx :slicer, phase: [0.1,0.2,0.25,0.25,1.0/3,0.5].choose, | |
phase_slide: [0.1,0.2,0.5,0.5].choose do | |
2.times do | |
use_synth :beep | |
play_pattern_timed [:e1,:e1,:e1,:e2,:e2,:e1], | |
0.25, amp: 0.87, release: [0.3,0.7].choose, pan: -1 if one_in(2) | |
play_pattern_timed [:e1,:e1,:e1,:e2,:e2,:e1], | |
0.25, amp: 0.87, release: [0.3,0.7].choose, pan: -1 if one_in(2) | |
play_pattern_timed [:g1,:g1,:g1,:g2,:g2,:f2], | |
0.25, amp: 0.87, release: [0.3,0.7].choose, pan: -1 if one_in(6) | |
sleep (ring 0.25,0.25,0.25,0.5) [y] | |
y = y - 1 | |
end | |
end | |
end | |
############################################################# | |
sleep 4 | |
############################################################# | |
live_loop :drums1 do | |
sample :bd_haus, amp: rrand(1.38,1.78) * 1.1 | |
sample :bd_fat, amp: rrand(1.38,1.78) * 1.1 | |
sleep 0.5 | |
end | |
############################################################# | |
sleep 4 | |
############################################################# | |
live_loop :drums2 do | |
sleep 1 | |
sample :bd_klub, amp: rrand(2.65,2.95) * 1.1 | |
sample :drum_tom_lo_soft, amp: rrand(2.65,3.05) * 1.1 | |
end | |
############################################################# | |
sleep 4 | |
############################################################# | |
live_loop :myDrums3 do | |
with_fx :compressor do | |
with_fx :echo, phase: 1.0/8 do | |
with_fx :bitcrusher, bits: [8,9,10,11,12,13,14,15].choose do | |
sample :elec_cymbal, amp: rrand(0.0,0.04) | |
end | |
end | |
end | |
sleep 1.0/1 | |
end | |
############################################################# | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment