Automatic removal of mouth smacks, again

Here’s a synthetic glitch that is of the type often caused by bad editing (around the middle of this audio clip)

This is possibly a worst case scenario for the repair part of the plug-in, but the detection part picks up the glitch beautifully,
Run the detection part of your effect with a 2 ms block length, then select the label, then press Z to adjust the selection to zero crossing points, then use the “Repair” effect, and the result is about as good as is possible.
Probably the biggest complaint about the Repair effect is that it has to be applied to a selection less than 128 samples, and that making the selection is time consuming and tedious. With a bit of tweaking your detection algorithm could be just the thing for automating “Repair” across longer selections.

Don’t let this distract you from the “mouth smacks” issue, but I think your detection algorithm could (also) be adopted for more general click repair purposes.

What I said about spectrograms applies to that example too. A definite vertical stripe with no bottom.

Is the algorithm of Repair documented somewhere in Wiki? Could it be done in Lisp too with reasonable efficiency?

No, but comments in the code say that it is “Least Squares AutoRegressive Interpolation”.

I think it would probably be extremely slow.

It still doesn’t sound very good. Perhaps there is no really good fix for the case of bad editing that does not delete samples.

But “Repair” fixes your first example of the seven sample glitch very well, and my detection procedures combined with that could be useful.

As you say, I think that is as good as it gets.

Yes indeed.

A historical note:
The original Repair effect included click detection. I assume that the detection was problematic in some way, so it was later removed. Perhaps it wasn’t as good as your detection algorithm. What I’m thinking is that if the user options can be made simple enough, then your detector could perhaps be implemented in C++ as an enhancement to the Repair effect (as well as a Nyquist implementation that specialises in repairing mouth smacks). What do you think?

Could you entrust me with that project?

I was a good C++ programmer on the job, but never made a home hobby of it… and maybe it would be good for me to dust off those skills.

But who would test my code on all the operating systems? Would that be my duty too or something I could delegate?

Sure, go for it if you’d like to :slight_smile:

I can test on Linux for you.
In most cases, if the code works on Windows and Linux then it is likely to work on Mac OS X (the exception being GUI elements which are quite often different on Mac), but once it has been submitted as an enhancement it will be tested on all platforms before being marked “patch_ready”.
Just so that you are forewarned, the journey from a working patch to the patch being committed into the main source code can be frustratingly slow.

All patches should be made against svn head, so if you’ve not done so yet the first thing to do is to build Audacity from the source code.
There are instructions for building on Windows here: Missing features - Audacity Support
and a brief “developers guide” here: Missing features - Audacity Support
(The one rule of coding standards that everyone is required to follow is “don’t use tabs at all, and always use three spaces for indentation”)

If you run into problems building (the instructions are not great), then post on the “Compiling” forum board and I expect that Edgar will offer assistance.

Violated in my Lisp here… I haven’t looked up how to suppress tabs in emacs.

That’s why I mentioned it :wink:

For published Nyquist plug-ins (on the wiki or shipped with Audacity) we prefer standard indentation to be 2 spaces. The problem with tabs is that they display differently according to the editor that the file is opened on and we like to make it easy for anyone to open and read the code. Some of the old plug-ins on the wiki have horrible formatting, but we’re trying to improve and become more consistent with that.

Just figured out how to make emacs not use tabs.

Replaced all my tabs with space x 8 in that program. Funny, it went from 53 kb to 65! But disk space is cheap.

BTW - I just found this thread a few minutes ago, after posting a new thread on this subject (which I believe was your original…)

While I’d love the code to be hyper-efficient, I’ll trade many cups of coffee/tea/other (time off) if it works well. Slower and accurate is huge if this is right. Doing this manually is hours of work, so if a 30 minute voice file can be processed in 5 minutes that would be amazing! I’ll report back with progress. IF you ever need testing or test materials, please send me a PM (or post here, your choice) and I’ll either test for you, or send you anything that is helpful.

I have hours of test material, I’ll report back how it goes.

First impressions: Darned close.

At the defaults it doesn’t remove some of the subtle clicks that I need cleaned, but now I’m going to tweak.

Note that it does reduce some of the clicks circled in the screenshot below, but we need those clicks to be even further reduced because during the “silence” they are still noticeable if you are listening at moderate to loud volumes. I’m hoping with different settings they can be reduced to below the noise floor and for practical purposes be silent. In the case where they are “surrounded” by the noise floor (silence), they could be cut out and nobody would care. We delete them manually at this time, rather than replace with room tone (aka “silence”).

I made a sample file (under 5 seconds) that shows the exact issue I’m trying to eliminate.

I uploaded it in another thread, but since this is the thread dedicated to your tool, I’m uploading again. (Mods: If this is inappropriate, please let me know and I’ll delete in one of the two places! I’m new to the board and don’t mean to violate any specific policies!)

Now I’m back to testing, looking for what I need to change from the defaults.

Hats off to you! This tool will be loved by all the audiobook processors out there (growing by the day.)

Oh believe me, I’ve been there too.

I can’t claim yet to have used this for production. Frankly it’s such a diverting programming challenge of itself, it has stalled my production! (Luckily neither activity is my livelihood.) But I think it has great promise as a labor saver.

Yet the question is how to tweak the settings and understand the tradeoffs. For instance I thought that more (and narrower) frequency “bands” might make for superior fixes at the cost of more compute time. But perhaps that isn’t quite so.

There are other tradeoffs to discuss too. But I hope to find good enough default settings that more casual users don’t need to think too much about them.


BTW - I’m still not usually using this on complete 20-30 min tracks, but trying it on 2-10 second sections that have an issue.

I just had a great success where it took out some mouth noise in the middle of some words.


I’m continuing to test different slices of audio, to figure out what works/doesn’t in my specific cases.

I’m very impressed overall, I’ll probably have a few tweak ideas for you.

Thanks for putting this out there, even at this stage it’s a very useful tool


Thanks for the help. Did you use default settings or others?

Mostly the defaults. I have tried setting the first parameter (peak to background) at 3 rather than 2 with good results.

I have experimented with the others but not enough to really understand all the interactions among them.

That said, I’m impressed what what it’s doing, and it does improve the quality of the sound. (I’m a former musician, with really great monitors, so I tend to hear more details than many.)


It is important of course not to overcorrect dsirable sounds and make mud. Earlier efforts dulled stop consonants too much but I found a simple fix for that.


since I was pointed to this thread by a forum moderator (who then ducked behind a couch) I hope it isn’t considering necroing because I’m wondering if this project stalled, was finished or abandoned?


I have been making improvements and I was contemplating posting a new improved version. And as a bonus, a de-esser that was a by-product of this development. Your expression of interest may spur me to present what I have in a day or two.

Have you tried the version above with any success?


I just tried it for the first time and it did nothing which is why I came back here to see what settings I ought to be using. :slight_smile:

Once I’ve figured that out I shall try again and let you know.

On a side note, I didn’t find that my humidifier did anything to resolve the issue (though whoever suggested it on a search I did swore it eliminated them for him) so I’m back on the breathing, green apples and warm water.