We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi everyone, I want to try and modify an existing code (which tracks in real time the amplitude of surrounding noises and visualises them via a waveform on the screen), so that when a certain sound reaches a certain amplitude a desired sound (such as the recorded sound of rain) starts to automatically play to negate this noise, and stops after the noise it is trying to negate has not gone above that same high amplitude for 10 seconds. How would I go about modifying this existing code to do this?
Any kind of feedback would be appreciated!
Here is the existing code I have-
` import ddf.minim.analysis.*; import ddf.minim.ugens.*; import ddf.minim.*;
Minim minim;
FFT fft;
AudioInput in;
void setup() { size(1000, 300, P3D);
minim = new Minim(this);
in = minim.getLineIn();
fft = new FFT(in.bufferSize(), in.sampleRate());
}
void draw() { background(0);
stroke( 255 );
for(int i = 0; i < in.bufferSize() - 1; i++) { float x1 = map( i, 0, in.bufferSize(), 0, width ); float x2 = map( i+1, 0, in.bufferSize(), 0, width ); line( x1, 50 + in.mix.get(i)50, x2, 50 + in.mix.get(i+1)50 ); }
noStroke(); fill( 255, 128 );
rect( 0, 0, in.mix.level()*width, 100 );
}`