Tracks/Clip Alignment


I have already searched through the forum for topics similar what I am posting here.
Could not find anything hitting this on the head.
Though I think this will be such a mainstream use case.

What I need or want to create

Say I have Track A and Track B
I have a marker on Track A – MA
I have a marker on Track B – MB

I want to move Track B, so that MA and MB are perfectly aligned.

(Ignore all the possible error conditions for now).


This may also be considered as the variation of the basic operation of moving a track or clip to
a precise time.
I find it very hard to tackle the precise mouse operations of time-shift.
When I think I am done, just taking the hand off the mouse, disturbs the alignment.

Ideally when one can simply express “move the start of the clip” to this time, I do not see why one is forced to deal with the challenging acrobatics of precision time shifting using mouse.
Here is the gist of what I do now

note down the time T where I want my clip C to be moved to.
I select the clip C
Enter the time T in Selection Start/End panel on the bottom.
Now the cursor shifts to time T.
I paste the clip T.

Now I find doing this over and over again in editing activities.
Work-wise I am adding/adjusting accompaniments to be aligned with hundreds of precise points on the melody track.

I am surprised that no one has written a macro/plugin for this.
May be I missed it in my search?

What I want to do

I have not written any nyquist code so far.
But I am getting ready to dive in.

But I am ready to plunge in and create a plugin

It should open a dialog box
Ask for Time1 (current spot) and Time2 (where it needs to be moved)
I can add more specifics like Track/Clip and Destination Track – defer to later on.
Hit GO
the plugin moves the selected clip to that point

Hopefully “Nudge a clip” macro can be created out of the same idea.

Help I am seeking

Any pointers/ideas/idioms for creating this plugin/macro.
Once the basic stuff is working, steps for making it robust for anyone to use.


br Sri.

I assume that when you say “marker” you mean there is a “label” at that point.

  1. Click on Track B at “MB”
  2. Split the track (Ctrl + i)
  3. With the Time Shift Tool drag one of the parts of Track B so that it aligns with “MA”. When the split edge of the track is perfectly aligned with the label, a yellow vertical guide line appears.

4. Drag the other part of Track B into position.

5. Click on the “split” line to rejoin the two halves.


Thanks for your quick response with screenshots.
Yes your method will work and is similar to what I use.

How does one Make a Macro or Plugin out of this – so that we get a specify params and Go process?
Not requiring the “manual alignment” process? as well as the tedious splitting, moving, aligning, moving, joining, and removing unwanted markers?
Imagine doing hundreds of this for a song…

To your questions are Markers Labels? Yes they can be.
Though in the editing/alignment work, ideally, I would like my markers behave like “Marks on a Clip” that remain on it, through copy/cut/paste/move operations.

Several months ago. I read here about sync locks (?) – may be using that, there is a way to get that behavior – but thought that, that would require separate track & label pair for each clip.
Can lead to massive proliferation of tracks and visual clutter!!!

Appreciate your further thoughts.

br Sri.

I would like my markers behave like “Marks on a Clip” that remain on it, through copy/cut/paste/move operations.

So would every video editor who ever tried using Audacity. Awkward, right?

You can make Labels “stick” to a sound track, but they don’t default like that and I don’t remember how. Searching.


There it is. Tracks > Sync Lock Tracks.


Search this page for “sync-lock.”

Screen Shot 2021-01-29 at 19.20.03.png


Appreciate your note and thoughts expressed.

You say awkward…sure its…and hope audacity’'s glorious journey marches on…
I can also understand there are data/architectural foundations that might break with the semantics of Markers-On-Clips.
I am going to also explore automation via python - so the additional constructs remain arms length outside of Audacity for now.
Just have to tackle the ramp time – as I know it be well worth the effort.

BTW, I see that you are also a Forum Staff.
Do you have any pointers to Audacity Code Base and/or any technical sessions for interested folks who may want to roll up sleeves and start to contribute to Audacity - of course in simple ways first.

br Sri.

I don’t have a clear picture of what you want.
If there was a plug-in that could do what you want, what would it look like, what params would it have, and what would it do?

Audacity is mostly written in C++. The code base is here: GitHub - audacity/audacity: Audio Editor
If you have experience developing with C++, then a good place to start is building Audacity from the source code.

If you’re not a C++ developer but would like to have a go at programming, the learning curve for “Nyquist” (Audacity’s built-in scripting language) has a much more gentle learning curve than C++: Nyquist - Audacity Manual


Thank again for continuing the exchange…

I was avoiding overbinding of the plugin macro definition.
But below is a cut at the definition.

This is the method (combining your ideas and mine) I am using manually and it is working very smoothly.
Just wish there was “nudging” as often times, I cannot get the Clip to align on the label line.
It just moves a but to left or bit to right.
Then I have to zoom in for more precision.

Here would be a good seed description

M is the music track.
But for the labels, the track contents will remain unchanged.
This track have point labels where accompaniments go.
Let us call such a point MP

C is the Clips Track
This contains clips [CLIPS] of accompaniments.
But for labels, the track contents will remain unchanged.
Each clip will have a label (may be more - let is ignore that for the moment) which are alignment points. CP

A is the accompaniment track.
This is where the accompaniments will be added that, so that MP and CP are aligned.

So how does it work?

User has set up these tracks.
Now adds a MP (point on music track)
Now selects a clip CLIP from C the clicks track.
Selects a label CP from the clip

So the params are

Submits these params to the plugin

puts the selected CLIP on A so that MP and CP are perfectly aligned timewise.

Beyond this
So much can be done on the UI, for direct interactions, on top of this.
MP and CP can be sequences so the task is completed for the accompaniment clips.

Alternatively, I can create a text file

M track name
C track name
A track name

series of

where MP and CP are labels.
Need a way to uniquely refer to a CLIP.

This will preserve the Task Specs for repeated execution - as we should never lose work.
Manually doing the tasks each time should be available but should not be the norm.

On to your other points:

Programming languages are no barriers for me.
But I would like to avoid reverse engineering understanding from the code, as it can be complex, unreliable and extremely time consuming. The reason I was asking if there are Code Architecture, Design etc documents to ramp up new folks coming on board for contributing. (This is mainly for giving back some to audacity community)

Yes, I would very much start with Nyquist for all the reasons you have laid out and for the above.
(This is for taking care of my task needs - which become laborious due to lack of plugins).

I have to truly thank you Forum Staff and many Forum members for fast response and valuable guidelines and pointers.

br Sri.

Re: Tracks/Clip Alignment.
Your suggestion sounds like it would be “possible”, but would require a great deal of work.
From your description, it seems that the effect relies on the “markers” being accurately placed. Surely that’s just as difficult as moving the clips accurately?

I’m seeing a high cost in development time / effort, but very little practical benefit. It seems to me that zooming in when using the Time Shift Tool really isn’t any more difficult than zooming in to accurately place a label.

Fwiw , I usually use “Ctrl + Mouse Wheel” to zoom in and out as I find this by far the quickest and easiest way.

Some links for you:

Dev section on Audacity wiki: Missing features - Audacity Support

A list of Nyquist documentation: Manuals and reference material


Just saw your response.

I am not sure about the development time – but I am motivated to give it a shot as it is highly valuable for me.

You are right - as long as we have to rely on manual placement of cursor/label with precision, without “nudging” it is difficult.
Nudging would make that trivial. (Cannot imagine using images in presentation tools like Powerpoint without it).

There are many ways to eliminate such problems, which are caused by tool set features or ones missing.

Just to ensure I am not misunderstood - I am a die-hard champion of Audacity.

For example, I have seen nice things in other tools.
For example, for getting accurate start/end points of Loop Clips, a panel comes up showing both the left side and right sides (zoomed) in so they can be easily lined up and also looping can be previewed.
I remember Caustic wave editor does this nicely.

In Audacity, we have to zoom in deep, and then we cannot the start and ending part patterns clearly at the same time.
(of course I can copy the right part on a separate track and shift it and place it underneath, so that I can see both the ends -making users do the tedious things).
I can elaborate many such feature ideas – and am sure you and audacity community can come up with lot more fantastic ideas, and would have given Audacity’s long track.

