Best way to move some labels to another label track

I’ve got three long label tracks full of labels and I’d like to merge them into one. I can copy and paste sections of them from track to track, but it will overwrite any already there.

I can export them and reimport them, but the label export function doesn’t include information about which track they’re in, and there are other tracks I don’t want merged.

All I can think of is to edit the aup file.

If I do that, will audacity mind if they aren’t in chronological order, or will I have to sort them?

Is there any other way?

What do you mean by overwrite? Have you dragged the label track down to see all the labels? See below for the one case where I do see a pasted label replacing another.

Are you pasting audio with the labels, or just the labels as I assume?

The problems I see with merging labels (without audio) between tracks is that:

  • There is no really easy way to move a single point label
  • If you select over a label or group of labels to cut or copy them, the length of the selection is taken into account, and so doesn’t paste the labels where you click.


From a quick test, Audacity doesn’t mind when you open a project if the first listed label in the AUP file is at a later timeline position than the next listed one.

If you want to merge a group of labels by moving them from one label track into another label track, without affecting the labels in the track you are moving into, I think you can do the following (it works for region or point labels):

  1. In the label track, click above the left edge of the first label so you see the yellow Snap To Guide (take care not to click the triangle or circle handles)
  2. Drag to the last label until you see the Snap To Guide, then release (if it’s a region label, drag to the right edge of the label)
  3. Edit > Remove Audio > Cut
  4. Click in the label track at the point you want to paste, then Edit > Paste.

If you want to move the labels to right of the paste point by the length of the paste, press the Sync-Lock Tracks button in Edit Toolbar before pasting.

Now, the problem (a bug I think). If in step 4 you click to paste where an existing point label is, the point label is removed. This occurs if you paste a point or a region label, but does not occur if you paste at either border of a region label.


Gale

You could use:
Tracks menu > Edit Labels.

Click once on the track name (second column) to select the one that you want to change, then click again to select which track you want from the list that will appear.

Another way to move all labels to one track is to export the labels (File menu > Export Labels) then import them again (File > Import > Labels). This will create a new label track containing all of the previous labels. To exclude some label tracks from the export, delete those tracks, then export, then Undo the deletion(s).

I just did some experimentation and see what you mean about cut&paste and overlap :frowning:

So I did some further experimentation (based on Steve’s suggestion above)

OK try this:

  1. Select the just the label tracks that you want to merge

  2. use File > Export Labels to export the set of labels to a .txt file

  3. open the .txt file in Excel - you will see all the required labels, but “not necessarily in the right order”

  4. Sort the data set in Excel by column A ascending (this is the time data) - all labels will now be in correct time order

  5. Save the file (this will update the .txt file and not create a .xls file)

  6. Go back to Audacity and use File > Import > Labels to import the sorted label set

  7. delete the unwanted label tracks

If you are hyper-confident you can minimize clicking by deleting the selected label tracks immediately after step 2 :nerd:

WC

OP said “overwrite” rather than overlap, so we’ll have to wait for OP’s reply.

But apart from the paste result looking confusing if you paste inside existing labels (or you aren’t zoomed in), did you find anything that definitely seemed to be wrong?


Gale

Testing on Linux, when pasting labels into a label track that already contains labels, the result seems wrong (unpredictable).
I’m not quite sure what is going on there, but to get the labels to paste correctly,

  1. Select the destination label track
  2. Press the “Home” key
  3. Paste the labels.

But OP also said that they wanted to “merge” the label tracks.

Cut&Paste does not produce a merge - whereas the technique I posted does

In fact cut and paste produces erroneous results - steps to replicate (Audacity 2.0.3

  1. Generate 12 seconds of audio
  2. create a label track and label the odd seconds 1,3,5,7,9
  3. create a second label track and label the even seconds 2,4,6,8,10
  4. select the second label track and use Copy to make a copy of it
  5. select the first label track and use Paste
  6. all odd number labels are “lost” leaving only 9, incorrectly positioned at Time=0

That’s what I meant by “overlap” - in fact it’s more serious than that.

Update: however if at step 5 you:
5) select the first label track
6) then move the cursor to Time=0 (first label track remains focussed but no longer slected)
7) use paste
8) The labels are interleaved correctly

So the problem appears to be when the first label track is selected but no cursor position exists to initiate the start of the paste (you can start the past from any cursor position in the timeline and thga seem to work ok - but for a true “merge” as per the OP’s request then cursor at T=0 is required).

And this is simpler than my previous workaround recipe :slight_smile:

Peter.

That’s what I observed on Linux too.
Workaround:
Before pasting the labels, press the “Home” key.

@Steve: you were typing while I was updating my post - see the update

I suspect that this is a bug?

Peter

Actually the behaviour has been the same since at least 1.3.14, but it looks a bit weird since the option for “Retain Labels if selection snaps to a selection edge” was introduced.

Turning off the option:
"Edit > Preferences > Interface > “Retain Labels if selection snaps to a selection edge”
makes the behaviour the same as in 1.3.14 and it is easier to see what the limitation is.

As with audio, pasting over a selection will replace the current selection.
Unlike audio tracks, pasting at a specific point (not a selection), the labels will be merged with any existing labels.

The slight weirdness that occurs when clicking on a track to select it, is because by default the final label is not included in the selection, so it is not replaced.

I don’t think this is a bug. I think it is an undocumented feature that looks odd.

I agree with Steve’s diagnosis; I would have expected pasting an entire selected label track into another selected label track to overwrite, and AFAIK we don’t describe that as a way to move labels.

