So I'm making an audio program using processing and I came across a small road block in that when I tell minim to remove a audio signal (a Sine wave) from the audio output, it would end up with a small popping sound which I know is the program removing the sound when it's amplitude is not and the speakers thinks it should try and jump from whatever the sound's amplitude to 0.
How would I go about removing the audio signal when it's amplitude is at 0 instead of whenever the signal gets called?
The play function gets called once every 3 frames by the main program. out is polyphonic. Thanks
public void play(int column){
for (int i = 0; i < notes[column].length; i++){
if (column == 0){ //special case when the current time indicator is 0
if (notes[notes.length-1][i] == true && notes[column][i] == false){ // find previous notes on this row
out.removeSignal(sounds[i]);
}
if (notes[notes.length-1][i] == false && notes[column][i] == true){
out.addSignal(sounds[i]);
}
}
else{
if (notes[column-1][i] == true && notes[column][i] == false){
out.removeSignal(sounds[i]);
}
if (notes[column-1][i] == false && notes[column][i] == true){
out.addSignal(sounds[i]);
}
}
}
}
I only used Minim to play mp3 files, though i had the same problem there. Instead of removing the signal, i used Minims stop() / mute() / pause() functions and removed the signal a few frames after executing the code above.