Detecting bass with processing

I am relatively new to processing and I'm trying to find a way to make processing register bass frequences only. This is for a school project where we are making a party lamp that can detect if there is a party going on in the house.

We have tried different solutions, mainly using the beatDetect class, but we find it difficult to get processing to register bass only. Either the code is too sensitive to other background noises, or we can't figure out what type of frequency, or band, to use with isRange. (Using information from this webpage:,%20int,%20int) ). This code should make the square "jump" when it registers a frequency in the bass spectrum, but it jumps all the time even when we speak. We want to make it jump only when there are low bass-frequencies.

Sorry about the weird explanation, but can somebody help us? Here is the code we are experimenting with:

import ddf.minim.*;
import ddf.minim.analysis.*;

class BeatListener implements AudioListener
 private BeatDetect beat;
 private AudioInput source;

 BeatListener(BeatDetect beat, AudioInput source)
   this.source = source;
   this.beat = beat;

 void samples(float[] samps)

 void samples(float[] sampsL, float[] sampsR)

Minim minim;
//AudioPlayer song;
AudioInput in;

BeatDetect beat;
BeatListener bl;

int time = 30;

float kickSize, snareSize, hatSize;

void setup()
 size(512, 200);
 minim = new Minim(this);

 // get a line in from Minim, default bit depth is 16
 in = minim.getLineIn(Minim.STEREO, int(1024));

 // a beat detection object that is FREQ_ENERGY mode that
 // expects buffers the length of song's buffer size
 // and samples captured at songs's sample rate
 beat = new BeatDetect(in.bufferSize(), in.sampleRate());
 kickSize = snareSize = hatSize = 16;
 // make a new beat listener, so that we won't miss any buffers for the analysis
 bl = new BeatListener(beat, in);


void draw()
 if ( beat.isRange(1,1,1) ) kickSize = 32;

 rect(width/4, height/2, 20, 20);

 kickSize = constrain(kickSize * 0.95, 16, 32);

 for (int i=0; i<10; i++) {

void stop()
 // always close Minim audio classes when you are finished with them
 // always stop Minim before exiting

 // this closes the sketch
Sign In or Register to comment.