Created
June 28, 2016 09:06
-
-
Save AlexandreRangel/9a025d1b8a2ad7ec83c14732ad507108 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
| # Alexanddre rANGEL | |
| # 我的回應你 'group echo' v06 | |
| # 26 jun 2016 | |
| # Sonic Pi 2.10 | |
| use_bpm 128/2.0 | |
| set_volume! 0.65 | |
| # influence the composition: throw a time based dice | |
| time = Time.new | |
| use_random_seed (187.5*time.hour) | |
| playhead = 0 | |
| part = 0 | |
| d1 = 0 | |
| d2 = 0 | |
| d3 = 0 | |
| #parts#=[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
| cue =[ 0, 32, 72, 116, 164, 198, 256, 312, 354, 412, 460] | |
| ################################################## | |
| live_loop :clock do | |
| playhead = playhead + 1.0/4 | |
| case playhead | |
| when (cue[0]..cue[1]) then part = 0 | |
| when (cue[1]..cue[2]) then part = 1 | |
| when (cue[2]..cue[3]) then part = 2 | |
| when (cue[3]..cue[4]) then part = 3 | |
| when (cue[4]..cue[5]) then part = 4 | |
| when (cue[5]..cue[6]) then part = 5 | |
| when (cue[6]..cue[7]) then part = 6 | |
| when (cue[7]..cue[8]) then part = 7 | |
| when (cue[8]..cue[9]) then part = 8 | |
| when (cue[9]..cue[10]) then part = 9 | |
| end | |
| if one_in(10) | |
| 24.times do puts "part: " + part.to_s end | |
| end | |
| sleep 0.25 # 4 measures per beat | |
| end | |
| ################################################## | |
| live_loop :synth1 do | |
| use_synth :pulse | |
| #with_fx :slicer, phase: (ring 1,2,0.5,0.4,0.25,0.1)[part] do | |
| with_fx :ring_mod, freq: rrand(40,80), freq_slide: 1.0/2, | |
| mix: [0.1,0.2,0.3].choose do | |
| with_fx :echo, phase: 0.25 do | |
| play_chord [20-12,25,27-rand(12)], | |
| attack: 1.5, sustain: 0.1, release: 1.5, | |
| amp: (rrand(1.3,1.8)) | |
| end | |
| end | |
| #end | |
| sleep 2 | |
| end | |
| ################################################## | |
| with_fx :bitcrusher, bits: 3 do | |
| live_loop :drum1b do | |
| sample :bd_haus, amp: 2.5 | |
| #sleep 1.5/2 | |
| sleep 1.0/2 | |
| end | |
| end | |
| ################################################## | |
| live_loop :drums2b do | |
| if part > 1 | |
| with_fx :distortion, mix: (0.5)do | |
| with_fx :compressor, mix: (1.0) do | |
| d1 = d1 + 1 | |
| d1s = (ring 1,0,1,0) [d1] | |
| d1s = (ring 1,1,1,1) [d1] if one_in(24) | |
| sample :bd_klub, amp: rrand(2.9,4.0) if d1s==1 | |
| sample :bd_haus, amp: rrand(0.4,0.7), | |
| rate: rrand(-1.0,-1.05) if d1s==1 | |
| end | |
| end | |
| end | |
| sleep 1.0/2 | |
| time = Time.new | |
| sleep 1.5 if one_in(time.sec) # olha o breque (break it down) | |
| end | |
| ################################################## | |
| live_loop :drums3b do | |
| if part > 2 | |
| d3 = d3 + 1.0 | |
| d3s = (ring 0,1,0,1) [d3.to_int] | |
| with_fx :echo, phase: (ring 0.5,0.5,0.25) [d3.to_int] do | |
| sample '/Users/rangel/pisamples/clap909.wav', | |
| amp: rrand(1.9,2.9), | |
| cutoff: (ring 60,80,100,80,100) [d3.to_int], | |
| res: rrand(0.4,0.6) if d3s==1 | |
| end | |
| end | |
| sleep 1.0/4 | |
| end | |
| ################################################## | |
| live_loop :synth2 do | |
| use_synth :square | |
| if (part/3).even? | |
| with_fx :flanger, mix: rand(0.75) do | |
| with_fx :slicer, phase: (ring 0.25,0.5,1)[part] do | |
| temp = rand_i(48) | |
| play_chord [rrand_i(60,65)-temp,rrand_i(60,65)-temp,rrand_i(60,65)-temp], | |
| amp: 0.7, | |
| sustain: 4, release: 1, amp: 1.3 | |
| end | |
| end | |
| end | |
| sleep 2 | |
| end | |
| ################################################### | |
| live_loop :synth3 do | |
| if part > 2 and (part/3).odd? | |
| use_synth :mod_saw | |
| with_fx :slicer do | |
| with_fx :distortion, mix: rrand(0.4,0.9) do | |
| play chord(:F3, :minor).choose, amp: rrand(0.5,0.6), | |
| attack: 2, sustain: [1,1.5].choose, release: 2, | |
| res: (rrand(0.2,0.6)), res_slide: [0.25,0.5].choose, | |
| cutoff: rrand(70,110), cutoff_slide: [0.5,1,2].choose | |
| end | |
| end | |
| end | |
| sleep 2 | |
| end | |
| ################################################## | |
| live_loop :synth4 do | |
| if part > 1 and part.even? | |
| use_synth :pulse | |
| with_fx :distortion, mix: rrand(0.3,0.5) do | |
| play chord(:A3, :minor).choose, amp: rrand(0.5,0.6), | |
| attack: 2, sustain: [1,1.5].choose, release: [2,3].choose, | |
| res: (rrand(0.2,0.6)), res_slide: [0.25,0.5].choose, | |
| cutoff: rrand(70,110), cutoff_slide: [0.5,1,2].choose | |
| end | |
| end | |
| sleep 2 | |
| end | |
| ################################################## | |
| live_loop :textura do | |
| play scale([:c4,:c2].choose,:spanish).choose, | |
| attack: [2,4].choose, | |
| release: [2,4].choose if one_in(6) | |
| sleep 1 | |
| end | |
| ################################################## | |
| live_loop :notes do | |
| use_synth :beep | |
| play [:c5,:f5].choose, | |
| attack: 0.1, release: 0.1, | |
| amp: 1.1 if one_in(6) | |
| sleep 0.5 | |
| end | |
| ################################################## | |
| live_loop :ghost do | |
| with_fx :slicer, phase: 0.1, mix: 0.5 do | |
| with_fx :pitch_shift, pitch: rrand(-12,-4) do | |
| with_fx :flanger, phase: 0.25 do | |
| sample :drum_cymbal_hard, | |
| amp: rrand(1.8,2.4) *3, | |
| rate: rrand(-0.3,0.3) if one_in(6) | |
| end #fx | |
| end #fx | |
| end #fx | |
| sleep 2 | |
| end #loop | |
| ################################################## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment