Labels from Text File

Using Nyquist scripts in Audacity.
Post and download new plug-ins.

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

Labels from Text File

Permanent link to this post Posted by busted-email » Mon Jun 14, 2010 8:30 pm

Hello all,

I apologize in advance for the long post. The requirements for the plug-in that I'm about to describe are fairly specific so I'm including as much detail as possible.

I work for a company that does quite a bit of voice over work for Flash-based training. The voice-over scripts are generally recorded straight through and then cut up later for use in Flash. Recently, we came up with the idea of using labels in Audacity to mark up the original audio file and then use the "Export Multiple" feature to automatically save out each section. This works very well but we have found that there are a few areas that could help us save more time.

Each audio file ends up with a special name or "slate" that specifies where it falls within the training. We can easily dump a list of these slates to a text file. We'd like to be able to turn these slates into "label" for each...er...label. ;)

Example: Let's say that we're dealing with 5 slates (though we usually deal with many more than that.) We would like to have a text file with each slate on it's own line (much like in the text files that Audacity generates when exporting labels.) When the user adds a label, our "dream plug-in" would then pull the slate from the text file based on the number of labels in the project. So in our example, if the selected label track had 3 labels and we added a fourth, the plug-in would look on the fourth line in the specified text file and copy the text from that line into the new label's name.

I know that it is currently possible to export a list of labels to a text file, even if none of them have names. We've even considered marking the labels, exporting them, creating/running a script to copy the names onto each appropriate line and then re-importing the labels. Needless to say, this is not the ideal workflow. Instead, we'd like to have each slate named automatically.

So ultimately, my question is this: Is this the sort of thing that is possible to implement using Nyquist?

If you've made it this far, thank you very much for your time!
busted-email
 
Posts: 5
Joined: Mon Jun 14, 2010 3:46 pm
Operating System: Please select

Re: Labels from Text File

Permanent link to this post Posted by steve » Mon Jun 14, 2010 10:13 pm

So you want to import a list of text into labels - one line of text into each label in sequence. If that's right, then it sounds very possible to implement in Nyquist.
One thing that could be a potential problem is that Audacity becomes extremely slow when there is a lot of label text, though that is not usually a problem until there are hundreds of words/labels.

So where do you want to go from here? Do you have any experience with Nyquist or Lisp or any other programming?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45642
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Labels from Text File

Permanent link to this post Posted by busted-email » Tue Jun 15, 2010 2:13 pm

Hey Steve,

So you want to import a list of text into labels - one line of text into each label in sequence.


Yep, that's exactly right. I do have some programming experience but not with Nyquist or Lisp. I'm currently reading everything I can find on the subject so I can implement this feature (assuming that it's possible with Audacity's API.) Using some other scripts that I've found, I've been able to come up with a (very) basic script that adds a label to the active label track. From looking at the Nyquist/Audacity documentation (http://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/manual/home.html and linked items at the top) it looks like I should be able to load data from a text file, so that shouldn't be a problem.

However, I'm not at all sure how to get a list of labels that currently exist. Ultimately, I'll need to be able to count the number of labels that exist (so I know which line in the text file to pull the label's name from) and then target a specific label object so I can add/modify it's name. I've done some searching but I haven't been able to find much aside from this (http://audacity.238276.n2.nabble.com/Label-tracks-Lists-td238486.html), which doesn't sound promising.

Does anyone know if there is a way to get a list of existing labels and modify them using Nyquist? If not, is there a better way to go about adding a feature like this (short of digging into the Audacity source?)

Thanks!
busted-email
 
Posts: 5
Joined: Mon Jun 14, 2010 3:46 pm
Operating System: Please select

Re: Labels from Text File

Permanent link to this post Posted by steve » Tue Jun 15, 2010 4:34 pm

busted-email wrote:I'm not at all sure how to get a list of labels that currently exist.

Now for the bad news - you can't do that in Audacity-Nyquist as the only data to be sent to Nyquist from Audacity is the audio data (Labels are not accessible to Nyquist).

Probably the closest that you could get would be to manually export the labels as a text file from Audacity, then with your Nyquist plug-in, read that text file.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45642
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Labels from Text File

Permanent link to this post Posted by steve » Tue Jun 15, 2010 4:36 pm

Ha! I've just read the second post in that link :D
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45642
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Labels from Text File

Permanent link to this post Posted by busted-email » Tue Jun 15, 2010 8:59 pm

Hey Steve,

Aw, that's what I thought :(. I've also been playing around with the idea of creating an AppleScript (this must eventually run on a Mac...yeah, I'm not happy about it either ;)) that will automate the process of exporting the labels, add the slate numbers to the exported text file and then re-import the labels. While this would work, it's definitely not as slick as having the label names pulled in as you add them. Honestly, part of the reason I would like to have them pulled in "on-demand" is for the sake of organization. That way it would be easier to see which chunks you've already added and where.

Do you know if Audacity supports any other methods of automation that might be able to do what we're looking for?

Thanks again for all of your help!
busted-email
 
Posts: 5
Joined: Mon Jun 14, 2010 3:46 pm
Operating System: Please select

Re: Labels from Text File

Permanent link to this post Posted by steve » Tue Jun 15, 2010 9:12 pm

busted-email wrote:Do you know if Audacity supports any other methods of automation that might be able to do what we're looking for?

Not without digging deep into the code.

Just a thought about your Nyquist idea - could the "slates" begin with a number? (slate id number = label number)
I think it would be possible for Nyquist to read through a text file and look for a number at the beginning of a line.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45642
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Labels from Text File

Permanent link to this post Posted by busted-email » Tue Jun 15, 2010 9:26 pm

Actually, the slates are just made up of a string of 5 digits. I'm not as concerned with getting the slate numbers from a text file into Audacity since the docs seems to say that reading from text-based files isn't terribly difficult. It looks like the main hang-up is going to be lack of access to existing labels.
busted-email
 
Posts: 5
Joined: Mon Jun 14, 2010 3:46 pm
Operating System: Please select

Re: Labels from Text File

Permanent link to this post Posted by Storer » Thu Jun 17, 2010 11:29 pm

Busted,
I think it's possible to make a plug-in to do what you want. I need to think about it a little more, and then I'll post an outline of how it would work. Then you can tell me whether that will do the trick without messing up your workflow too badly.

The only problem I see is getting at a good directory to contain the original text file. The only directory which Audacity-Nyquist knows about right now is the default sound directory which is a temporary file. I've worked around a problem like this before, by using a separate setup plug-in where you can specify the directory containing the text file your other program has created.

Dave
Storer
 
Posts: 91
Joined: Wed Mar 04, 2009 8:02 pm
Operating System: Please select


Return to Nyquist



Who is online

Users browsing this forum: No registered users and 1 guest