Interpolating zero amplitude samples

I have MiniDV recordings that appear to have spurious zero value samples in the audio at random times for brief moments. Of course I discover this after I no longer have the ability to re-capture the tapes. What I would like to do is find a filter or write a Nyquist formula to interpolate the missing sample values. This is a similar problem to https://forum.audacityteam.org/t/interpolate-spurious-zero-amplitude-samples/19324/1 however, my situation is only one missing sample every 5 samples for approximately 0.035 seconds each time. Before I try to figure out how to build my own Nyquist plugin, can any one point me to anything else already written or that might help? These clicks are really annoying. They usually happen only on one channel at a time.

This audio is pcm_s16le (PCM signed 16-bit little-endian), 46.88 kHz, 1.46 mb/s and goes with dvvideo (DV Digital Video), 29.97 fps, 23.84 mb/s video from a Panasonic camcorder. I’d like to find a way to fake the missing data so the audio chirps go away. Then I plan to use ffmpeg to re-inject the audio back into the container and then convert to H.264/aac for long-term storage.

Suggestions on how to process the audio?
MissingSamples.png

Median filter ? … de-click via differentiation then limiting then integration - #9 by Robert_J_H


Medianfilterp.png
Median filter - Wikipedia

I tried this filter and it ended up garbling the audio more than I would like. Thanks for the suggestion though.

Not sure if there’s a name for it, but the absolute max of “signal” and “delayed signal”, where the latter is delayed by 1 sample, may work.

DV dropouts cure code: replace any zeros with the average of the points either side …
https://forum.audacityteam.org/t/help-needed-to-create-a-plugin-for-fixing-dv-clicks/26972/8

You could try this code in the Nyquist Prompt (https://manual.audacityteam.org/man/nyquist_prompt.html):

(defun process (sig)
  (sim (snd-avg (s-max sig 0) 2 1 op-peak)
       (snd-avg (s-min sig 0) 2 1 op-peak)))

(multichan-expand #'process *track*)

That code generates a lot of odd harmonics, (so has exciting :wink: possibilities)

exciting repair.gif

It’s just tracking the peak level for each pair of successive samples.

This actually does a pretty good job of removing the clicks! Unfortunately, there are a hundred or more clicks per hour of audio/video. (And hours and hours of video.) Way too many for me to manually run this on the individual clicks themselves. Running this on the entire audio file can be done… but it ends up distorting the audio in such a way it sounds similar to the effect you get when the signal is too string and clipping is happening. So what I need is a way (through code) to identify the seconds of audio needing to be fixed and only apply this to those sections.

What does it sound like when played through a stereo - is it noticeable. Can you upload a sample to this forum for analysis.