Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Requirements:
- * - Use one of Linked Automata Systems, Cellular Automata
- * - Have at least three instruments whose material is derived from above system
- * - Be at least two minutes in length when played
- */
- // The voice leader is fairly often making small random adjustments using ~changevoice
- // The percussion / rhythm / bass feeds the new values for the lead voice into ~fuzzinesstostate
- // and change states if the values cross certain thresholds
- // TODO: figure out chord transitions and integrate instruments
- // The starting pitch set that song will be derived from
- ~startingPitchSet = [0, 1, 4, 5, 7, 11, 12, 16]
- ~attack = 0.25 // attack (0.01 - 0.5),
- ~decay = 0.3 // decay (0.1-0.5)
- ~fmrate = 10 // 0 - 1000
- ~fmdepth = 0 // 0 - 1
- ~arpeggiator = 0 // 0 or 1 for Off or On
- // take in the parameters of the leading voice and return what state the rhythm and bass should move to
- ~fuzzinesstostate = {arg currentstate, attack, decay, fmdepth, fmrate, arpeggiator;
- ~fuzziness = (fmdepth + (fmrate / 1000) + (attack / 0.5)) / 3;
- ~state = 0;
- if (~fuzziness < 0.25) {
- ~state = 0;
- } {
- if (~fuzziness < 0.5) {
- ~state = 1;
- } {
- ~state = 2;
- };
- };
- // 50% chance we stay on the current state
- if (2.rand == 0) {
- ~state = currentstate;
- };
- ~state;
- };
- ~fuzzinesstostate.value(0, 11, 0.5, 500, 0, 5);
- // randomly change leading voice parameters
- ~changevoice = {arg attack, decay, fmrate, fmdepth, arpeggiator;
- // array with new values for attack, decay, fmrate, fmdepth, arpeggiator to return later
- ~ret = Array.newClear(5);
- // change attack
- switch (3.rand,
- 0, {~ret[0] = attack;},
- 1, {~ret[0] = attack - 0.02;
- if (~ret[0] < 0.01) {
- ~ret[0] = 0.25;
- }; },
- 2, {~ret[0] = attack + 0.02;
- if (~ret[0] > 0.5) {
- ~ret[0] = 0.25;
- };}
- );
- // change decay
- switch (3.rand,
- 0, {~ret[1] = decay;},
- 1, {~ret[1] = decay - 0.02;
- if (~ret[1] < 0.1) {
- ~ret[1] = 0.3;
- }; },
- 2, {~ret[1] = decay + 0.02;
- if (~ret[1] > 0.5) {
- ~ret[1] = 0.3;
- };}
- );
- // change fmrate
- switch (3.rand,
- 0, {~ret[2] = fmrate;},
- 1, {~ret[2] = fmrate - 30;
- if (~ret[2] < 10) {
- ~ret[2] = 500;
- }; },
- 2, {~ret[2] = fmrate + 30;
- if (~ret[2] > 1000) {
- ~ret[2] = 500;
- };}
- );
- // change fmdepth
- switch (3.rand,
- 0, {~ret[3] = fmrate;},
- 1, {~ret[3] = fmrate - 0.05;
- if (~ret[3] < 0.05) {
- ~ret[3] = 0.5;
- }; },
- 2, {~ret[3] = fmrate + 0.05;
- if (~ret[3] > 0.95) {
- ~ret[3] = 0.5;
- };}
- );
- // change arpeggiator (1/4 chance it's changed)
- if (4.rand == 0) {
- ~ret[4] = 1 - arpeggiator
- } {
- ~ret[4] = arpeggiator
- };
- ~ret;
- };
- // continually call with old values to get new values
- ~changevoice.value(0.2, 0.3, 500, 0.1, 0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement