Processing long tracks with DeClicker.ny

Are you using the latest version of DeClicker? (this one: https://forum.audacityteam.org/t/updated-de-clicker-and-new-de-esser-for-speech/34283/1)
What settings are you using?

It works for me with a:

  • 1 hour mono track
  • sample rate of 44100
  • default settings in DeClicker

What do I need to do to make it fail?

The post that you linked is from 2014, is there a link deeper into the thread to a later version?

  • I’m processing a track that is 49 minutes
  • 44.1k
  • one of two tracks in a wav file that I have imported into Audacity (originally recorded using Voicemeeter)
  • It has previously had filters Noise Reduction, Change pitch, de-esser run on it
  • De-clicker default settings running
  • It starts off with a remaining time of about 5 minutes
  • The remaining time ticks down more slowly than the elapsed time ticks up
  • When it says about elapsed 3.05 and remaining 3.45, the dialog with the fill bar disappears, there is no error message, and the track has not been edited and the De-Clicker is not visible in the Undo option, the previous action is.

The most recent version is in the first post of that thread. Yes it’s old.

1 Like

OK, I can reproduce the problem with a 1 hour stereo track.
Debugging the issue shows the cause of the problem:

The maximum number of sample blocks has been
reached, so audio computation must be terminated.
Probably, your program should not be retaining
so many samples in memory.

I think it’s highly unlikely that the plug-in developer will fix the issue, and the code is absolutely horrible so I have no intention of fixing it for him. As a workaround, you could try this macro:
DeClick_5_audio_clips.txt (1.62 KB)
To use the macro, first split the track into 5 clips (add 4 “split lines” at roughly equal intervals: https://manual.audacityteam.org/man/edit_menu_clip_boundaries.html)
Then run the macro.
Then wait … and wait … and wait … and wait … and wait …

(I’m assuming that it will work, but I’m still waiting for it to complete)

I’ll give that a go, many thanks!

My original idea was to process it in n regions by programatically selecting the first 1/n of the track, then the second and so on, and processing each separately. Is there any way to select like that in a macro?

Running it now and it’s gone through three chunks, but it’s still the first chunk that appears selected, is that just a visual effect?

There’s no easy way of doing that. It is “possible”, but you would need to write two Nyquist scripts (see https://manual.audacityteam.org/man/nyquist.html), one to analyse the track and work out the times of the selections, and another to make the selections, then incorporate those two scripts into the macro.

It could be. Audacity prioritises the audio processing over updating the waveform. The waveform should be fully updated once the macro has completed.
My test is now on the final clip so I’ll be able to say if it has worked here in a couple of minutes.

It took a long time, but it got there in the end and completed successfully.

I imported and tested the macro you uploaded, it is definately doing the operation 5 times on the first clip, and not on any of the others. I tested it by changing the code to this:

CursTrackStart:
SelNextClip:
De-clicker:control-action-choice="Apply changes" control-crackle-threshold="-45" control-crossfade-interval="5" control-frequency-bound1="150" control-frequency-bound2="9600" control-max-steps="2" control-n-bands="12" control-passes="2" control-relative-threshold="6" control-separation="3" control-step-dur-ms="5"
SelNextClip:
Amplify:Ratio="0.31622777"
SelNextClip:
De-clicker:control-action-choice="Apply changes" control-crackle-threshold="-45" control-crossfade-interval="5" control-frequency-bound1="150" control-frequency-bound2="9600" control-max-steps="2" control-n-bands="12" control-passes="2" control-relative-threshold="6" control-separation="3" control-step-dur-ms="5"
SelNextClip:
Amplify:Ratio="0.31622777"
SelNextClip:
De-clicker:control-action-choice="Apply changes" control-crackle-threshold="-45" control-crossfade-interval="5" control-frequency-bound1="150" control-frequency-bound2="9600" control-max-steps="2" control-n-bands="12" control-passes="2" control-relative-threshold="6" control-separation="3" control-step-dur-ms="5"

And this is the result that I got:

All help gratefully welcomed!

You will need to update Audacity. I’ve just tested with Audacity 3.2.0 and I can reproduce the problem.
I’ve also tested with Audacity 3.2.2 and it works correctly.

Here’s a fast version of the macro script for testing. It applies a “fade out” to each of the 5 audio clips:
quick-test.txt (281 Bytes)

Thanks for all your dedication. I’m on version 3.2.3 and the quick test is happening to the same first clip 5 times, giving an error each time that says, “Fade Out: Could not load settings below. Default settings will be used”.

I’m on Windows 11 if that is relevant.

This is weird. I thought that it was just a problem in an old version, but on further testing I’m getting inconsistent results regardless of the version. Sometimes it works and sometimes it doesn’t, but I don’t see any pattern as to why it works sometimes but not others.

After testing with multiple versions, the only version I have that it’s working reliably and consistently with is Audacity 2.4.2 (the version that I use for production work).

I’ll need to do more testing tomorrow, but it’s looking like a “race condition” bug in multiple versions of Audacity.

I’ve logged it as a bug: https://github.com/audacity/audacity/issues/4146

I’m not sure what more I can suggest. Audacity is failing to process the macro correctly, which is a regression against much older versions. It bothers me greatly that Audacity has become unreliable when processing macros.

Thanks for all your work on this Steve…

If you or anyone else can suggest a way to select a dynamic way to select a portion of the track (say the total length/n) rather than a fixed value, I would be happy to work with that.

If your “filter” was a built-in effect or any type of plug-in other than a Nyquist plug-in, then this would be simple to do in Nyquist with something like this:
(You can try running this code in the Nyquist Prompt - see: https://manual.audacityteam.org/man/nyquist_prompt.html)

;type tool
;control num "Number of sections" int "" 5 2 20

(defun start-end ()
   (let ((tracks (aud-get-info "tracks"))
         start end)
      (dolist (trk tracks)
         (when (= (second (assoc 'focused trk)) 1)
            (return-from start-end
               (list (second (assoc 'start trk))
                     (second (assoc 'end trk))))))))

(defun fade (t0 t1)
   (aud-do-command "select" :start t0 :end t1)
   (aud-do "FadeIn"))

(let ((ends (start-end)))
   (setf start (float (first ends)))
   (setf end (float (second ends)))
   (setf step (/ (- end start) num))
   ;first section
   (fade start (+ start step))
   (setf start (+ start step))
   ;middle sections
   (dotimes (i (- num 2))
      (fade start (+ start step))
      (setf start (+ start step)))
   ; final section
   (fade start end)
   "")

Unfortunately this can’t work with DeClicker.ny because a Nyquist script cannot call a Nyquist plug-in, but if this works reliably for you, then it can be adapted as I suggested in this post: https://forum.audacityteam.org/t/processing-long-tracks-with-declicker-ny/66393/10 and I can help you to do that.

Many thanks again Steve, I’ll have a go at this.

Hi Steve, thanks for all your input so far.

I’m not sure what you are asking works reliably. The code that you pasted certainly works fine, it fades out chunks of the file, works perfectly, chunk by chunk. The De-Clicker also works fine as long as I don’t give it too big a chunk of audio to work with, in which case it falls over.

If you could point me in the way to go to to get De-Clicker to work in the macro instead of the fade, that would be awesome.

FYI I note that in the ‘regular’ part of the Audacity menu, there is also a click removal option, and I remember that I went searching for the extra plugin a few years back, but I don’t remember why, perhaps because the clicker wasn’t in Audacity at that time, perhaps because it didn’t perform as well.

The one I use does work very well, but maybe a year ago an Audacity update or something else made it fail on longer tracks, and I had to remove it from the macro that I use to clean up audio.

OK, this is what I’ve got:

1. A plug-in called “Loop Processing”.
Loop_Processing.ny (2.43 KB)
This plug-in needs to be installed. It will appear in the “Tools” menu. (Note that recent versions of Audacity require Audacity to be restarted after plug-ins have been added).

loopprocess.png
This plug-in has two “modes” (effectively it is two plug-ins in one).

  • Analyze: This mode measures the length of the focused track and calculates the length of each section.
  • Select: This mode selects a region of the track.

The only other control sets the number of sections.
Note that this control is only used when analyzing.


2. A macro script

The plug-in must be run in “Analyze” mode first.
Then, before the required effect can be applied, the plug-in is run in “Select” mode.

The whole macro would look something like this - note that in this example the effect is being applied to 4 sections (quarters of the track length).

LoopProcessing:mode="Analyze" num="4"
LoopProcessing:mode="Select" num="4"
The_Effect
LoopProcessing:mode="Select" num="4"
The_Effect
LoopProcessing:mode="Select" num="4"
The_Effect
LoopProcessing:mode="Select" num="4"
The_Effect

and here’s an example macro that applies the “Adjustable Fade” effect to quarters of the focused track.
loop process.txt (534 Bytes)

Hi Steve, I just wanted to come back to you (after I took an age to dig out my password to be able to comment) to say thanks so much for this, it works perfectly, it’s exactly what I needed!