Label Tracks

From Audacity Development Manual
Revision as of 15:26, 14 May 2013 by PeterSampson (talk | contribs) (Cutting and Pasting Region Labels: fixing link in Paste menu spans)
Jump to: navigation, search
Peter 10May13: ToDo-2 This page is another potential candidate for becoming a landing page with brief explanatory text and links to sub-pages as it is looks TLDR.
  • Gale wrote by email 10May13: I tend to agree, but a custom TOC may be sufficient to see the wood for the trees. Possible candidates for separate pages would be:
    1. Creating and selecting labels
    2. Removing labels
    3. Editing labels
    4. Labels Editor - Gale added this suggestion by email 13May13
A landing page with split off pages would still have to address in summary how to create, select, remove and edit labels.
  • Peter 11May13: Ed also voted on the Manual email list to add a custom TOC to aid navigation. So I will do this as a first step and then we can consider further.
  • Peter 11May13: The more I look at this page the more the two sections Creating and selecting labels and Editing labels look tutorial-like and thus probably would benefit from being spun-off onto sub-pages of their own - of course leaving summaries of how to approach these tasks.
  • Gale by email 11May13: I think we should keep the idea of a split on the back burner, though a custom TOC would probably do for now. Labels are a major but still somewhat underdeveloped feature so e.g. if new buttons or right-click menus were added to them, or features to select multiple labels, it would expand the page further.
  • Gale by email 13May13: I'm not going to stand in your way if you want to develop separate pages in your user space as you usually do. I think it will come to having to split pages off sooner or later if label features expand.
    • Peter 14May13: OK I'll mark that as a future project for myself. At the moment it's still a bit of a work-in-progress so I'd like it to get to a bit of stability before I start deconstructing/reconstructing it (otherwise I have to mirror all changes).
Peter 11May13: ToDo-2 I have replaced the initial introductory image with a W7 Basic Theme version from Audacity 2.0.4 Alpha 8May13. All other images with range labels are not strictly Connie compliant:
  • On W7 latest alpha I always see the label just above and abutting the thin rectangle showing the label not partly obscuring it. The obscuring shows on XP so I assume this images was taken a while back and this is a subtle behavior difference W7 v. XP
  • Connie would also require a deeper default track with the gain and pan sliders showing in the TCP.
  • This is probably P2 and may not be regarded as a release blocker.
    • Peter 11May13: There are 30-odd pages that would require updating and a low ROI for the amount of effort involved. Are we happy to leave these for now and downgrade the P2 to a Px to retain a placeholder?
Gale by email 13May13: ToDo-2 the menu spans want attention - most have no links but the last item in the span should be linked.

Pistes de marqueurs Pista de etiquetas Flag of Holland small.png

A "Label Track" is an additional track that can be created in your project. It is used in conjunction with audio tracks but contains no audio itself.

Contents

  1. Features of a label track
  2. The Label Track Drop-down Menu
  3. Creating Labels
  4. Adding labels while playing or recording
  5. Selecting a label
  6. Removing labels
  7. Editing labels
  8. Importing and Exporting Labels

Features of a label track

  • Labels can be used to annotate or mark, with text labels, selected points or regions of audio.
  • The labels can be moved, modified or deleted.
  • They provide a convenient way to mark different songs in a recording then export them to differently named audio files using File > Export Multiple...

.

a mono track with a label track, a region label and a point label
Example of a mono track with a label track which has a region label and a point label.
Peter 11May13: I replaced the previous old incorrect XP image with a W7 Basic Theme version from Audacity 2.0.4 Alpha 8May13. The image is larger than its predecessor as I used the default sizing for the tracks (these were enlarged in later 1.3.x Betas).

The Label Track Drop-down Menu

image of label track drop-down menu, Mac OS X style
  • Name
Displays the "Track Name" dialog where you can give the track a new name. Useful in multi-track projects to provide a visual indication of the content of each track.
  • Font
Displays the "Label Track Font" dialog where you can set the font and font size of the labels. Note that this applies to all label tracks.
  • Moving Tracks
Tracks can be moved up and down using the menu items.
Move Track Up: Moves track up.
Move Track Down: Moves track down.

Creating Labels

Suppose that you have a recording of an interview and you want to annotate the questions and answers so you can easily jump directly to a particular question or answer later on. Initially, you may have something like the image below. Without any annotation it's almost impossible to tell them apart just looking at the waveform.

A single track containing an interview with questions and answers.

Here, we select the first question with the mouse (below). This may require listening to the audio several times to determine the exact boundaries of the selection.

After selecting the first question.

Now click on Tracks > Add Label at Selection, or type its keyboard shortcut ( CTRL + B on Windows/Linux or CMND + B on the Mac). This creates a new label track and a blank label outlining the current selection (below).

After choosing Add Label at Selection.

The cursor is automatically positioned inside the label, just type the name of the label then press Enter (pressing Enter allows you to use any current keyboard shortcuts normally--you could press Space to listen to the selection again if you wished). In the image below we've typed Question 1.

After creating a label, type its name and press Enter.

After this question comes the answer from the person being interviewed. We'll select this one by starting from the right side of the answer and dragging to the left. Note that a vertical yellow guide appears when we get to the edge of the first label, making it easy to line up the two labels (below). It's common for the next label to start exactly where the previous one ends, but it's not necessary.

Selecting the audio for the second labeled region.

Once again, click on Tracks > Add Label at Selection to create the next label, then type its name and press ENTER.

Because there is already a label track, you could instead press DOWN arrow on the keyboard, so moving the yellow focus border into the label track, then just type to create the new region label and text. In most cases you can also drag a region or click in the label track, then immediately type the label for that region or point.

In the following image, we've added even more labels.

After adding the second label and naming it.

And here is a complete label track with several labels

A track with several labels.

Alternative Method Using Point Labels

In the example above we used region labels to mark the interview segments. We could just as easily have used point labels.

For example, we could click in the audio track at the beginning of the first question then click on Tracks > Add Label at Selection to create the point label.

A track with a single point label.

Similarly, we could click in the audio track at the beginning of the first answer then click on Tracks > Add Label at Selection to create the second point label.

A track with a two point labels.

Either method is equally valid. Region labels have the advantage that clicking in the label text selects the audio spanned by the region label, which may be useful in some situations.

Adding labels while playing or recording

You can also create point or region labels while playing or recording. To mark a point while playing or recording, use the command Tracks > Add Label at Playback Position or its keyboard shortcut CTRL + M. This adds a point label at the current Audio Position indicated in Selection Toolbar.

To mark a region while playing or recording, click and drag the selection region while you are listening to the track, then use the same Add Label at Selection command (or CTRL + B shortcut) as when adding a region when the track is stopped.

To hear a recording in progress, click Transport > Software Playthrough (on/off) - do not use this option when recording computer playback. See Why can’t I hear what I’m recording? for more advice.

Selecting a label

When you click inside a label to select it, the label is opened so its name can be edited, and the cursor point or region of audio the label corresponds to is restored. The cursor point or region will also be selected in any other currently selected audio tracks.

Audio in track and label selected.
Peter 13May13 I am commenting out this note as it is confusing in the context of this page specifically because this is a page about labels and in particular selecting labels. This trick can be used to restores a labeled selection of audio but it definitely does *not* restore any previously selected region of a label track nor does it reselect the label. You can't even "region select" a selection which is label track only, the command is grayed out. I submit that this trick has nothing to do with label tracks or selecting labels and thus should not be on this page or in this section.
You can also save and restore an individual selection region without adding a label, using Edit > Region Save and Region Restore.

Use Tab on your keyboard to select forwards to the next label, and Shift + Tab to select backwards to the previous label. If no label is selected but the Label Track has focus (shown by the yellow border), Tab will select the first label then cycle forwards through the labels, and Shift + Tab will select the last label then cycle backwards through the labels.

Removing labels

Removing labels without moving back any following labels

These methods let you remove labels without moving back any labels that follow to right of the removed labels(s). The labels to right thus remain synchronized with their audio.

Remove one or multiple labels at once: Select any region that extends beyond the label(s) to be removed (without reaching other labels and without selecting in any audio tracks), then choose Edit > Remove Audio or Labels > Split Delete. You can also use the Split Delete shortcut CTRL + ALT + K instead of the menu.

