// Noise Reducer Test Program // Copyright 2009 Les Hall // This software is protected by the GNU General Public License // parameters - change these to test the algorithm 1024 => int fft_size; // must be a power of 2 0.5 => float alpha; // must be >0 and <1 0.1 => float noise_level; // must be >=0 // the patch adc => Gain add => FFT fft => blackhole; IFFT ifft => dac; Noise n => add; noise_level => n.gain; // vocal noise remover fun void remove_noise () { fft_size => fft.size; Windowing.hann(fft.size()) => fft.window; complex s[fft.size()/2]; complex avg[fft.size()/2]; while (true) { fft.upchuck(); fft.spectrum(s); for (int i; i<(fft.size()/2); i++) { alpha * avg[i] + (1-alpha) * s[i] => avg[i]; } ifft.transform(avg); (fft.size()/2)::samp => now; } } spork ~ remove_noise(); // time loop while (true) { ifft =< dac; add => dac; <<<"adc + noise => dac", "">>>; 5::second => now; ifft => dac; add =< dac; <<<"adc + noise => NR => dac", "">>>; 5::second => now; }