/*So what I have here is an attempt to randomly select two images from an available six, and then select and swap various pixels from the two images. Using the data from the pixel swaps, a generated pink noise would change pitch each time it was played over the course of the audio. Despite running through all the examples, as well as the resources explaining the Ess classes and methods, I was only able to get the first part to work. Chances are, there's something very simple that I'm overlooking, and no matter how hard I'll try to find it, I won't.*/ import krister.Ess.*; //Declarin' them variables PImage phase1, phase2; int rand, rand2, rand3, randColX, randColY, duration, shift, vol; //Ess variables AudioChannel myChannel; PinkNoise myPink; Envelope myEnvelope; PitchShift myPitchShift; //Setting up the image to be placed; creating the workspace void setup() { //Declares the two images using randoms rand2 = int(random(1, 6)); if(rand2 >= 1 && rand2 < 2) phase1 = loadImage("monster.png"); if(rand2 >= 2 && rand2 < 3) phase1 = loadImage("cat.jpg"); if(rand2 >= 3 && rand2 < 4) phase1 = loadImage("blur.jpg"); if(rand2 >= 4 && rand2 < 5) phase1 = loadImage("mask.jpg"); if(rand2 >= 5 && rand2 < 6) phase1 = loadImage("god.jpg"); else phase1 = loadImage("dock.jpg"); rand3 = int(random(1, 6)); if(rand3 >= 1 && rand3 < 2) phase2 = loadImage("monster.png"); if(rand3 >= 2 && rand3 < 3) phase2 = loadImage("cat.jpg"); if(rand3 >= 3 && rand3 < 4) phase2 = loadImage("blur.jpg"); if(rand3 >= 4 && rand3 < 5) phase2 = loadImage("mask.jpg"); if(rand3 >= 5 && rand3 < 6) phase2 = loadImage("god.jpg"); else phase2 = loadImage("dock.jpg"); //sets the volume depending on the left pic vol = (rand2 + 3) / 10; //startin' up the ol' Ess Ess.start(this); //sets the duration (in milliseconds) depending on the right pic duration = (rand3 * rand3) * 1000; myChannel=new AudioChannel(); myChannel.initChannel(duration); myPink=new PinkNoise(vol); EPoint[] env=new EPoint[1]; env[0]=new EPoint(0,0); myEnvelope=new Envelope(env); myPink.generate(myChannel,myChannel.frames(1000),myChannel.frames(1000)); myEnvelope.filter(myChannel); //shifting shift = 0; myPitchShift=new PitchShift(Ess.calcShift(shift)); myChannel.play(); size(400, 400); } //all kinds of crazy shit!!!! void draw() { //distorting the left image using pixels from the right for(int i = 0; i <= phase1.width; i++) { for(int e = 0; e <= phase1.height; e++) { rand = int(random(5)); if(rand <=3) { randColX = int(random(phase2.width)); randColY = int(random(phase2.height)); phase1.set(i, e, phase2.get(randColX, randColY)); //the location of the pixels changes the pitch shift += e-i; myChannel.play(); } } } //distorting the right image using pixels from the left for(int o = 0; o <= phase2.width; o++) { for(int u = 0; u <= phase2.height; u++) { rand = int(random(3)); if(rand <=1) { randColX = int(random(phase1.width)); randColY = int(random(phase1.height)); phase2.set(o, u, phase1.get(randColX, randColY)); //the location of the pixels changes the pitch shift += u-o; myChannel.play(); } } } //sets the images image(phase1, 0, 0); image(phase2, 200, 0); } //Closing up the Ess public void stop() { Ess.stop(); super.stop(); }