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 & HelpOther Libraries › Minim BeatDetect class going bananas over silence
Page Index Toggle Pages: 1
Minim BeatDetect class going bananas over silence (Read 963 times)
Minim BeatDetect class going bananas over silence
Jul 27th, 2009, 2:39pm
 
I've got the microphone set up to stereo mix on my laptop - so it should be reading the sound being played out only.

I'm running the following code and it's going bananas over silence. My computer is making no noise and it's acting like it's at a rave.

My aim is to build a little bit extra around the BeatDetect class to read decaying thresholds. I've looked at the code and ddf has left a route in there to monitor thresholds (isRange). But I've ran the drawGraph command it's going ****ing mental.

Could someone please try running this code for me please? If it does nothing - then it's my machine. If it goes mental for you, then I've set it up wrong somehow. It should run verbatim with Processing 1.0.5.

Thanks for your time.

Code:

import ddf.minim.signals.*;
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;

Minim minim;
AudioInput mic;
BeatDetect beat;
BeatListener bl;

float eRadius;

void setup()
{
size(200, 200, P3D);
minim = new Minim(this);
mic = minim.getLineIn(Minim.MONO, 2048);
beat = new BeatDetect(2048, 44100);
bl = new BeatListener(beat, mic);
beat.setSensitivity(300);
ellipseMode(CENTER_RADIUS);
eRadius = 20;
}

void draw()
{
background(0);
float a = map(eRadius, 20, 80, 60, 255);
fill(60, 255, 0, a);
if ( beat.isKick() ) eRadius = 80;
ellipse(width/2, height/2, eRadius, eRadius);
eRadius *= 0.95;
if ( eRadius < 20 ) eRadius = 20;
beat.drawGraph(this);
}

void stop()
{
mic.close();
minim.stop();
super.stop();
}

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

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

void samples(float[] samps)
{
beat.detect(source.mix);
}

void samples(float[] sampsL, float[] sampsR)
{
beat.detect(source.mix);
}
}
Re: Minim BeatDetect class going bananas over silence
Reply #1 - Aug 28th, 2009, 2:42am
 
Yup, I get the same thing.

I'm guessing the algorithm works based on relative loudness. If you've got no music going then it'll pick up the faintest sound.

I wish minim had a sensitivity that wasn't just the frequency of beats, but had a basis in amplitude, but I've also found it impossible to track how many bands the underlying fft has, so I guess the library isn't quite finished yet...

(or the beat detect class is just an example and serious users have to roll their own)
Page Index Toggle Pages: 1