Truncate Silence nyquist source code available?

I’ve written a collection of macros that call mildly modified Nyquist plugins. All the original Nyquist plugins that I’ve modified are written by Steve Daulton. The output from the plugins is a weighted SNR value for a single sound file or a set of text files containing weighted SNR values for a set of sound files.

In order to batch calculate weighted SNR values for set of sound files in a file folder without need for any manual handling steps, the macros need to first remove any initial fade in and final fade out portions, so I’ve modified TrimSilence.ny to do that.

The macros then need to remove any portions with absolute silence inserted anywhere other that at the beginning or end of the sound files, so the macros call Truncate Silence.

Should there be any fade in, fade out or other forms of transitory effects preceding or proceeding the inserted absolute silence, these will remain after Truncate Silence, confusing the proceeding weighted SNR calculation.

Had the Truncate Silence Nyquist source code been available, the solution would have been for me to modify it, such that it removes not only the portions with inserted absoluted silence, but brief sections preceding and proceeding these.

Unfortunately, I haven’t been able to find the Truncate Silence nyquist source code. Is it available somewhere?

A presentation of the intended application for the macros and an associated Plugins can be found at Article :: xeno-canto. Two of the macros and one of the associated Plugins can be downloaded from the same site.

I use Windows 10.

Audacity’s “Truncate Silence” effect is written in C++ (not Nyquist).

There’s a related plug-in that is written in Nyquist, called Trim Silence.

Also worth looking at the “Label Sounds” code: https://github.com/audacity/audacity/blob/master/plug-ins/label-sounds.ny

See: https://github.com/audacity/audacity/blob/master/src/effects/TruncSilence.cpp

label-sounds.ny looks very interesting, that may be a good shortcut forward. As a newbie lisper, it feels like a daunting task, but I might get there.

I might possibly be capable of alternatively modifying Trim Silence into something useful.

The only “code” I as a user can add to Audacity is macros and Nyquist, I think, so the C++ code isn’t quite as useful, but I might be able to pick up some ideas from there.