Remove an individual label: Open the label, remove the text then press Backspace or Delete once to remove the empty label. This can be achieved in several ways, for example:

  • Single-click before the first character in the label text (or click anywhere in the text then press Home), then press the Delete key until the text is removed, then press Delete once more.
  • Single-click before the first character in the label text (or click anywhere in the text then press Home), then hold Shift and press End. Now press Delete twice.
  • Single-click anywhere after the first character in the label text, then use first Backspace then Delete if needed until the text and label are removed.
Keyboard use: Use UP or DOWN to move the focus into the label track if needed, then Tab into the label to be removed. Now press Backspace until the label text and label are removed. You can also use Labels Editor to remove an individual label without affecting the following labels.
Ed 9May13: I'm sorry, but this (above) wording makes little sense to me. My understanding is that you must remove all text then do an additional backspace or DEL to remove the label. We say put the text edit cursor at the front of the line (but "down the label"??) then "press the DELETE or BACKSPACE key (as appropriate)"; if at HOME (and text is present) then only the DEL key is appropriate. If we are mentioning the HOME shortcut we should also mention SHIFT+END thereafter to quickly select all for immediate deletion.
  • Peter 10May13:I agree with Ed that this is awkwardly worded and may not be the most natural way which I always thought was to place the cursor at the end of the label and press DELETE repeatedly to remove the text and then one extra time to remove the label itself. But what this really shows is the cack-handed label handling that we have in Audacity. We do really need a Delete Label function imo. I seem to recall that recently on the forum we were discussing the possibility of adding such a command the drop-down menu that you get when you right click a label - did that just run aground?
    • And now that Gale has taught me the trick of using split delete I find selecting in the label track and using Ctrl+Alt+K the easiest and quickest way of accomplishing this task.
      • Gale 10May13: It was confusing before. It said "Single-click in the text of an individual label, then press the DELETE or BACKSPACE key (as appropriate) on your keyboard until the text is removed." What it actually means is that unless you click before the first character, you have to use both DELETE and BACKSPACE, or the operation comes to a halt. I find that a horrible way to delete, personally, and it ignores the fact that some Apple keyboards don't have BACKSPACE. So we cannot have that as the only method. I agree that BACKSPACE fails in what I wrote, sorry.

        @Peter: If you place the cursor at the end of the label. then press DELETE, nothing happens. You meant BACKSPACE :=) Yes I support Steve's label delete if he makes it discoverable with a button or right-click, otherwise it adds too little.

        Attempted rewrite above (which doesn't mention drag-select all the text then DELETE or BACKSPACE twice). An alternative would be to leave the first sentence as is and then only give one (or no) examples. Also I converted to kbrd template as these are not Audacity shortcuts, but standard keyboard use.

        Ed 10May13 : I made a tiny change but I'm now very happy with this. @Peter - if you are happy go ahead and delete this editor note.
      • Gale 11May13: Thanks, Ed. I disagree with making the former note the final bullet point. That method has nothing to with removing the text as the label removal method. I made two sections (1) for removing an individual label (2) for removing one or more labels (the former note content, but not in a note). Also I tweaked the "BACKSPACE and DELETE" method again because it wasn't clear even then. And then I realised we give no keyboard method to remove an individual label (short of Labels Editor), so I added that too. Still OK?
      • Peter 11May13: @Gale: I'm sorry but I just don't agree with what used to be the note (copy below) becoming reworded and sub-headed as "Remove multiple labels at once:". That implies that this cute trick is perhaps restricted to the removal of multiple labels. Sure the smart ones will figure out they can use it for single label removal - but there is no need to imply such a restriction as this may cause some readers just to gloss over it if they want single label removal. And I thought that this trick was so cute and so useful, after years of struggling with label deletion, that I thought that it deserved some promotional prominence (I am an ex-Marketeer as well as an ex-mathematician :-} ) which is why I decided to encase it in the note div. So my *definite* preference is to re-instate the note as-was - maybe even adding Top Tip: as a preface.
