I got a file opened, labels created, label track all selected.
I would like to make a script that will select labels and aply effect (FadeOut), one after the other, till the end of file.
Its a for a narrated audio book, I need to clean breath and others disturbing noises that are not so badly detected by Labels “in between sound” process but create undreds of Labels. I cant process them all manualy… I’d be dead before I finish !
A simple script that select first label, apply fade out, then select the next one…and so on till the end !
For the moment, I try this, but doesn’t work at all :
And it works too !
Good bye hugly breathes !
So nice, Thanx !
I’m gonna see what happen if I replace all the words “FadeOut” with another function, like “Silence” for example…
…what if I insert it into a Macro… Etc…
Anyway, I think it would be interesting to have different function batch on labels for a lot of people…
I’ll give feed back.
You could provide a menu with options to select which effect will be used. Something like (I’m just typing, so these commands might not be exactly correct):
Mmm… sounds good… But may prompt, and then interrupt batching… Isn’t it ?
Well. For the moment I’m trying to insert that code in a macro… And it works, yeah !
But it scans the whole file four times (doing FadeOut on each). I think it takes more time than doing four FadeOut on each selection at the first pass.
So I try to optimize code… But doesn’t works !
“EOF” means “End of form”, which means that it’s got to the end of the script before expected, which indicates that you’ve most likely missed a closing “)” or missed a quote. In this case you’re short of two closing parentheses.
If you’ve not got one already, get yourself a text editor that has “parentheses matching” (such as “NotePad++”).
Note also that Audacity is quite slow running AUD-DO commands (especially on Linux for some reason). The actual processing time should be the same as when applying an effect manually, but Audacity takes some time between getting the AUD-DO command from Nyquist and starting the command that has been passed.
When running a plug-in that has controls, in a macro, you need to enter settings for the controls when you create the macro. The plug-in is not displayed when run from a macro.
It runs just a very little quicker, but anyway, looks more professional !
Now to be perfect, this script should apply “FadeOut”, four times, on the first 99% of the selection, then “FadeIn”, one time on the last 1%.
And we’re done.
The reason that you need to use “length” in the line:
(dotimes (i (length labels))
is because “labels” is a list of labels. You want the loop to run once for each label.
(length labels) returns the length of the list, which is the “number of labels in the list”.
On the other hand, “(length 4)” doesn’t really make much sense as “4” is an integer. In Nyquist, integers don’t have a “length” property, so it returns an error:
Very interresting, thank you Steve. I pay my respect to your knowledge.
…And…
You’re right !
That makes no sense to select a percentage, as no label has the same lenght.
It would be better to select a fixed duration like 50ms for example.
Then I got a problem about the order of processing… Who from the chicken and the egg, has appeared first ?
I mean, if I do “FadeOut” first on the whole selection, it will erase the end. No material to Fade In.
If I do “FadeIn” first, it’ll be erased by “FadeOut” in second. Same result.
Now if I can select from the start of the current label to the end less 50 ms, FadeOut.
And then select from the end of the current label less 50 ms to the end, Fade In.
I’d be back in buisness !
What else ?
“I willl see wich chalenge I’m gonna generate for you… hin hin hin…”
For the moment, I’m gonna insert that in my special big “Narrator Editing Suite Macro” and share it with the world.
Maybe some kind of desperate editor, as I was yesterday, will come around and be happy to find The Answer… Mou-ha-ha-ha !
To that end, I’ll close this topic so that “The Answer” doesn’t get buried under other posts.
Feel free to open a new topic when you have more questions.