Accessing Metadata with Nyquist?

Using Nyquist scripts in Audacity.
Post and download new plug-ins.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
Ktarnj
Posts: 8
Joined: Tue Sep 15, 2020 12:06 pm
Operating System: Windows 10

Re: Accessing Metadata with Nyquist?

Post by Ktarnj » Tue Sep 15, 2020 2:35 pm

steve wrote:
Tue Sep 15, 2020 2:25 pm
Ktarnj wrote:
Tue Sep 15, 2020 2:18 pm
I've explained what I need to do already.
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.

steve
Site Admin
Posts: 81291
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Accessing Metadata with Nyquist?

Post by steve » Tue Sep 15, 2020 3:05 pm

Perhaps you could include the time in the name of the file:
"somethingorother_3-22_to_15-59.wav"
(take care to ensure that the file names are legal: https://docs.microsoft.com/en-us/window ... ing-a-file)
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Ktarnj
Posts: 8
Joined: Tue Sep 15, 2020 12:06 pm
Operating System: Windows 10

Re: Accessing Metadata with Nyquist?

Post by Ktarnj » Tue Sep 15, 2020 3:09 pm

steve wrote:
Tue Sep 15, 2020 3:05 pm
Perhaps you could include the time in the name of the file:
"somethingorother_3-22_to_15-59.wav"
(take care to ensure that the file names are legal: https://docs.microsoft.com/en-us/window ... ing-a-file)
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?

steve
Site Admin
Posts: 81291
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Accessing Metadata with Nyquist?

Post by steve » Tue Sep 15, 2020 4:49 pm

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.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Ktarnj
Posts: 8
Joined: Tue Sep 15, 2020 12:06 pm
Operating System: Windows 10

Re: Accessing Metadata with Nyquist?

Post by Ktarnj » Tue Sep 15, 2020 6:51 pm

steve wrote:
Tue Sep 15, 2020 4:49 pm
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!

steve
Site Admin
Posts: 81291
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Accessing Metadata with Nyquist?

Post by steve » Tue Sep 15, 2020 6:57 pm

A few tips that may be helpful:

To create a label with Nyquist, return a list of lists in the form (list (list <start> <end> <text>) ...)
where <start> and <end> are the start / end times in seconds, relative to the selection, and <text> 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":

Code: Select all

(list (list 0 1 "hello world"))
To get the absolute time of the start of the selection:

Code: Select all

(get '*selection* 'start)
To get the absolute time of the end of the selection:

Code: Select all

(get '*selection* 'end)
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Post Reply