Sure.
Headers (Missing features - Audacity Support)
;version 3
The current plug-in version is version 4.
Note that version 4 plug-ins use TRACK for the audio passed from the track rather than S.
;categories
Categories are no longer used.
;name “Extend Silences, then Repeat…”
I’d suggest using a shorter name. This is the name that will appear in Audacity’s Effect menu.
Though some existing Nyquist plug-ins have quite long names, commercial plug-ins tend to have quite short names. When chatting on-line about a plug-in, it quickly becomes tedious to type out a long name. If the plug-in becomes very popular, people will become familiar with the name, whatever it is called, but for new and lesser known plug-ins, a “somewhat descriptive” name can be helpful, but it is “just a name”, not a description. Probably not the best idea to go a brief as iZotope do (with names like “Rx7”), so calling it “ESTeR” may be a bit too abbreviated, but it’s just a name, so up to you what you call it
;action
Again this is rather verbose. This is what shows in the progress bar window. All that the user needs to know, is that the plug-in is doing something.
;action “Processing…” would be adequate.
;action “ESTeR is busy…” is more fun.
;action “Extending and repeating…” hints at the name of the plug-in.
Again it’s your choice, but “Finding silences then inserting more, and repeat the segments” is rather long.
;info
This header is no longer used.
Validating user input:
This is often unnecessary in modern plug-ins. Slider widgets have a fixed range of values, and Audacity will complain if an out of range value is entered.
See: Missing features - Audacity Support
and: Missing features - Audacity Support
Style and readability:
(do ((n 0 (1+ n))
(snd-pc-total 0) ; running total of added '% of sound' added.
(sil-pc-total 0) ; running total of added '% of silence' added.
(output (s-rest 0)) ; initialise output.
(seg-list-reversed '())) ; initialise segment list
((= n (1- (length sil-list)))
(let ((seg-list (reverse seg-list-reversed)))
(seqrep (i (length seg-list)) (cue (extract-abs (first (nth i seg-list)) (second (nth i seg-list)) output)))))
Eughee, that’s horrible
I do tend to over-comment a lot of my plug-ins for the benefit of people learning Nyquist, but doing so is not really recommended. I think the first couple of comments are reasonable, but “initialise output”, and “initialise segment list” are pretty self evident once you know that a “DO” loop has local bindings.
But then we come to the horrible bit - the return value:
(let ((seg-list (reverse seg-list-reversed))) (seqrep (i (length seg-list)) (cue (extract-abs (first (nth i seg-list)) (second (nth i seg-list)) output)))))
Isn’t this more readable:
(do ((n 0 (1+ n))
(snd-pc-total 0) ; total "sound %"
(sil-pc-total 0) ; total "silence %"
(output (s-rest 0))
(seg-list '())
(count (1- (length sil-list))))
((= n count) (build-output outpt seg-list))
and then define the “build-output” function somewhere nearby.
Defining short functions that do one thing each, aids readability and makes debugging much easier.
Same thing here:
(dotimes (i repeat-N) (push (list segment-start (+ segment-start section-dur pause snd-sil-len snd-sel-len)) seg-list-reversed))
or:
(dotimes (i repeat-N)
(setf end-time (+ segment-start
section-dur pause
snd-sil-len
snd-sel-len))
(setf seg-pair (list segment-start end-time) )
(push seg-pair seg-list))