Deleting Clipped Audio
Forum rules
This forum is for Audacity on macOS 10.4 and later.
Please state which version of macOS you are using,
and the exact three-section version number of Audacity from "Audacity menu > About Audacity".
Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
Please state which version of macOS you are using,
and the exact three-section version number of Audacity from "Audacity menu > About Audacity".
Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
Re: Deleting Clipped Audio
"ESP-Clip-Fix" is currently for mono tracks only.
This as one of my first attempts at modifying a plug-in and the modification is written in spaghetti rather than LISP. I'd probably need to rewrite the whole thing from scratch to develop it further, but this seems to be quite a rare problem so it is not very high in my priorities.
This as one of my first attempts at modifying a plug-in and the modification is written in spaghetti rather than LISP. I'd probably need to rewrite the whole thing from scratch to develop it further, but this seems to be quite a rare problem so it is not very high in my priorities.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
-
Gale Andrews
- Quality Assurance
- Posts: 41761
- Joined: Fri Jul 27, 2007 12:02 am
- Operating System: Windows 10
Re: Deleting Clipped Audio
Maybe a good idea to have a code comment for that, even though you rarely give the plug-in out?steve wrote:"ESP-Clip-Fix" is currently for mono tracks only.
Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual
Re: Deleting Clipped Audio
---------tlm wrote:I've attached a small mp3 portion of the audio to this post for steve and others who've requested it. In response to Gale: yes, you are surely right that the BEST way is to record the audio without clipping in the first place. But as I mentioned, I've found many posts online from folks in a similar situation to mine: The recording cannot be made again because the event is over and if we want to share it with others we are stuck with this recording. Based on my manual deleting, I KNOW that a much better product can be made by deleting the largest spikes -- but as I said, that process must be automated to be practical. I also agree that using EQ to magnify the portions to delete (the spikes seen in screenshot 3) is not 'ideal'. But I want to emphasize that for simple speech it's not necessary to have 'ideal' sound -- but it is necessary to remove glitches that hurt your ears, and that's all I'm after as the person who wants to 'repair' this audio.
In response to Koz: I guess you could say that I request 2 things in my post: (1) Being able to "select" all the data points which are highlighted when one chooses View-->Show Clipping. Once selected, you could then press "delete" and they'd be gone. (2) To be able to set a horizontal threshold above/below which data points would be selected -- thus the spikes of screen shot 3 (which is where all the unpleasant glitches occur) could then be removed by pressing "delete". I can do both (1) & (2) manually, but it just takes forever.
Thanks for all the great help, and so quick!!
Tom - This is exactly what I am looking for also. Would greatly appreciate if you found a programmatic way of doing it. Thanks in advance!
-
Gale Andrews
- Quality Assurance
- Posts: 41761
- Joined: Fri Jul 27, 2007 12:02 am
- Operating System: Windows 10
Re: Deleting Clipped Audio
As described in this topic you can open Effect > Nyquist Prompt... then paste in the following code and click OK:momop540 wrote:---------tlm wrote:I've attached a small mp3 portion of the audio to this post for steve and others who've requested it. In response to Gale: yes, you are surely right that the BEST way is to record the audio without clipping in the first place. But as I mentioned, I've found many posts online from folks in a similar situation to mine: The recording cannot be made again because the event is over and if we want to share it with others we are stuck with this recording. Based on my manual deleting, I KNOW that a much better product can be made by deleting the largest spikes -- but as I said, that process must be automated to be practical. I also agree that using EQ to magnify the portions to delete (the spikes seen in screenshot 3) is not 'ideal'. But I want to emphasize that for simple speech it's not necessary to have 'ideal' sound -- but it is necessary to remove glitches that hurt your ears, and that's all I'm after as the person who wants to 'repair' this audio.
In response to Koz: I guess you could say that I request 2 things in my post: (1) Being able to "select" all the data points which are highlighted when one chooses View-->Show Clipping. Once selected, you could then press "delete" and they'd be gone. (2) To be able to set a horizontal threshold above/below which data points would be selected -- thus the spikes of screen shot 3 (which is where all the unpleasant glitches occur) could then be removed by pressing "delete". I can do both (1) & (2) manually, but it just takes forever.
Thanks for all the great help, and so quick!!
Tom - This is exactly what I am looking for also. Would greatly appreciate if you found a programmatic way of doing it. Thanks in advance!
Code: Select all
(setq threhold 0.95)
(setq frequency 16000)
(let* ((control (rms
(sum (- threhold)
(s-max (snd-abs s) threhold))
20))
(gain (/ (peak control ny:all)))
(control (mult frequency
(sum 1
(mult control (- gain))))))
(lp
(lp
(lp
(lp
(lp
(lp
(lp
(lp s
control)
control)
control)
control)
control)
control)
control)
control))
After "fixing" the track with that code, it is possible that some parts may be over 0 dB, so use the Normalize effect and normalize to -1 dB.
And you can get very close to what you are directly asking for by using Analyze > Find Clipping... . That will label the clipped regions (above 0 dB).
Then click in the panel of the label track (to left of the labels, under the name of the label track) then choose Edit > Labeled Audio > Delete (or Edit > Labeled Audio > Silence Audio). This isn't perfect but is likely to improve things. It will leave clipped regions of one sample each (though those may well not be audible) and won't help if you have reversed polarity clipping where the clip overshoots and becomes the opposite sign.
Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual
Re: Deleting Clipped Audio
Thanks much, Gale!
I tried the Nyquist prompt and it seems to work partially. If I do Analyze->Find Clipping, there are two "clusters" identified. When I try the Nyquist code above, it fixes only one cluster. Are there any parameters I could vary ? My input is WAV file (single, 48k). I then varied "frequency" to 48k, instead of 16k and that doesn't seem to work.
I tried the Nyquist prompt and it seems to work partially. If I do Analyze->Find Clipping, there are two "clusters" identified. When I try the Nyquist code above, it fixes only one cluster. Are there any parameters I could vary ? My input is WAV file (single, 48k). I then varied "frequency" to 48k, instead of 16k and that doesn't seem to work.
-
Gale Andrews
- Quality Assurance
- Posts: 41761
- Joined: Fri Jul 27, 2007 12:02 am
- Operating System: Windows 10
Re: Deleting Clipped Audio
That Nyquist code is Steve's. Did you try Normalizing to -1 dB after the Nyquist script? Does it still look flat-topped or does it sound distorted after Normalize?
If so, can you upload an example file that the script does not "fix" and give us the web address so we can download it?
Also if the clipped cluster only has runs where a few consecutive samples are clipped, you could try deleting or silencing using the Labeled Audio commands.
Gale
If so, can you upload an example file that the script does not "fix" and give us the web address so we can download it?
Also if the clipped cluster only has runs where a few consecutive samples are clipped, you could try deleting or silencing using the Labeled Audio commands.
Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual
Re: Deleting Clipped Audio
Gale
Here's a sample clip: https://www.dropbox.com/s/dngbvxu87xpqelb/clip_34.wav
Yes, I did try Normalizing. The thing is the second clipping never goes away, so normalizing didn't affect it. I now tries silencing and it seems to work for most part (but there's a crackle kind of sound). If you have any ideas to fix it, let me know please. Thanks!
Here's a sample clip: https://www.dropbox.com/s/dngbvxu87xpqelb/clip_34.wav
Yes, I did try Normalizing. The thing is the second clipping never goes away, so normalizing didn't affect it. I now tries silencing and it seems to work for most part (but there's a crackle kind of sound). If you have any ideas to fix it, let me know please. Thanks!
-
Gale Andrews
- Quality Assurance
- Posts: 41761
- Joined: Fri Jul 27, 2007 12:02 am
- Operating System: Windows 10
Re: Deleting Clipped Audio
You can try CTRL + R to run the script further times, and/or try selecting the second burst only.
For such a bad instance as that you might almost as well use Pop Mute: http://wiki.audacityteam.org/wiki/Nyqui ... s#Pop_Mute .
To install Nyquist plug-ins see http://wiki.audacityteam.org/wiki/Downl ... ns#install .
Gale
For such a bad instance as that you might almost as well use Pop Mute: http://wiki.audacityteam.org/wiki/Nyqui ... s#Pop_Mute .
To install Nyquist plug-ins see http://wiki.audacityteam.org/wiki/Downl ... ns#install .
Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual
Re: Deleting Clipped Audio
Thanks Gale! Pop Mute does sound applicable here and I am playing with it. One more thing. I want to use this in a more programmatic way as a command line binary. Is it possible to use this plugin and Audacity as a command line driven program so I can script it ?
-
Gale Andrews
- Quality Assurance
- Posts: 41761
- Joined: Fri Jul 27, 2007 12:02 am
- Operating System: Windows 10
Re: Deleting Clipped Audio
Can you explain what you are trying to do - have you got a large number of files as bad as that one that need fixing? It would be better to fix the recorder if you still have more recordings to make.momop540 wrote:Pop Mute does sound applicable here and I am playing with it. One more thing. I want to use this in a more programmatic way as a command line binary. Is it possible to use this plugin and Audacity as a command line driven program so I can script it ?
You can add PopMute to a Chain in Audacity then apply the Chain to audio files. The Chain would then run attended on the files you selected, but it doesn't support more than a few thousand files. See: http://manual.audacityteam.org/o/man/ch ... ation.html .
However you can't run the Chain from the command-line, you have to open the Audacity application. Do you need to do this from the command-line? If you can compile Audacity you can run a Chain from the command-line by writing a script http://manual.audacityteam.org/o/man/scripting.html .
Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual