Appending to Existing Track Name

Hi,

Can we append to a track name using something like the Set Track Macro Command?

I wanted to duplicate a track and then do some processing on the duplicated track using a Macro When processing is done, I wanted to re-name the duplicate track with something like “-Processed” appended to the original Track Name (not the OS file name, but the track name within audacity). Is this possible?

Thanks,

Mike

Not with an ordinary macro because ordinary macros are just a list of commands. There’s no facility to assign variables.

You can do it with Nyquist.
For simplicity, if there’s just one track:

;type tool
(setf suffix "Audacity")
(setf prefix (second (first (first (aud-get-info "tracks")))))
(aud-do-command "SetTrackStatus:"
                :name (format nil "~a ~a" prefix suffix))

Thanks Steve,

So I did get the code to work. I guess I need to decide if I have the time and ambition to learn more about Nyquist.

I did try looking at some of the documentation, but wasn’t able to find the specific commands like “aud-do-command” and “aud-get-info”, but I see what they are doing. I’m not sure about something like (second (first (first (aud-get-info “tracks”))))), but it seems to be pulling data from an array that is filled when you execute the aud-get-info “tracks”. Is that correct?

Are the existing Nyquist commands and Nyquist manual the place to go to dig into this or is there something that is laid out more like a training manual for Nyquist?

Thanks again,

Mike

Very close.

(aud-get-info “tracks”) returns a list of lists. (“lists” are used a lot in Nyquist as Nyquist is a form of LISP)

You can see what data is returned by running this command:

(format nil "~a" (aud-get-info "tracks"))

(Parsing the returned data is a bit of a pain - when I get time I’ll probably write some more helper functions to make it easier)