A quick way to remove one or more labels without affecting other labels is to select any region extending over (or at least touching) the label edges(s), then choose Edit > Remove Audio or Labels > Split Delete or use the keyboard shortcut CTRL + ALT + K.
  • Peter later 11May13: actually I now realize that the above note is not strictly true in all circumstances. If you have your preferences set to "Retain labels if selection snaps to label edge" (albeit this is not the default setting for this preference) then when you have a range label with the selection over it and abutting to its edge and then use Ctrl+Alt+K then the range label will remain but be shrunk to a point label. Similarly a range label can be shrunk in this way when the selected area is over part of the range label. I *really* don't want to get into such subtleties and intricacies here (the page is complicated enough already) rather I would reword the note more simply " ... select any region extending over the label(s), then choose ... "
    • Gale 12May13: I felt the cute trick note was a bit weak before on pointing out that you could deal with multiple labels. Actually this is dexterous mouse use (think if the labels are close together and you want to remove one in the middle). The cute method can be done with keyboard only, but with many steps. I think extending "beyond" is a little clearer than "over". Does it look better now? I prefer to use the note div for "Keyboard use" as elsewhere.
    • Peter 13May13: Looks much better now Imo. I like the fact that not only is the "cute trick" strengthened but particularly I like that it comes ahead of the cack-handed ways of doing this. I'm happy with the way it is now.

Removing labels (or regions of label track), moving back any following labels

You can remove labels or regions between labels by selecting over or between labels, then choose Edit > Remove Audio or Labels > Cut or Edit > Remove Audio or Labels > Delete. If you remove part of an area inside a region label, this will reduce the length of the label. Labels following to right of the removed labels will always move backwards according to the length of the removed selection.

When removing parts of the label track you may often want to remove the corresponding audio too, so that the remaining labels still relate to their original audio. To remove the audio region as well as the label region, either drag the selection upwards to include the audio track or enable Sync-Locked tracks.

A quick way to select and delete the exact area of an individual region label together with its corresponding audio (moving the following audio backwards) is to single-click in the label text then press Enter followed by DELETE or BACKSPACE.
Peter 13MAy13: ToDo-2 But if you have your preferences set to "Retain labels if selection snaps to label edge" (non-default setting) then while the audio is deleted the label is not. This may well confuse users as they are reading a section called ""Removing Labels" not "Removing Audio", so they may expect their label to be removed with this trick. Do we want to get into these intricacies here? Would we be better just losing this note?

is not strictly true in all circumstances. If you have your preferences set to "Retain labels if selection snaps to label edge" (albeit this is not the default setting for this preference)

Removing all your labels

You can also remove all labels at once by removing the label track entirely. To do this, click in the track and choose Tracks > Remove Tracks. Alternatively, click the close box in the upper-left corner of the label track.

Any edits to label tracks can be undone by using Edit > Undo.

Editing labels

Changing the length and position of labels with the mouse

You can move a label by clicking and dragging its circle handle. You can change the length of a label by clicking and dragging its triangle handle.

Holding Shift while dragging reverses this behavior, so that dragging a circle handle changes the length of the label, and dragging a triangle handle moves the label. For example, this lets you resize a label by holding Shift while dragging its circle handle, then release Shift to move the resized label without having to move the mouse pointer to its triangle handle.

In the case where two labels meet you can adjust the junction point where they meet by clicking and dragging their shared circle handle.

Moving a point label

You can move a point label by clicking and dragging its circle handle:

PointMoveBefore.png PointMoveAfter.png
Before After

Expanding a point label

You can expand a point label into a region label by clicking and dragging either of its triangle handles:

PointExpandBefore.png PointExpandAfter.png
Before After

Moving and resizing a region label

You can move a region label by clicking and dragging either of its circle handles:

RegionMoveBefore.png RegionMoveAfter.png
Before After

You can change the length of a region label by clicking and dragging one of its triangle handles:

RegionAdjustBefore.png RegionAdjustAfter.png
Before After

Adjusting the junction point where two labels meet

You can adjust the junction point where two labels meet by clicking and dragging their shared circle handle:

LinkedRegionMoveBefore.png LinkedRegionMoveAfter.png
Before After

Moving a label when there is a selection

The illustration below shows what happens if you click in a label to select it, press Enter, then move the label.

LabelRegionMove1Before.png LabelRegionMove1After.png
Before After

Contrast this to what happens if you click in a label to select it, then move the label.

LabelRegionMove2Before.png LabelRegionMove2After.png
Before After

