Mulberry: A Video Pamphlet by Balt Dep't of the Invaded
Channel: Peter B
Date: 2012-02-19

//Computer Music Score for "Mulberry"
//An Invasive Species Video Pamphlet by
//The Baltimore Department of the Invaded.

//Draw an imaginary tree in your mind.  
//You see a circle of yellow, which is the trunk.
//It has a creamy sapwood when you sawe it
//beneath it are orange roots.
//it starts with the roots, that are brawniest
//right beneath the trunk

//Out on the branches are berries,
//and they do falle again onto the roots.
//methinks some are even underground
//a gauze of ivy creeps up the trunk,
//which when cut the wood
//it tarnishes from yellow to orange.

//note that youtube does not allow lessthan or greaterthan
//symbols so you must repair them to make this code work.

(Synth.record({
  var grainspawnINDEX,grainspawnTRIG, grainENV, grain;
  var rootsENV;
  var seasonMODULO, creamwoodINDEX, yellowtoneSCALE;
  var yellowtone;
  var creepingIVY, ivyTRIG, ivy;
  var orangetoneINDEX,orangetoneTRIG, root;
  var berriesINDEX, berriesTRIG, berries;
  
  
  grainspawnINDEX = (MouseX.kr(-1,1)*MouseX.kr(-1,1)) + (MouseY.kr(-1,1)*MouseY.kr(-1,1));
  grainspawnINDEX = sqrt(grainspawnINDEX);
  yellowtoneSCALE = (51*(grainspawnINDEX[lessthan]0.8));
  
  //what is seasone?
  seasonMODULO = frac(grainspawnINDEX*36)*40;
  //yellowtoneSCALE = Slew.ar(yellowtoneSCALE, 300, 300);
  grainspawnTRIG = Dust.kr(yellowtoneSCALE);
  creamwoodINDEX = (grainspawnINDEX[greaterthan]0.7)*50 + seasonMODULO;

  //"1.628" is "primitive imitation phi"
  orangetoneINDEX = (MouseY.kr(0,100)*(MouseY.kr(-1.628,1)[greaterthan]0));
  orangetoneTRIG = Dust.kr(orangetoneINDEX);
  yellowtone = 1111 - (orangetoneINDEX*8);
  
  berriesINDEX = (grainspawnINDEX[greaterthan]0.7)*8;
  //methinks some berries should be undergrounds
  berriesINDEX = berriesINDEX*(MouseY.kr(-1.628,1)[lessthan]0);
  berriesINDEX = berriesINDEX*(grainspawnINDEX-0.7);
  berriesTRIG = Dust.ar(berriesINDEX);

  // creeping ivy needs 2B implemented, as staccatic clicks of hairy vines  
  creepingIVY = (grainspawnINDEX[greaterthan]0.75)*(grainspawnINDEX[lessthan]0.9);
  ivyTRIG = Dust.ar(creepingIVY*4);
  grainENV = Env.triangle(1,1);
    rootsENV = Env.new([0.001,1,0.001],[0.1,10],'exponential');
  ivy = TSpawn.ar({
    var xylemLIFEFORM,phloemLIFEFORM;
    var xylem, phloem = 0;
    xylemLIFEFORM = EnvGen.ar(rootsENV,1,0,30,0,0.01);
    phloemLIFEFORM = EnvGen.ar(rootsENV,1,0,30,0,0.01);
    xylem = Saw.ar(yellowtone*10.0.rand+(phloem*100),xylemLIFEFORM);
    phloem = Saw.ar(yellowtone*10.0.rand+(xylem*100),phloemLIFEFORM);
    phloem;
  }, 1, nil, ivyTRIG,0.003);
  //what is the sound of Jeremies' sawe?
  grain = TSpawn.ar({
    var xylemLIFEFORM,phloemLIFEFORM;
    var xylem, phloem = 0;
    xylemLIFEFORM = EnvGen.ar(grainENV,1,0,30,0,0.1);
    phloemLIFEFORM = EnvGen.ar(grainENV,1,0,30,0,0.1);
    xylem = Saw.ar(yellowtone+100.0.rand+(phloem*creamwoodINDEX),xylemLIFEFORM);
    phloem = Saw.ar(yellowtone+100.0.rand+(xylem*creamwoodINDEX),phloemLIFEFORM);
    phloem;
  }, 1, nil, grainspawnTRIG,0.003);
  orangetoneINDEX = (MouseY.kr(0,1)*(MouseY.kr(-1,1)[greaterthan]0));
  orangetoneTRIG = Dust.kr(orangetoneINDEX);
  root = TSpawn.ar({
     var bwonkus,strand;
     bwonkus = EnvGen.ar(rootsENV,1,0,1,0,0.5);
     strand = LFTri.ar(LFTri.ar(yellowtone*0.85.rand+yellowtone*0.25,bwonkus*orangetoneINDEX*80,(yellowtone*0.85*0.25)+yellowtone*0.25.rand),bwonkus);
     //roots do get the brawniest right beneath the tree
     Latch.ar(strand,Impulse.ar(abs(MouseX.kr(-8000,8000))))
  },1,nil,orangetoneTRIG,0.1);
  berries = OverlapTexture.ar({
    var bloop,note=1;
    var innerberryTRIG;
    innerberryTRIG = Dust.ar(abs(MouseX.kr(-11,11)));
    //berryes do get calmest in the topmiddle of the tree/screen
    bloop = Sequencer.ar({
      note = note * 1.628;
      if (note [greaterthan] 19, {note = 11.rand + 2});
      note
    },innerberryTRIG,yellowtone/32,MouseY.kr(1,2));
    bloop = Slew.ar(bloop,3000,3000);
    Resonz.ar(Decay2.ar(berriesTRIG,0.001,0.1,WhiteNoise.ar(10)),bloop,0.002,2)
  }, 5,2,18,1,nil,2);
  
  root+grain+berries+ivy

}, 500, "mulbroot.aif", 'AIFF', '16 big endian signed'))
//}.play)