Ultimately, I know it will always be a decision based on lots of factors.
But greatest enhancements will always come up from a small minority of people who experience pains far before others do, and how do they deal with it.
I am saying this from my first hand personal career heritage of several decades :slight_smile:

br Sri.


I forgot to add one more sidebar comment.

There are many ways to put precise markers on music track automatically (for example beat finder which Audacity provides, other label generation methods).

For example, I have an audio composer written in Python - which takes an audacity project(s) with labels and combines them in many ways (specified by a text file) – different ordering, repeating, shifting volumes, pitches, speeds, track fade in/out, cross fading, adding silences, creating frills of different kinds etc. It computes times and markers using algorithms. This is more for interesting ways to mash created music. Very powerful and flexible - specs driven rather than manually doing them,even if possible.

The track alignment - the original topic here, is an activity comes before mashing - as I would rely on my own artistic judgements instead of trusting algorithms to decide the points of alignments.

br Sri.

I’ve also seen that in other software, and I agree it would be a nice addition for Audacity.

Audacity does have a couple of related features that can help with this sort of thing:

  1. If the keyboard shortcuts are set to the “Full” set of defaults (Shortcuts Preferences - Audacity Manual) then when zoomed in,you can use “Ctrl + ]” and “Ctrl + [” jump to the start and end of the selection.

  2. “Timeline Quick Play” has a couple of features to help with making loops: Timeline - Audacity Manual

There’s already a way to “nudge” a track left / right, but it moves the entire track, not just a single audio clip. You can of course move a clip into a new track so that it is the only clip in the track. If you hold down the “Ctrl” key then the Time Shift Tool is constrained to dragging vertically only.

Say that you have a single audio clip in a track with empty space before and after it. To nudge that track to the right:

  1. Double click on an audio clip (selects the audio clip)
  2. Use “Shift + Left / Right cursor keys” and “Ctrl + Shift + Left / Right” to nudge the start / end of the time selection (Selecting Audio - Audacity Manual)
  3. “Tracks menu > Align Tracks > Start / End of track to Start / End of selection” (Tracks Menu: Align Tracks - Audacity Manual)

As I said, I believe that it is possible to do. I’ll take a look and see if I can come up with something to help get you started.

I assume that you know that Audacity can be controlled from Python (?)
(Scripting - Audacity Manual)

This code will move a selected audio clip by a specified amount (negative = left).
The code may be run in the Nyquist Prompt effect (Nyquist Prompt - Audacity Manual)

;version 4
;type tool

;control shift "Nudge amount (seconds)" float "" 0 -1 1

(aud-do "SplitCut:")
(aud-do (format nil
          "SelectTime: End=~s RelativeTo=\"Selection\" Start=~s"
          shift shift))
(aud-do "Paste:")

To convert this code to an installable plug-in, you just need to add the other “Required” plug-in headers.
(Missing features - Audacity Support)


Again sincere appreciation and enormous thanks for the education, new tips and the code.

Will start exploring with that seed code soon.

regards Sri.
p.s. Sorry for the delayed response due to digressions.


Code is Simple, Nice and beautiful – and has opened for me this mechanism to play with.

Appreciate a few more handwaves from you.

a) Is it possible to keep the interactive GUI for for further inputs/actions - without it going away?

even if it goes back to Nyquist prompt it would help a bit

b) Your pointer for adding “required” plugin headers.

This is not clear.
How do I find the “required” plugins? I am assuming that this is like imports or includes in other languages.
May be it is not. Just adding a few lines of “literals” and I do not have to populate the “required” components are.
Let me know either way.

c) I know there is a folder full of .ny in the audacity install dir.

I can browse through these with the knowledge gained from your little code.
May be you can point me to some good .ny files for ramping and as sources of idioms for starters.

d) Specially, is there possibility of some “reflections” - like currently selected track, current cursor position, current clip (from track/cursor position) etc.

So that the clip can be selected by nyquist code.

br Sri.

See the link that I provided: Missing features - Audacity Support

Steve Thanks for reiterating the link. This time I read the whole page details and looks very clear. Playing and Testing will confirm my understanding. It has been a major “Step” function today!!

br Sri.