Using cut, copy and paste

The following examples of cutting labels with Edit > Remove Audio or Labels > Cut will move back any labels that follow to right of the removed label(s). To cut the label without moving following labels, use Edit > Remove Audio or Labels > Split Cut.

Cutting and Pasting Region Labels

You can cut and paste region labels using Edit > Remove Audio or Labels > Cut and Edit > Paste, but you have to make sure you don't select any audio, or you will end up cutting and pasting audio where you probably didn't intend.

In the image below, the label was selected by clicking in it, then the audio track was unselected by shift-clicking in the Track Control Panel of the audio track (this can also be done with the keyboard by ENTER, UP then ENTER). The label was then cut to the clipboard with Edit > Remove Audio or Labels > Cut:

image of label in label track ready for Edit Cut

To paste the label at a different point in the audio track, either a) click in the audio track at the point where you would like the label to begin then shift-click in the label track to select it; or b) click in the label track at the point where you would like the label to begin. The label can then be pasted to that spot using Edit > Paste.

image of label track after Edit Paste

Cutting and Pasting Point Labels

You can also cut and paste point labels, but the procedure is tricky. In the image below, the point label is selected for editing as in the above example with a region label, but there is no selected region in the label track.

image of label track with point label selected for editing

What happens next depends on the setting of the "Select all audio in project, if none selected" preference in Tracks Preferences:

  • If that preference is not selected, Edit > Remove Audio or Labels > Cut will be disabled and pressing CTRL + X will do nothing.
  • If that preference is selected and you do Edit > Remove Audio or Labels > Cut, all audio and labels in the project will be cut to the clipboard.

To cut and paste a point label to a different location, first select the text of the label as shown below. Note the difference in appearance of selected label text (the text is highlighted separately from the box) versus a selected label (where the entire label box is highlighted).

image of label track with point label text selected

Do Edit > Remove Audio or Labels > Cut - the text of the label is cut to the clipboard, leaving a label with no text. Press DELETE to delete the label. Click in the new location for the label and do Edit > Paste Text to New Label:

image of label track after Paste Text to New Label

Using the Context Menu

ToDo-2 Peter 10May13: the drop-down context menus are not Connie compliant - they are not W7 Basic / Audacity 2.0.4

There is a handy feature where you can select an area of text in a label then right-click to cut, copy or paste over (if there is text currently in the clipboard) that text. This allows you to click in another label, right-click, then paste that text in. So in our example you could select and copy "Question" and then paste it into the appropriate labels without having to type that word every time. The example below shows one way this can be used.

Click in a label, then select the label text. Note the difference in appearance of selected label text (as shown below - the text is highlighted separately from the box) versus a selected label (where the entire label box is highlighted). Right-click in the label:

image of contextual menu in a label with Copy selected, Mac OS X style

Now select the range of audio corresponding to the second question and click on Track > Add Label at Selection. Right click (control-click on a Mac) in the new label:

image of new label and contextual menu ready to paste text into the label, Mac OS X style

The text "Question" will be pasted into the label, and all you have to type is "2" to complete the label. Alternatively you could select the range in the label track instead of the audio track, then Edit > Paste Text to New Label to create the label with that text.

Labels Editor

Gale by email 13May13: Possibly Labels Editor should have its own page too. I've already expanded that text, and most people who use it want to enhance its features and usability, which may happen at some future time.

Tracks > Edit Labels... launches a keyboard-accessible Labels Editor. This shows all the labels at once in a tabular view, similar to a spreadsheet. Each row represents a single individual label:

Edit Labels dialog box with tabular view of labels

Use the Arrow keys on your keyboard to navigate easily left, right, up or down between the table cells and rows. Closing the editor with a label row selected selects that label in the label track (without opening it for editing). Pressing SPACE will then move the view to the start of that label and play the audio from the start of that label.

To open a cell for editing, use F2 or double-click. To confirm the edit, press Enter to move down into the same cell in the next label, or Tab to move into the following cell for the current label. Similarly, hold Shift and press Tab to move back to the previous cell for that label.

