Created
April 17, 2017 17:05
-
-
Save RemyPorter/00e760c74c043de25892a0b2c54317ff to your computer and use it in GitHub Desktop.
A SonicPi script that uses true random data
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
numbers =[14,103,81,12,22,65,90,35,46,10,98,95,116,102,8,56,95,110,15,118,104,99,15,96,107,51,66,92,43,16,74,8,123,68,103,79,123,24,97,11,82,100,97,94,88,31,91,12,92,4,63,39,48,22,52,128,4,10,31,65,31,126,42,21,45,8,95,39,42,100,75,87,25,56,110,91,122,28,96,83,42,42,94,27,58,74,15,79,36,49,30,18,68,80,107,81,106,52,51,56,49,112,123,30,99,125,24,40,60,127,113,99,44,20,30,93,10,82,93,40,38,18,91,78,46,33,21,4,100,14,99,120,104,76,82,109,72,117,31,68,41,91,128,31,82,50,125,1,74,91,36,50,67,98,46,1,67,103,58,118,93,59,13,1,100,90,96,75,26,78,75,16,80,18,25,4,77,8,122,58,84,6,66,97,43,21,60,106,48,49,78,120,110,84,125,70,112,84,55,1,127,94,110,56,121,117,31,61,21,95,92,53,64,100,62,88,60,63,40,16,27,121,103,85,43,59,55,50,69,36,56,75,119,33,121,73,92,123,72,3,51,119,109,67,6,105,4,19,76,46,10,11,29,66,31,67] | |
def make_phrase(name, data, &block) | |
slice = data | |
beats = slice.shift | |
per = slice.shift | |
if per < beats | |
per += beats | |
end | |
minmax = [slice.shift, slice.shift] | |
min = minmax.min | |
mxx = minmax.max | |
phase = [beats/128.0, 0.125/2.0].max | |
with_fx :ixi_techno, cutoff_min: min, cutoff_max: mxx, phase: phase do | |
live_loop name do | |
notes = (ring *slice) | |
block.call notes.tick | |
#use_synth_defaults divisor: notes.tick(:note)#, mod_phase: note.tick(:note) / 128.0 | |
if spread(beats,per).tick(:beats) | |
play notes.tick, | |
amp: notes.tick / 128.0 | |
end | |
sleep phase | |
end | |
end | |
end | |
def cut(array) | |
start = rrand_i(0,array.length) | |
finish = rrand_i(start,array.length) | |
return array[start..finish] | |
end | |
with_fx :echo, phase: 2, decay: 2 do | |
with_fx :lpf, cutoff: 100 do | |
with_fx :band_eq, freq: 60, res: 0.9, db: 5 do | |
make_phrase(:zero, cut(numbers)) do |n| | |
use_synth :fm | |
use_synth_defaults divisor: n | |
end | |
make_phrase(:one, cut(numbers)) do |n| | |
use_synth :chipbass | |
use_synth_defaults note_resolution: 12.0/n | |
end | |
make_phrase(:two, cut(numbers)) do |n| | |
use_synth :dpulse | |
use_synth_defaults detune: 0.5, dpulse_width: n/129.0 | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment