# Creating a macro to add silence to the end of a track to match another tracks length

**URL:** <https://forum.audacityteam.org/t/creating-a-macro-to-add-silence-to-the-end-of-a-track-to-match-another-tracks-length/140503>\
**Category:** Macros and Scripting\
**Created:** [May 23, 2025, 10:31am UTC](https://forum.audacityteam.org/t/creating-a-macro-to-add-silence-to-the-end-of-a-track-to-match-another-tracks-length/140503 "2025-05-23T10:31:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![moterrac](https://forum.audacityteam.org/letter_avatar_proxy/v4/letter/m/d07c76/32.png) [@moterrac](https://forum.audacityteam.org/u/moterrac)\
**Post date:** [May 23, 2025, 10:31am UTC](https://forum.audacityteam.org/t/creating-a-macro-to-add-silence-to-the-end-of-a-track-to-match-another-tracks-length/140503/1 "2025-05-23T10:31:50Z")

</div>

Hello, I have been trying to create a macro for generating silence to match to another tracks length. Lets say I have two tracks, one slighty longer and the other shorter. Currently if I want to add silence to match the shorter tracks length to the length of the longer track I would select the end of shorter track, hold the shift key and then click the end of the longer track which selects the exact difference in length and then generate silence before finally joining the silence by pressing ctrl-j. Can anyone point me in the right direction for writing a macro for automating this process as i’m a little stuck with writing a macro that works.

Thanks!
