minim using twice?
in
Core Library Questions
•
8 months ago
hi
i am using minim to generate a pip from value 1000 to 1100 - so far so good - it works
but it says in the console below:
=== Minim Error ===
=== Likely buffer underrun in AudioOutput.
i have no idea what that means but it works
but
if i want to do another pip at value 2000 to 2100 it does not work anymore. it seems as if it would only work once?
can anyone help?
here is part of the code concerning the pip
- import ddf.minim.*;
import ddf.minim.signals.*;
Minim minim;
AudioOutput out;
SineWave sine;
void setup() {
size(842,566);
background(255);
smooth();
//pip
minim = new Minim(this);
// get a line out from Minim, default sample rate is 44100, default bit depth is 16
out = minim.getLineOut(Minim.STEREO, 2048);
// create a sine wave Oscillator, set to 440 Hz, at 0.5 amplitude, sample rate 44100 to match the line out
sine = new SineWave(440, 0.5, out.sampleRate());
}
void draw() {
background(255);
stroke(0);
//pip again
if ((value > 1000) && (value < 1100))
{
out.addSignal(sine);
}
if (value > 1100) {
out.close();
minim.stop();
}
if ((value > 2000) && (value < 2100)) {
out.addSignal(sine);
}
if (value > 2100) {
out.close();
minim.stop();
}
}
1