# Aligning music to beats and bars

{% hint style="info" %}
**Note:** A measure and a bar are the same thing. Audacity uses "bar" in places where "measure" would be too long. &#x20;
{% endhint %}

## Detecting tempo (BPM)

To align music to the beats and bars grid, you first need to know the tempo of the song, usually measured in beats per minute (BPM).&#x20;

* If you're recording music on your own, try playing to a metronome to ensure you stay in tempo.
* If you're using music downloaded from the web, try figuring out its tempo. In some cases, a web search for *`song title`*` ``tempo` is sufficient.
* You also can download a bpm detection plugin. The [Vamp plugin pack](https://www.vamp-plugins.org/pack.html) features several tempo detection plugins, such as:
  * *IBT - INESC Beat Tracker*
  * *Simple Fixed Tempo Estimator* form the Vamp SDK example library
  * *Tempo and Beat Tracker: Tempo* from the Queen Mary University of London

{% hint style="info" %}
Audacity is not yet able to handle midway tempo changes during a song.
{% endhint %}

## Preparing clips for snapping

Audacity will snap the beginning of the clip to the beats and bars grid, depending on your tempo and snapping setting. If your first beat doesn't start exactly at the start of the clip, you can trim the beginning of the clip. To trim a clip, simply drag the upper edge of it inwards.

<figure><img src="https://2387260374-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhmBVzGzh8SctWQ6jPR%2Fuploads%2F3BPVgWEXGwJnSFk3sOu5%2FScreenshot%20from%202023-10-18%2011-17-01.png?alt=media&#x26;token=298dadae-581c-47d4-9d66-9c21cea0ddd2" alt="" width="191"><figcaption></figcaption></figure>

{% hint style="info" %}
When trimming a clip, you may need to turn off snapping to make finer adjustments.
{% endhint %}

## Aligning to beats and bars

Once you have everything set up and snapping enabled, simply dragging your clips will align them to the beat and bars grid.&#x20;

<figure><img src="https://2387260374-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhmBVzGzh8SctWQ6jPR%2Fuploads%2FmTBlTxXlunq0aJpAEqj3%2Fimage.png?alt=media&#x26;token=0ba1c5da-cacc-4c34-b830-329b2cd96fde" alt=""><figcaption><p>The snapping toolbar with its dropdowns. </p></figcaption></figure>

***

Once you have aligned your music, you can get started with adding loops and other content to the project [working-with-audio-loops](https://support.audacityteam.org/music/working-with-audio-loops "mention")


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.audacityteam.org/music/aligning-music-to-beats-and-measures.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