I am not sure why in Peter’s steps, “Retain labels=on” would move label 9 to time 0. but I guess since the selection is being overwritten, there is nothing else to do with the label if you force keeping it.

My solution (in Peter’s test case, drag exactly from labels 2 to 10, cut or copy, click in the other label track at the point corresponding to label 2 and paste) also works fine. Selecting the entire label track to copy or cut, then select the label track to paste into followed by HOME might be better for visually impaired users and easier than Labels Editor.

That still leaves the problem that if you paste at a point where there is an existing label, the existing label is removed. I still see that as a bug rather than a weirdness because it prevents a proper merge, though “Retain labels=on” actually prevents it occurring.


Gale

Thanks for the tip (someone) about pressing Home before pasting. That merges them nicely. My method is now:

  • click in the tracks area of the label track I want to copy to select it all
  • click somewhere in the label track I want to merge it into
  • press Home
  • press control+V

My “Retain Labels if selection snaps to a label edge” preference is unticked, presumably the default, and I didn’t lose the end label, despite the selection appearing to end at the label. Perhaps that wouldn’t be true if I’d manually selected everything up to that label.

So the surprise for me was the difference in behaviour between selecting a point to paste into and pasting “over” the whole track. Perhaps this should be mentioned in the manual (http://manual.audacityteam.org/man/Label_Tracks) or wiki (http://wiki.audacityteam.org/wiki/Labels_Tips). I’m not sure why I would be surprised by that. I wasn’t surprised it overwrote when I selected the whole track, but I assumed it would insert and move the other labels along if I chose a single point, like it would for audio. Pity I didn’t try it.

I’m slightly uncomfortable using this merge operation unless it’s documented. Is it supposed to do it? I wonder if it’s ever annoyed anyone who did want the other labels to move along.

I’d forgotten about the Edit Labels command. That method wouldn’t have been practical for this operation because there are too many labels involved, and it forces you to do them one by one.

I see that you can select more than one label in that command, but it doesn’t seem to let you do anything with the selection. If I could select all the labels in a track, then change their track in one operation then that would be a neat way to do it that also feels safe.

My next task is to move a few individual labels into their own track, and I see Edit Labels as the best way to do that. I think copying and pasting is going to be tedious for single labels. Luckily I will be able to identify the labels involved by their text, so this will be fairly quick.

It would be quicker if I could specify a filter string in Edit labels so I could only see those I want to move.

Does anyone think it would be generally useful to be able to do operations on multiple labels in Edit Labels? And to be able to filter them according to their content, and perhaps by their track?

My operations on labels recently makes me think this is a slightly neglected part of Audacity, and I’m wondering if this is for lack of demand more than anything else. Would that be true?

Don’t be uncomfortable :wink:
Yes it is supposed to do it, and yes it should be documented. It was just overlooked when label tracks were documented but your post here has drawn attention to that omission.

“Edit Labels” is a relatively new feature. It’s not a feature that I have used much myself, but I agree that it has scope for further development. As you seem to have a number of ideas for how it could be improved, it may be worth starting a new topic in the “Adding Features” part of the forum: Adding Features - Audacity Forum

Requesting a feature does not automatically mean that it will be implemented soon, or ever, but feature requests are logged and many past feature requests have been implemented.

No, it wouldn’t move the labels along (unless Sync-Lock Tracks was enabled) for the same reason that generating at a point in an audio track with the label track also selected doesn’t move the following labels along. That is something still to be fixed.

I still find selecting between the labels with the guidance of the yellow Snap To Guides the quickest way for that (if of course you are zoomed out so you can see all the labels).

Labels Editor is relatively unintuitive IMO though bear in mind it was largely designed for visually impaired users.


Gale

Not sure what you mean here. I’m now talking about moving single labels, one at a time.

If the labels you want to move are adjacent in the same track, then you can consider my suggestion as above - it’s fewer steps than moving the labels one at a time.

If you need to move one label at a time, Edit Labels is as good as anything.

You can also click on the left edge of the label, drag to the right edge (or a little to right if it’s a point label),then Edit > Remove Audio > Cut or Edit > Remove Audio > Split Cut, then paste. Steve has pointed out that the “Remove Audio” name might not be the best.

Yet another way that is reasonably intuitive for a point label is to click in the label, drag select all its text, right-click, copy or cut, click in the other label track, then Edit > Paste Text to New Label. But you then have to remove the original label.



Gale

I would have thought then that it could be used entirely with keystrokes.

I’ve worked out how to do that to change the track of a label: use cursor keys to get to the track cell of the label, press F2, use cursor keys to select new track. But how do I now finish selecting so I can move to the next label? The only way I’ve found it to press Enter, but then I’m at label 1 when I press the Down key. Is there a better way, other than just use the mouse?

I would regard it as unexpected that if you change the track number for the third label, for example, then hit ENTER, the selection jumps back to the first label. But you can arrow down to the next label you want to move?



Gale

After I press F2 to activate the combobox, the cursor keys only move up and down the dropdown values. The only way I’ve found to exit this value choosing mode is to press Enter. When I do that, we jump to label 1.

I assume this is an oversight. F2 then Enter works ok for the label text - it jumps to the next label as I’d hope.

Works ok for changing times too, so I’m guessing people don’t use multiple label tracks that much and the track changing problem hasn’t been noticed.

Interestingly, changes to the times make the labels move as soon as one moves to the next label, but text and track changes are only refreshed once Edit Labels is closed.