// ITU Experimental Interaction, spring 2011. Mandatory Assignment #07. Jakob Fischer Jørgensen. Mail: jfis@itu.dk. // Area: Networks and Noises. // Theme: Poetry. // Requirements: Sketch must implement a server and a client set-up and/or use sound as a form of interaction. // Import all the minim stuff import ddf.minim.*; import ddf.minim.signals.*; import ddf.minim.analysis.*; import ddf.minim.effects.*; // import processing.opengl.*; // Declare variables and sound variables including FFT objects and time // FFT Manual: http://code.compartmental.net/tools/minim/manual-fft/ Minim minim; AudioPlayer music; FFT fft; FFT fftLog; int iNumAverages = 32; float m = millis(); void setup () { // The usual setup stuff: cursor, FPS, size, OPENGL cursor (CROSS); frameRate(60); size (800,450); // Start the sound engine minim = new Minim (this); music = minim.loadFile("atf.mp3"); // Make our FFT object ready to process buffer size and sample rate fft = new FFT(music.bufferSize(), music.sampleRate()); // Set number of averages used when computing the spectrum // and spaces the averages in a linear manner fft.linAverages(iNumAverages); // Make our FFT object ready to process buffer size and sample rate fftLog = new FFT(music.bufferSize(), music.sampleRate()); // Sets the number of averages used when computing // the spectrum based on the minimum bandwidth for an octave // and the number of bands per octave fftLog.logAverages(22, 3); // Loop the mp3 file music.loop(); } void draw () { // All the usual draw stuff colorMode(RGB,255); background (0); noFill(); stroke(1); strokeWeight(1); // perform a forward FFT on the samples in the mix buffer fft.forward(music.mix); // Call update, arms, twist and length from // FftVar Class, for our 'R' key visualisation fftTotalScale.Update(); fftArms.Update(); fftTwist.Update(); fftLength.Update(); // Different visualisations for each key in the following // The P2D, P3D, and OPENGL renderer settings allow stroke() and fill() // settings to be altered per-vertex, however the default JAVA2D renderer does not // Settings such as strokeWeight(), strokeCap(), and strokeJoin() cannot be changed // while inside a beginShape()/endShape() block with any renderer if(key=='w') { // Funny lines visualisation, endpoint can be moved with mouse colorMode(RGB,255); beginShape (); fill(random(200),random(200),random(200)); for (int i = 1; i