realtime spectrum subtraction of a microphone from white noise

loci már's icon

Hello, Im having problems with making a device that can subtract the spectrum of a microphone from noise or any other source. I've tried numerous things but couldnt find a solution. My main question now is, Can i use buffer in real-time? I need that for the index~ to subtract the bins one by one after the FFT. Im kind of new to max so any info is appreciated.

Jean-Francois Charles's icon
loci már's icon

Not really, in my case i really need to figure spectral subtraction inside max, but Thanks for the reply

Roman Thilenius's icon

we do have a thread somewhere here with a complete spectral denoiser incl. "learn" function.

loci már's icon

i only found examples of cutting everything below a threshold from a noisy recording with pfft. I have 2 separate signals, and i want to subtract one from the other in real time. Thanks for the reply

Source Audio's icon

"I have 2 separate signals, and i want to subtract one from the other in real time."

why don't you mix them phase reverted ?

loci már's icon

thats what Im trying to do, but i need to it for every frequency bin separately after an FFT, do you think thats possible?

Roman Thilenius's icon

that is the idea. you would write the noise image into a buffer of one fft blocks length, revert it, and use it to modulate the amplitude of individual bins. third outlet of fftin~ is your friend here.

Jean-Francois Charles's icon

If you just want the difference of energy between two signals in every frequency bin, maybe something as simple as that:

Max Patch
Copy patch and select New From Clipboard in Max.

Make sure you study the FFT Max tutorials and the examples (menu Extras -> ExamplesOverview -> MSP -> FFT Fun...)