Skip to content

Instantly share code, notes, and snippets.

@tatecarson
Last active February 3, 2017 22:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tatecarson/14df4ee752e8fe2bd8773addd84eb9fe to your computer and use it in GitHub Desktop.
Save tatecarson/14df4ee752e8fe2bd8773addd84eb9fe to your computer and use it in GitHub Desktop.
(
//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