minim: detect peaks in amplitude while sound being played

edited March 2018 in Library Questions

Hi there, I was wondering if there's a way to detect amplitude peaks in a sound file while being played. I don't need anything fancy really, I just need to find when the "volume" is above a certain level.

import ddf.minim.*;

Minim minim;
AudioPlayer player;

void setup()
{
  minim = new Minim(this);
  player = minim.loadFile("/data/samples/sample02.mp3");
  player.play();
}

void draw()
{  
  println("Gain: " + player.getGain()); //always prints 0.0 but I guess it's because it's not what I'm looking for
  println("Volume: " + player.getVolume()); //Minim error: Volume is not supported
}

Thank you!

Tagged:

Answers

Sign In or Register to comment.