Accessing Metadata with Nyquist?

I’m new to Audacity and Nyquist, but I’m working on something that requires additional information to be added to audio files that are chopped up and I thought that the metadata would be a good place. I would like to have this done automatically, is there a way to access the metadata with Nyquist?

Nyquist does not have any built-in support for metadata as far as I’m aware.

If you tell us more about what you are doing, we ‘may’ be able to suggest an alternative approach.

I have to clip some long duration time tagged audio files but still carry that information over into the new files I generate. So for instance if I have a file that starts at 2:15 and goes to 5:15, and I clip a 15 minute segment of it at 3:45 to 4:00, that the clip starts at 3:45.

I’m not sure what you mean. Are you talking about metadata in files that you are importing, or are you referring to labelled audio clips in Audacity tracks?

I am trying to do something like this:

When I export the ‘clipped’ file to a new file, I’d like to have a timestamp in there that lets me know the original segment started at 7 seconds, so when I load it into another program it does not start playing the file until at T=7.

Sorry if this is something already possible in Audacity, I’m still new at it and learning. I tried searching on the manual and everywhere regarding timestamps and I can’t find anything.

If you don’t want the first 7 seconds to play, why not just delete the first 7 seconds? :confused:
I don’t see what you are hoping to achieve with metadata.

You are right, I don’t want the first 7 seconds to play, but I also don’t want it to start playing immediately when I load the file, it needs to know not to play the clip I created until the 7th second.

This is just an example with short duration, the files I have are hours long but only a few segments in the file are necessary for what I’m doing. If I have a 4 hour file, and I take a 1 minute clip that starts at hour 2, I need to preserve that time information somehow in that clip so it knows the clip starts playing at hour 2.

Perhaps you could cut to the chase and tell us what you are actually trying to do.

I’ve explained what I need to do already.

I have a hours long audio file that I need to clip snips out of. But I’m looking for a way to preserve the time information in the clips so I know what times the clips are from. That way if I ever need to go back to the original file I can quickly find it.

But you haven’t explained “why”.
From the information given so far, the answer would appear to be to just select the part that you want to play, then “File menu > Export > Export Selected Audio”, and create a new file that contains only the part that you want to play. I’m guessing that is not what you want, though I have no idea why not.

Its so if the clip I made was not adequate (too long, too short, needs to be adjusted etc), I can go back make a new clip quickly. Having the time information along with the original audio file would let me quickly find the place where the clip came from.

Perhaps you could include the time in the name of the file:
(take care to ensure that the file names are legal:

Yes that’s what I’m currently doing, I have to rename the file by hand. Is automating the file name something that can be done with a script?

It would be possible to create a plug-in that labels the current selection and adds the start and/or end time of the selection to the label text.
You could then use “Export Multiple” to export the labelled audio, using the label text as the file name.

That sounds a good alternative way of doing it with the metadata, I’ll start investigating. Thanks!

A few tips that may be helpful:

To create a label with Nyquist, return a list of lists in the form (list (list ) …)
where and are the start / end times in seconds, relative to the selection, and is the label text.

Example, to create one label that starts at the beginning of the selection and ends one second later, with the text label “hello world”:

(list (list 0 1 "hello world"))

To get the absolute time of the start of the selection:

(get '*selection* 'start)

To get the absolute time of the end of the selection:

(get '*selection* 'end)