Noise blanker - df8oe/UHSDR GitHub Wiki
A new noise blanker based on linear prediction analysis has been implemented. It was inspired by the noise blanker in the wdsp library by Warren Pratt, but was programmed from scratch by Michael [DL2FW].
The noise blanker consists of two parts, the detection of noise impulses and the interpolation of samples that have been detected as corrupted by noise impulses. These two parts are explained in more detail below (the theoretical background is explained in Vadeghi 2008):
Detection of noise impulses:
- take one sample frame of 128 samples from the incoming audio
- calculate autocorrelation of the samples: R[i] = sum[n=0 -> 128-i](in[n] * in[n+i])
- use alternative Levinson-Durben-algorithm to calculate the LPCs (linear prediction coefficients)
- inverse FIR filter (10 taps, reversed LPC coeffs) performed on the input samples to eliminate voice and enhance the impulses
- matched FIR filter (10 taps, LPC coeffs) to detect impulses in the "voiceless" signal
- calculate sigma2 (variance) of the "voiceless" signal
- calculate LPC_power = sum of the power of the LPCs
- calculate impulse threshold as 2.5 * sqrt(sigma2 * LPC_power)
- search through all the 128 samples to detect impulses larger than the threshold
Now we have detected samples containing impulse noise in our 128 samples and can start to replace only those specific samples. They are replaced with a clever interpolation of the signal performed by the linear prediction.
Insert interpolated samples into detected impulses
- if at left boundary of the sample frame, take some samples of the last frame (13 samples)
- calculate forward and backward transfer functions from LPCs by simply negating the coefficients
- only do reconstruction for detected impulses (see above, stored in variable impulse_count)
- for every detected impulse, calculate forward and backward predictions using the actual values of all the samples in the frame
- weight those predictions for the impulse length (set to 7 at the moment)
- add forward and backward predictions
- finally replace original signal for the impulse length with the prediction
- DONE !
Michael has also built a test procedure artificially producing a nasty impulse which is nearly perfectly replaced by his implementation of the algorithm. Testing of the noise blanker under field conditions is under way at the moment. Comments on this are greatly appreciated.
Vadeghi, S.V.(2008): Advanced Digital Signal Processing and Noise Reduction. - Wiley & Sons.