The orange is a signal I recorded, the blue - my first restoration attempt, after which I decided to ask.

Signal with defects

The signal is audible, however there are 2 types of defects 1) baseline changes 2) sudden drops/spikes (which are not single point):

Zoomed in spikes

This doesn't look like smoothing/IR filtering problem, but rather some detection + arithmetic. Maybe I can code solution myself, but are there some ready-made solutions?


1 Answer 1


Assuming some processing delay is acceptable (100 ms should be more than sufficient), and given there is such a substantial difference between the spike peaks and the signal level, a robust solution would be a non-linear puncture based filter by removing the spikes based on a threshold detector (that then replaces the the required number of samples before and after the threshold with a prior running mean of the filtered signal) and then pass the resulting signal through a low pass filter that has a duration in time at least ten times longer than the interval of time removed due to a spike. Use a running mean and rms of the filtered output for dynamic processing. The mean is described above to replace removed samples as a reasonable minimum error estimate of the sample otherwise hidden and the standard deviation is used to set the threshold. A threshold of 3-sigma above the mean should work well, but ultimately you could also track the statistics of the peak and place the threshold based on optimized probability of false alarm versus probability of detection trades.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.