Fastest way to compile some short segments into a new track?

Help for Audacity on Windows.
Forum rules
ImageThis forum is for Audacity on Windows.
Please state which version of Windows you are using,
and the exact three-section version number of Audacity from "Help menu > About Audacity".


Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
pshute
Posts: 181
Joined: Sat Feb 18, 2012 9:39 am
Operating System: Please select

Re: Fastest way to compile some short segments into a new tr

Post by pshute » Fri Nov 30, 2012 12:49 am

steve wrote:I think you've got the idea - do you need me to work through some settings with you or have you got it?
Compromise - here's some screen shots....
Thanks for those. I think I've got all the parameters worked out.

How come the first of your segments didn't get faded in? Something to do with being too close to he start of the track?

pshute
Posts: 181
Joined: Sat Feb 18, 2012 9:39 am
Operating System: Please select

Re: Fastest way to compile some short segments into a new tr

Post by pshute » Fri Nov 30, 2012 1:09 am

steve wrote:
pshute wrote:I'm a bit surprised there isn't a plugin to just do the whole operation. Surely cutting and fading segments isn't that uncommon?
Feel free to start a new topic about that.
I'm not sure exactly what you mean by "the whole operation" in a way that "isn't uncommon" but if there's a good case for a plug-in and Nyquist is capable of doing it then we can have a go at doing that ;)
By "the whole operation" I mean that I could create the label regions, then a plugin could copy the labelled audio segments, fade them all in and out, then trim the gaps down to a specified size. I would have thought that was a reasonable common operation, but perhaps not. If someone is only pulling out a few segments then they probably wouldn't mind doing it by hand, which is easy but tedious. It would only be useful to someone pulling out lots of them regularly, and then only if they want the segments in the one track.
This forum board would probably be the best place: http://forum.audacityteam.org/viewforum.php?f=42
I don't think I'll pursue it. I've got a reasonably easy method now. I might have a go at writing a plugin for it myself if it starts to annoy me too much. Thanks for your help.

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

Re: Fastest way to compile some short segments into a new tr

Post by steve » Fri Nov 30, 2012 1:44 am

pshute wrote: I could create the label regions, then a plugin could copy the labelled audio segments, fade them all in and out, then trim the gaps down to a specified size.
Unfortunately plug-ins are not able to access label tracks.
Nyquist plug-ins can create labels, but can't read them. The ability to read labels is a feature that I'd love to see in Nyquist plug-ins, but we don't have that yet.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

pshute
Posts: 181
Joined: Sat Feb 18, 2012 9:39 am
Operating System: Please select

Re: Fastest way to compile some short segments into a new tr

Post by pshute » Fri Nov 30, 2012 2:11 am

steve wrote:Unfortunately plug-ins are not able to access label tracks.
Nyquist plug-ins can create labels, but can't read them. The ability to read labels is a feature that I'd love to see in Nyquist plug-ins, but we don't have that yet.
Is that ability a planned enhancement, or just an idea at the moment?

I guess then the plugin would require me to do the Labelled Regions Cut/Paste myself, then operate on the resulting track. I could probably base it on the Silence Marker or Sound Finder plugins, doing the fades and trims instead of inserting labels.

I've just noticed the Chain-it-up plugin, posted by Robert J. H. I wonder if my original approach of selecting the segments and duplicating them to new tracks could be used with that. It's supposed to trim the silence and do the fade in/out before combining them into one track.

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

Re: Fastest way to compile some short segments into a new tr

Post by steve » Fri Nov 30, 2012 2:30 am

pshute wrote:Is that ability a planned enhancement, or just an idea at the moment?
Currently there are no developers working on the Nyquist plug-in interface,
I don't suppose you are a highly skilled C++ programmer by any chance?
pshute wrote:I guess then the plugin would require me to do the Labelled Regions Cut/Paste myself
Label tracks can be exported as text files.
Text can be input into a Nyquist plug-in, either be pasting into a text box (the easier method) or by the plug-in reading a text file (trickier).
pshute wrote:I could probably base it on the Silence Marker or Sound Finder plugins,
The code in these plug-ins is somewhat convoluted. I've got some cleaner "detect sounds" code if you are interested in pursuing this as a plug-in. In fact (rummaging around...) this code isn't too bad: http://forum.audacityteam.org/viewtopic ... 80#p197980

Nyquist does not have access to the Audacity clipboard, but it is possible to copy audio from one track to another by temporarily holding the data in the *SCRATCH* symbol. There's an example of this here: http://forum.audacityteam.org/viewtopic ... 03#p197403
It would be relatively easy to adapt this code to copy a selection from one track, apply a fade-in fade-out to the copied data and paste it into the next selected track.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

pshute
Posts: 181
Joined: Sat Feb 18, 2012 9:39 am
Operating System: Please select

Re: Fastest way to compile some short segments into a new tr

Post by pshute » Fri Nov 30, 2012 2:46 am

steve wrote:I don't suppose you are a highly skilled C++ programmer by any chance?
Nope!
The code in these plug-ins is somewhat convoluted. I've got some cleaner "detect sounds" code if you are interested in pursuing this as a plug-in. In fact (rummaging around...) this code isn't too bad: http://forum.audacityteam.org/viewtopic ... 80#p197980

Nyquist does not have access to the Audacity clipboard, but it is possible to copy audio from one track to another by temporarily holding the data in the *SCRATCH* symbol. There's an example of this here: http://forum.audacityteam.org/viewtopic ... 03#p197403
It would be relatively easy to adapt this code to copy a selection from one track, apply a fade-in fade-out to the copied data and paste it into the next selected track.
Thanks for those.

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

Re: Fastest way to compile some short segments into a new tr

Post by steve » Fri Nov 30, 2012 2:58 am

A code snippet to fade in/out the current selection

Code: Select all

(setq fade-in-time 0.1) ; seconds
(setq fade-out-time 0.2)

(let* ((t1 (/ fade-in-time (get-duration 1)))
       (t2 (- (get-duration 1) fade-out-time))
       (t2 (/ t2 (get-duration 1)))
       (end 1))
  (mult s (pwlv 0 t1 1 t2 1 end 0)))
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

pshute
Posts: 181
Joined: Sat Feb 18, 2012 9:39 am
Operating System: Please select

Re: Fastest way to compile some short segments into a new tr

Post by pshute » Fri Nov 30, 2012 10:59 pm

I just discovered one thing to be careful of with this method of using Labelled Regions/Copy and Paste to extract the segments. If there are any point labels in the label track, it goes a bit silly.

When it pastes, the segment corresponding to the region to the right of the point label gets pasted in at the point label instead. All the following segments get pasted in the same amount too far to the left. I've only tried it with one point label among the region labels, but I assume they get shuffled along even further for every extra point label there is.

In this example, I've copied it and pasted with three region labels, giving a correct result. Then I added point label z and copy/pasted into the bottom track. The segment b has lined up with point label z, and segment c is also too far left.

The answer in my case is to get rid of the point labels, but is this a bug? Shouldn't point labels be ignored in this operation?
Attachments
Clipboard02.jpg
Clipboard02.jpg (15.26 KiB) Viewed 1534 times

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

Re: Fastest way to compile some short segments into a new tr

Post by steve » Sat Dec 01, 2012 4:02 pm

pshute wrote: is this a bug? Shouldn't point labels be ignored in this operation?
Yes, it's a bug.
The problem is that for some of the actions such as "Labelled Regions > Split" we probably do want to include point labels.
I'll raise this with the developers and see how they want to handle it.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Post Reply