I have a setup with an embedded DSPIC. This is used to link multiple audio inputs to the outputs and changed between them either when told to, or when one is active. This changing takes place on a hardware that is purchased and from what I can tell uses a relay. I have DSP software using a heterodyne filter to remove static noise as the system runs.

However, when the output switches from silent to one output on, there is a large spike in amplitude that lasts for about 3 to 4 milliseconds. This is similar to the click a walkie talkie makes.

I was wondering if there was any way to determine when this happened and then do some sort of amplitude reduction. My sample rate is only 8khz and the signal has been checked on the scope to run at 1khz during this period. I tried doing a 5 point median filter which kind of worked, but on a larger speaker system would still be loud. I also looked into doing a differentiation filter and seeing if the derivative was large. If it was I would cut the next sample point in half and continue. This had no apparent effect.

Any ideas?

  • 1
    $\begingroup$ What is your required switching latency? Is it acceptable to just mute the output for a few milliseconds while making the switch? $\endgroup$ – Jason R Aug 4 '14 at 22:03

If I understand you correctly, then your issue is connected with transient that is present when switching on your device, because it is a RLC circuit. Most likely these spikes are not changing over time (because values of passive components are constant), if so, then you can:

  • Create the template of such spike and use the normalised correlation for detection. If it's above a given threshold, then substitute samples with linear/spline or whatever interpolation.
  • Use the Matched Filtering approach (which is almost the same as above approach, but offers better SNR performance) and remove detected samples accordingly

If your spikes are of random nature, then there is many methods that are allowing to remove any crackles and clicks. You might refer to the literature for such solutions:

Oudre L. - Automatic detection and removal of impulsive noise in audio signals

Knapp M., Bashir R. - Audio Click Removal using LPC

Godsil S., Rayner P. - Digital Audio Restoration

Alvarez E., et al. - Detection of clicks using sinusoidal modelling for the confirmation of the clicks


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.