Last active
July 26, 2016 21:47
-
-
Save AlexandreRangel/7ea74cab537fd08ac20486b3e52c70c4 to your computer and use it in GitHub Desktop.
Sonic Pi music code
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
# Alexandre rANGEL | |
# www.quasecinema.org | |
# knowledge representation and reasoning - v20 | |
# Sonic Pi 2.9 | |
# 3-Apr-2016 | |
use_bpm 67 | |
c1 = c2 = q1 = q2 = k1 = k2 = 0 | |
set_volume! 0.84 | |
t = Time.new | |
x = (t.year / t.month / t.day * t.hour * t.min * t.sec) | |
use_random_seed x | |
puts x | |
# http://www.freesound.org/people/felipejordani/sounds/324395/ | |
# http://www.freesound.org/people/modularsamples/sounds/307533/ | |
# http://www.freesound.org/people/MissCellany/sounds/240640/ | |
# download samples, rename to drumloopalien, roland95B6 and hatMetal | |
# and put it in your path, defined here: | |
use_sample_pack_as '/Users/rangel/pisamples', :mySamples | |
load_samples [:mySamples__drumloopalien,:mySamples__roland95B6,:mySamples__hatMetal] | |
load_samples [:bd_ada,:bd_klub,:bd_zome] | |
live_loop :metro do | |
clock = tick(:metro) | |
bar = clock / 4 | |
puts "bar : #{bar}" | |
puts (ring "1 |","2 | |","3 | | |","4 | | | |")[clock] | |
sleep 1 | |
end #metro | |
############################################################ | |
with_fx :compressor, slope_above: 0.9, slope_below: 1.13, mix: 0.3 do | |
with_fx :level, amp: 0.4 do | |
with_fx :flanger, phase: 4, depth: 5 do | |
with_fx :flanger, phase: 16, depth: 7 do | |
with_fx :flanger, phase: 128, depth: 5 do | |
with_fx :normaliser, mix: 0.5 do | |
with_fx :flanger, phase: [0.25,0.5,1,2,3].choose do | |
with_fx :pitch_shift, window_size: rrand(0.01,0.05), pitch: rrand(-36,0) do | |
with_fx :echo, phase: [0.25,0.5,1.0/3].choose do | |
with_fx :ixi_techno, res: rrand(0.05,0.8) do | |
with_fx :distortion, bits: [6,8,10,12,14].choose do | |
############################################################ | |
live_loop :drone1 do | |
use_synth :fm | |
with_fx :slicer, phase: [0.25,1.0/3,0.5].choose do | |
with_fx :echo, phase: 1.0/3 do | |
play_pattern [:c4,:c4,:e4], | |
release: rrand(0, 0.5), | |
rate: 0.5, pan: rrand(-0.66,-0.75), amp: 0.5 | |
end | |
end | |
sleep [2,4,8,16].choose / 2 | |
end # bass | |
############################################################ | |
live_loop :drone2 do | |
use_synth :pretty_bell | |
with_fx :slicer, phase: [0.25,1.0/3].choose do | |
with_fx :flanger, phase: 1.0/4 do | |
play_pattern [:e3,:e3,:g3], | |
release: rrand(2, 3), | |
rate: 0.5, pan: rrand(0.66,0.75), amp: 2 | |
end | |
end | |
sleep [32,16,16,8,8,4].choose / 2 | |
end | |
end | |
end | |
end | |
end | |
end | |
end | |
end | |
end | |
end | |
end | |
###################################################################### | |
sleep 6 + 8 + 8 | |
###################################################################### | |
live_loop :quiquito do | |
with_fx :band_eq, freq: 80, db: 2, mix: 0.5 do | |
with_fx :echo, phase: 0.25, mix: rrand(0.333,0.383) do | |
8.times do | |
sample :mySamples__drumloopalien, rate: 1, | |
amp: (ring 0.4,0.4,0.4,0.5)[q1], start: 0.066, finish: 0.077, | |
attack: rrand(0.01,0.02) | |
q1 = q1 + 1 | |
#sample :bd_klub, amp: 3 | |
sleep 0.5 | |
end | |
end | |
with_fx :echo, phase: 0.5, mix: rrand(0.5,0.55) do | |
4.times do | |
sample :mySamples__drumloopalien, rate: 1, | |
amp: (ring 0.4,0.5)[q2], start: 0.064, finish: 0.075, | |
attack: rrand(0.005,0.01) | |
q2 = q2 + 1 | |
#sample :bd_klub, amp: 3 | |
sleep 0.5 | |
end | |
end | |
end | |
end | |
###################################################################### | |
sleep 6 | |
###################################################################### | |
live_loop :hat1 do | |
with_fx :slicer, phase: 0.25, | |
smooth_up: 0.1, smooth_down: 0.1 do | |
with_fx :flanger, mix: rrand(0.7,0.9) do | |
with_fx :pitch_shift, pitch: [-2,0,2].choose, | |
window_size: 0.001 do | |
sample :mySamples__hatMetal, | |
pan: rrand(-0.15,0.10), pan_slide: 0.02, | |
rate: (ring 0.75,0.75,0.75,1,0.75,1.01,1.11,1.22)[c1] * 0.25 * [0.5,0.25].choose, | |
amp: rrand(1.4,1.5) * 5 if one_in([1,3,6,9,12].choose) | |
c1 = c1 + 1 | |
sleep [1.0,3.0].choose/[3,3,6,6,6].choose | |
sleep [1.0,3.0].choose/[3,3,6,6,6].choose * 2 if one_in(12) | |
end | |
end | |
end | |
end | |
###################################################################### | |
sleep 8 | |
###################################################################### | |
live_loop :hat2 do | |
with_fx :gverb, mix: rrand(0.2,0.5) do | |
sample :mySamples__hatMetal, | |
pan: rrand(-0.15,0.10), pan_slide: 0.05, | |
amp: rrand(1.4,1.5) *3, | |
rate: (ring 0.75,0.75,0.75,1,0.75,1.01,1.11,1.22)[c2]*[0.25,0.5].choose, | |
pitch: [0,2,4].choose | |
#sample :mySamples__hatMetal, rate: 0.25 if one_in(5) | |
c2 = c2 + 1 | |
sleep [2,4].choose | |
sleep [2,4].choose * 4 if one_in(13) | |
end | |
end | |
###################################################################### | |
live_loop :roland do | |
if one_in(2) | |
with_fx :flanger, phase: [0.25,0.5,1,2,3,4,5].choose, mix: rrand(0.3,0.7) do | |
with_fx :band_eq, freq: rrand(60,100), freq_slide: [0.5,1].choose, db: -2 do | |
with_fx :band_eq, freq: rrand(80,130), freq_slide: [0.5,1,2,4].choose, | |
res: rrand(0.4,0.8), res_slide: [0.25,0.5,1,2,4].choose, db: 2 do | |
with_fx :slicer, phase: 0.5, mix: rrand(0.6,1) do | |
with_fx :pitch_shift, pitch: rrand(-32,-8), | |
window_size: rrand(0.0001,0.001) do | |
sample :mySamples__roland95B6, | |
rate: rrand(0.1,1.0), | |
pan: 0.3, amp: 2.1 if one_in(2) | |
end | |
end | |
with_fx :slicer, phase: 0.25, mix: rrand(0.6,1) do | |
with_fx :pitch_shift, pitch: rrand(-32,-8), | |
window_size: rrand(0.001,0.01) do | |
sample :mySamples__roland95B6, | |
rate: rrand(0.2,0.6), | |
attack: 2, | |
pan: 0.3, amp: 2.1 if one_in(2) | |
end | |
end | |
sleep [2,4,8,16,32].choose | |
end | |
end | |
end | |
else | |
with_fx :echo, phase: [0.5,1,2,4,8].choose do | |
with_fx :flanger, phase: [0.25,0.5,1,2,3,4,5].choose, mix: rrand(0.3,0.7) do | |
with_fx :band_eq, freq: rrand(60,100), freq_slide: [0.5,1].choose, db: -2 do | |
with_fx :band_eq, freq: rrand(80,130), freq_slide: [0.5,1,2,4].choose, | |
res: rrand(0.4,0.8), res_slide: [0.25,0.5,1,2,4].choose, db: 2 do | |
with_fx :slicer, phase: 0.5, mix: rrand(0.6,1) do | |
with_fx :pitch_shift, pitch: rrand(-32,-8), | |
window_size: rrand(0.0001,0.001) do | |
sample :mySamples__roland95B6, | |
rate: rrand(0.1,1.0), | |
pan: 0.3, amp: rrand(2.2,3.1) if one_in(2) | |
end | |
end | |
#with_fx :slicer, phase: 0.25, mix: rrand(0.6,1) do | |
with_fx :pitch_shift, pitch: rrand(-32,-8), | |
window_size: rrand(0.001,0.01) do | |
sample :mySamples__roland95B6, | |
rate: rrand(0.2,0.6), | |
attack: 2, | |
pan: 0.3, amp: rrand(2.2,2.8) if one_in(2) | |
end | |
#end | |
sleep [2,4,8,16,32].choose | |
end | |
end | |
end | |
end | |
end #if | |
end | |
###################################################################### | |
end #compressor | |
###################################################################### | |
sleep 14 | |
sleep 1.0/4 #kick offset | |
###################################################################### | |
live_loop :kick2 do | |
with_fx :band_eq, freq: 90, db: [1,1,1,1,1,1.3][k1] do | |
k1 = k1 + 1 | |
with_fx :gverb, mix: (ring 0.06,0.14)[k2.to_int] do | |
k2 = k2 + (1.0 / 3.0) | |
with_fx :wobble, phase: [0.25,0.5,1,2,2,2,4,4].choose, mix: 0.25 do | |
with_fx [:ixi_techno,:ring_mod].choose, phase: [2,4].choose, mix: 0.5 do | |
sample :bd_ada, amp: 2.25 | |
sample :bd_klub, amp: 2.6 * rrand(0.66,0.88) if one_in(2) | |
sleep 0.5 | |
sample :bd_zome, amp: 2.25, rate: rrand(0.88,0.92) | |
sample :bd_klub, amp: 2.6 * rrand(0.66,0.88) if one_in(2) | |
end | |
end | |
end | |
end | |
sleep 0.5 | |
sleep 7 if one_in(32) | |
end | |
###################################################################### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment