Last active
February 3, 2017 22:42
-
-
Save tatecarson/14df4ee752e8fe2bd8773addd84eb9fe to your computer and use it in GitHub Desktop.
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
( | |
//load data | |
~oysterPatties = (); | |
/* | |
Process ingredients | |
*/ | |
//list ing | |
~oysterPatties[\ing] = ["oysters", "lizuor", "butter", "flour", "shallots", "onion", "parsley"]; | |
~oysterPatties[\ingl] = 0!~oysterPatties[\ing].size; | |
~oysterPatties[\ingChar] = 0!~oysterPatties[\ing].size; | |
//get data | |
~oysterPatties[\ing].size.do{|i| | |
//get size of each | |
~oysterPatties[\ingl][i] = ~oysterPatties[\ing][i].size; | |
//get char ascii value | |
~oysterPatties[\ingChar][i] = ~oysterPatties[\ing][i].ascii; | |
}; | |
//ascii to scale | |
~asciiToScale = {|ascii, scale, length| | |
// function to transform to midi keys | |
f = { |arr, scale| | |
arr.cpsmidi.round.asInteger.collect(_.nearestInScale(scale, length)) }; | |
o = f.(ascii, scale); | |
}; | |
~oysterPatties[\ingCharMidi] = 1!~oysterPatties[\ingChar].size; | |
a = (); | |
//iterate this | |
~oysterPatties[\ingChar].size.do{|i| | |
a[i] = ~asciiToScale.(~oysterPatties[\ingChar][i], Scale.lydian, ~oysterPatties[\ingChar][i].size); | |
/*~oysterPatties[\ingCharMidi][i] = Pseq([a[i]]).asStream;*/ | |
}; | |
) | |
( | |
Pbindef(\u, | |
\instrument, \default, | |
\amp, 0.3, | |
\midinote, Prand([a[0], a[1]], inf), | |
\dur, 0.1 | |
).play; | |
) | |
Pdef.clear; | |
s.reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment