We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSound,  Music Libraries › ESS find pitch and bass
Page Index Toggle Pages: 1
ESS find pitch and bass (Read 912 times)
ESS find pitch and bass
Nov 28th, 2005, 5:32pm
 
Hey, I'm trying to find the drum beats in a song and identify different notes in the melody of a song.  I have been using the spectrum[] example to try to find the drum beat.  Does anyone have any ideas? Thanks.  Dave

// Most Code used from an Example by Krister Olsson

import krister.Ess.*;

Channel myChannel;

void setup() {
 size(256*2,200);

 // start up Ess
 Ess.start(this);

 // load "hello.aiff" into a new Channel
 myChannel=new Channel("voyager3.mp3");
 
 myChannel.useEqualizer(true);

 // we want 256 frequency bands, so we pass 512
 myChannel.setupFFT(512);

 // start the sound looping forever
 myChannel.play(Ess.FOREVER);
 
 noStroke();
 fill(255);
}

void draw() {
 background(0,0,255);
 
 
 // load our spectrum
 myChannel.loadSpectrum();
 // draw our frequency bars
 for (int i=0; i<256*2; i+=2) {
   float temp=max(0,180-myChannel.spectrum[i/2]*175);
   rect(i,temp+.5,2,height-temp+.5);
   
   if(i == 2 && (temp+.5) < 140){  
     //println(temp+.5);
     //kinda inconsistant - blinks with strong snare
     fill(255,0,0);
     ellipse(70,70,10,10);
     fill(255);
   }
 }
 fill(255,0,0);  
 rect(1,135,2,2);
 fill(255);
}

// we are done, clean up Ess

public void stop() {
 Ess.stop();
 super.stop();
}
Page Index Toggle Pages: 1