When listening to music, you sometimes dream or see abstract images. I made small programs to view the sound around you (your computer’s mic in fact). I used processing for this purpose because it’s a convenient tool, providing nice libraries.

The first program is a « sound level » detector, drawing a picture thanks to sound intensity around you.

import processing.sound.*;
AudioIn in;
Amplitude amp;


int ampl;
//setting up things
void setup(){


// Create the Input stream
amp = new Amplitude(this);
in = new AudioIn(this, 0);
in.start();
amp.input(in);

//set draw parameters
size(800,500);
background(0,255,40);
}

//forever loop
void draw(){

//draw a circle depending on sound amplitude
stroke(255,0,150);
fill(ampl%100,ampl%255,ampl%70);
ellipse(random(800),ampl, ampl%50, ampl%50);
ampl=(int)(amp.analyze()*10000)%1000;


}

We get:

Sound art at work office

Sound art at work office

when the boss is coming

when the boss is coming

 

The second program was done in collaboration with a designer, Marylou Petot. She discussed with me about the possibility to sketch the sound, after explanations we concluded that sound can create abstract structures. I wrote a piece of code to push idea to real output. The program use a sound tracks database to form abstract structures. Sounds was captured during chill out in cities and country-side.

import processing.sound.*;
SoundFile file;
FFT fft;
int bands = 512;
float[] spectrum = new float[bands];

void setup() {
  size(640, 360);
  background(255);
  //create instances
  //in = new AudioIn(this, 0);
  fft = new FFT(this, bands);
  // Load a soundfile from the /data folder of the sketch and play it back
  file = new SoundFile(this, "/Users/nicolas/Desktop/music-crookers.mp3");
  file.play();
  file.amp(0.5); //reduce amp
  println("SFDuration= " + file.duration() + " seconds");
    // patch the Audiofile
  fft.input(file);
    //frameRate(6);
  background(255);
}      

void draw() { 
  
  fft.analyze(spectrum);
  float max=0;
  int index=0;
  for(int i = 0; i < bands; i++){
  // The result of the FFT is normalized
  // draw the line for frequency band i scaling it up by 5 to get more amplitude.
    if(spectrum[i] > max ){
        max = spectrum[i];
        index = i;
      }
  //line( i, height, i, height - spectrum[i]*height*5 );
  }
  println(" FFT : "+max*10000+"    indice : "+index);
  //prog1
  fill(index%255,index%255,index%255);
  ellipse((max*10000)%640,(max*10000)%360,index%150,index%150);
  
  
}
Crookers' sound visual

Crookers’ sound visual

This sounds great