Collapse track segments together automatically?

Is there a way to collapse the blank space between track segments automatically?

So it would take these segments:
And make them look like this:
I am using Windows 10, and Audacity 3.1.3.

Thank you,


I can’t think of any way to do that exactly. You could of course achieve a similar result with Edit > Audio Clips > Join, then Effect > Special > Truncate Silence

It should be possible to do this with a macro, except that I think this bug would prevent it from working reliably:
The bug occurs so frequently for me with the current version of Audacity that it’s not currently worth attempting to write a macro for this type of task.

If this feature is important to you, then I think there are two options:

  1. Wait for bug 4146 to be fixed (Don’t hold your breath - it’s unlikely to be fixed any time soon).

  2. Use an older version of Audacity (I’ve not been able to reproduce the bug on Audacity 2.4.2, but I’ve seen one similar bug report for Audacity 2.3.2, so it’s possible that the bug may also occur on older versions)

    Another possibility, though this is not suitable if you need to retain silent audio in clips, would be to use “Truncate Silence” (See: A couple of issues to consider with this option:

  3. The minimum “Threshold” level supported by the effect is -80 dB, so if the clips contain leading or trailing silence below -80 dB, that will be truncated along with the “gaps” (the gaps are absolute silence: -inf dB).

  4. Truncate Silence does not work with default preferences. You need to enable “editing a clip can move other clips” in “Preferences > Track Behaviours”.