Added simple /noise canceler/spectral subtraction/
Managed to add noise cancellation before demodulation. The "effect to complexity ratio" is highest so far, so might be good to merge to master.
Here is a sample:
https://github.com/user-attachments/assets/3a4ccefa-80d0-4fbd-b0d0-98f5534ae9ee
The noise cancellation is enabled at around 11s and the full effect is reached at about 25s.
The overall effect is like adaptive-multi-auto-notch:
wow, just wow!
great work!
Hi, this is pretty neat, thanks very much! Excellent work as usual! I'm out of action for a couple of weeks, so might not be able to look at this for a little while. I have been doing quite a lot of work on the TFT branch (although I'm not sure how much I have pushed recently) hoping to do a release based on this fairly soon, so might be worth taking a look. I also had a go at a very minimal noise canceller I would be interested to see how much overlap there is.
Hi, this is pretty neat, thanks very much! Excellent work as usual! I'm out of action for a couple of weeks, so might not be able to look at this for a little while. I have been doing quite a lot of work on the TFT branch (although I'm not sure how much I have pushed recently) hoping to do a release based on this fairly soon, so might be worth taking a look. I also had a go at a very minimal noise canceller I would be interested to see how much overlap there is.
I'll take a look. Thanks. I'm still testing/optimizing the noise canceler, so more commits will follow.
Couldn't decide which mode is better, so added both.
@dawsonjon , I've tested the noise reduction function on tft branch and it works good, but only when the threshold is set correctly. My version doesn't require setting any parameters for similar effect. Also, my Soft version of the noise canceler almost completely eliminates the "musical noise" the simpler methods suffer from.
For anyone testing this PR, only with the last commit (0bedd7a) the Soft version of the canceler reaches its full potential. Here is another screen. Full effect is reached at about 17s:
https://github.com/user-attachments/assets/32818782-77dd-43d9-b729-30f2e3e7529a
The small amount of "musical noise" disappears completely after 18-20s.
Here is another demo with the raw IQ streamer:
https://github.com/user-attachments/assets/2f6d9a95-6537-4d14-b811-de8ab7f39202
@mryndzionek I had a chance to go through this in a bit more detail, very nice! There is actually quite a bit of similarity with the noise canceller on the TFT development branch. I guess great minds think alike!
Both designs estimate the noise using a historic minimum magnitude, mmse == noise_estimate. I think you are using the minimum over the last 10 frames, I tried using a leak-minimum-hold function to reduce memory (about 2k). I made the time constant a programmable parameter so that you can chose how quickly to respond to short term changes in the noise level.
They both include a signal level estimate by low-pass filtering the magnitudes, and they both calculate the gain function in the same way (alpha == threshold). In both cases the gain weighting for each bin is calculated as 1-alpha*mmse/magnitude or 1-threshold*noise_estimate/signal_level.
A higher value of alpha/threshold results in a more aggressive effect, removing more of the noise. I made the parameter programmable (threshold values of low, medium and high correspond to alpha values of 1, 2 and 3). I spent a bit of time trying to understand the adaptive alpha level, and it looks like it changes the alpha value depending on the SNR using a value of 6 for -5dB which decreases to 1 at 20dB. Did I get that right? I tried plotting the overall effect of the adaptive mode on the gain weighting at various SNRs for comparison. The result is a steeper curve that kicks in later, but increases the gain more rapidly as the SNR increases.
Its impressive work! You have created a very effective noise reduction algorithm, using negligible additional CPU. Thanks for the excellent work!
and it looks like it changes the alpha value depending on the SNR using a value of 6 for -5dB which decreases to 1 at 20dB.
Yes, so the ramp is computed here.
Its impressive work! You have created a very effective noise reduction algorithm, using negligible additional CPU. Thanks for the excellent work!
Thanks for the kind words. I would not be able to figure it all out myself. I've studied several papers for this, especially this one.