I wonder I’ll be capable to create some macro or script that can insert a label in an existing label track, at its beginning, stamped with its track name.
I’ve tried https://forum.audacityteam.org/t/customizing-label-export/48274/7 in a nyquist prompt, seems to work in audio track only, creating a new label track with the track name at selection.
when trying this in label tracks, it create, both a label in the track stamped “audio track” and a new label track named “Audio track”.
So, how to tweak this in order to make it works my way ?
(then turning this in step of a macro script ?)
I expect it is possible. You would need to create a “Nyquist Macro” (Nyquist-Macros - Audacity Manual) in order to add a label to the current label track. You would then “install” the Nyquist macro, so that you can then include it in a normal macro (if required).
Have you used Nyquist at all yet?
I’ll move this topic to the “scripting” forum board (Macros and Scripting - Audacity Forum) after your next reply.
Not really yet, I do have made some macros in audacity but no Nyquist’s styled.
I will have to. my work is so “reproductible” I can surely earn some bargain at.
Will tinker that.
Just checking that I’ve got this right - you want the name of the label track in a label at the start of that label track?
Will there always be exactly one audio track and one label track, with the label track below the audio track?
If that’s what you want, then this plug-in will do it:
labeltrackname.ny (369 Bytes)
When installed (see: https://manual.audacityteam.org/man/installing_effect_generator_and_analyzer_plug_ins_on_windows.html#nyquist_install) it will appear in the “Tools” menu (requires Audacity 2.3.2).
This is the code in that file:
;name "Label Track Name"
;author "Steve Daulton"
;copyright "Released under terms of the GNU General Public License version 2"
(let ((info (aud-get-info "Tracks")))
(second (first (second info)))))
(aud-do (format nil "SetLabel: Text=~s" tname))
Owh yes, that’s awesome !
my damnation is that I understand your code, but my mental scheme is unable to produce things like that. Will use it as my fundation first stone.
Thank you so much Steve !
Nyquist macros are a bit tricky, because you need some familiarity with the Nyquist programming language, and some familiarity with Audacity’s Macro commands. The code itself is pretty simple, though there is a bit of “magic” going on in getting the track name.
This code does not use the “best” way to get the track name, but just a quick and dirty way.
Because we are assuming that the label track is the second track, we look for the second track listing in the “Tracks” info, and the first item in that contains a pair of elements, (NAME “the-track-name”).
If you’d like a more detailed explanation of how this plug-in works, just ask.
I was giving this tool a try of batching some projects in order to prepare them to print.
So this code is working when the second track is a label one. Isn’t when the selected one is a label one. in this case it create an empty label.
So I was think about the label exporter you’ve made. it’s capable to retrieve label track names. so can a code inject the selected label track his name ?
was tinkering in my macros and guessing how to add a label at the beginning of each label track created by each macro step.
One way should be passing parameter to dedicated macro
Another one should be using the trackname (audio) selected on witch macro apply.
First case is simple I’ll try. even creating duplicated macros with different name for my purpose
Second case is little more touchy for me.
If you want to create a plug-in to be versatile enough to handle cases other than the specific case that you described initially, then you need to decide what the plug-in should do in ALL cases. For example, what if more than one track is selected? What if there are multiple label tracks?
Probably the most important question to ask when designing a program is “what, precisely, do I want this program to do?”
Nyquist can obtain information about tracks from the “GetInfo” command (see: “Extra menu > Scriptables II > Get Info”. If the “Extra” menu is not visible, enable it in the “View” menu.
I was wandering my mind about it.
Searching for the best resume I can provide.
Even looking at .ny file in order to modify some parameters in it.
In order to get the functionnality I need at a highest level. in a process manor.
So here is my conclusion : Every .ny plug-ins that generate a new label track as a result should provide the first label at track start being the name of the audio track it applies to. added with several more significant parameters of the used function.
This is the way I’m going to try.
I see tons of interesting Steve Daulton’s I gonna work with