Opening the Start Time or End Time cell for editing lets you use Left or Right arrow keys to move between selected time digits, then Up or Down arrow keys to increment the digits. Alternatively you can type the number wanted for the selected digit. Labels Editor shows the selection format currently chosen in Selection Toolbar. To change the format temporarily to some other unit of time or to samples, audio CD frames or film frames, use the context key on your keyboard or click the downward-pointing arrow to right of the digits.

Edit Labels dialog with time cell open for editing

Navigating into any cell in the row for that label (or selecting that cell with the mouse) selects that label for action by the following three buttons:

  • Insert After: Insert a single label into the list after the selected label
  • Insert Before: Insert a single label into the list before the selected label
  • Remove: Remove the selected label without moving back any following labels.

After using either Insert button, type the label name, then Tab into and open the Start Time and End Time cells in turn to set the position of the new label.

Import... and Export... buttons: These respectively import a labels file or export all the labels to a text file (irrespective of which labels are selected). The buttons for import and export are equivalent to the File Menu commands for importing and exporting labels as described below.

Moving a label to a new label track: In the row for the label you want to move, open the cell under the "Track" column. Then select New...  menu dropdown, press Enter on your keyboard (or use the Label Editor's OK button), type the name of the new track then press Enter. This will move the label in that row to the new track. The new label track is now selectable in the Track cells in all rows.

Selecting different tracks in the Track cell only changes the track to which that label belongs. So if you select the track from which you moved a label.as above, the Label cell to right does not present an empty label ready to be created; you must insert a new label row if you want to create a new label in that track.

Creating a new empty label track and adding a label to it: Use either Insert button to add a new label row, then open the Track cell in that row and choose New...  menu dropdown and press Enter as above to allocate that label to a new track. It is often easiest to do this by selecting the top row then inserting before that row. The new row then remains selected after naming the new track, then you can Tab into the other fields as needed to name the label and set the label position.

Advice You cannot save empty labels that have no label text using Labels Editor, even if you are editing an existing label track that contains empty labels. Any empty labels will be removed from the label track(s) after closing the editor, unless you press Cancel.

Keeping labels synchronized with their audio

In many cases if you delete audio preceding a label you will want the label to move back so that it still relates to the audio it related to before the deletion. To achieve this, drag the selection down into the label track before deleting. Keyboard users can include the selection in the label track by pressing DOWN then ENTER. See Selecting using the keyboard.

To keep labels synchronized after deleting audio without having to select in the label track, enable Sync-Locked Tracks at Tracks > Sync-Lock Tracks. This feature define groups of Sync-Locked audio and/or label tracks, such that a length-changing action in one track of the group affects all the others in the group, whether they are selected or not. For example, enable Sync-Lock Tracks when you want to insert audio and move the labels along as well as the audio.

See the Sync-Locked Track Groups page for more information.

Importing and Exporting Labels

Existing labels are saved whenever you create an Audacity project. Audacity labels have a tab-delimited plain text format that can be opened by any text editor or spreadsheet program. The format looks like this:

0.450000  →  0.450000  →  point label
1.400000  →  3.100000  →  region label
4.150000  →  4.150000  →  Question 1
5.700000  →  5.700000  →  Answer 1
8.100000  →  8.100000  →  Question 2
9.800000  →  9.800000  →  Answer 2

The first column has the start time in seconds, the second column has the end time, and the third column has the name of the label. Start time and end time are identical if the label marks the cursor position rather than a selection region. Values are separated by tab characters (which will often appear as an arrow in text editors, as shown above).

Sometimes it may be useful to use these labels in another program (for example if somebody wanted to know the time where each piece of an interview starts or stops), or to import a labels file that someone has shared with you.

You can export labels using the Edit Labels editor window, or by choosing File > Export Labels.... By default the exported file has the same name as the current name of the label track. If there are multiple label tracks, the labels of all those tracks are combined into a single label track in the exported file, which by default has the same name as the current name of the last label track.

Labels can be imported using the Edit Labels editor window, or by choosing File > Import > Labels.... Imported label tracks are added to the bottom of all existing track types in the project, just as when you import an audio track.

If you import labels created by some application other than Audacity, make sure the application supports UTF-8, otherwise accented or any other non-Latin characters may cause the file not to import.

If you use a Windows application to create the file, you may have to use "Save As" and look for a specific option that saves with UTF-8 encoding.