# How to figure out the length (time in ms) of a bar from bpm and time signature? [duplicate]

I have seen a bunch of similar questions on the site, but I'm going to ask more directly. I know a songs:

• tempo - X bpm - (eg.:120).
• time signature - Y/Z - (eg.: 4/4).

I'd like to know the formula that gives me in seconds (or milliseconds, whatever time unit) how long does 1 bar take in this song.

Based on the wikipedia articles and q/a I found, I'm unsure what's the role of the Y variable (upper part of the time signature) in calculating this. Few "calculations" I've done with common time signatures:

let's say X = 120 and Y/Z = 4/4

1. This means that 120 beats = 60 secs
2. This means 1 beat is 0.5 secs
3. This means 1 bar is 4 x 0.5 secs => 2 secs (haha secs)

And my DAW seems to agree with me on this one, worked nicely with 3/4 too.

But once I introduce some weirder (possibly illogical) time signature let's say 4/16 this method falls apart:

1. This means that 120 beats = 60 secs (no change here)
2. This means that 1 beat is 0.5 secs (no change here)
3. This means that 1 bar is 16 x 0.5 secs => 8 secs while my DAW shows 0.25 secs

So what is the correct way of determining the length of a bar? Does it need any other data?

• I don't understand how your 4/16 bar came out at 0.25 seconds. A quarter-note is an entire bar of 4/16, so if your quarter-note-per-minute marking is unchanged, a bar of 4/16 should be half a second. Jan 13 at 2:21

In 4/16 time, the 4 is still the number of beats contained in the measure. The 16 designated the notation used to indicate one beat. In 4/4 time, "quarter notes" are used to indicate single beats; in 4/16 time, "sixteenth notes" are used to designate a single beat.

The general formula would be:

(60/X) * Y

Z does not play a role in calculating the duration.

• Hmm thanks Aaron, it seems to be the case, seems like Z is not used when deremining the bar length. For the formula, isn't it `(60/X) * Y`? Jan 12 at 22:42
• @BalázsÉdes oops. Fixed now. Jan 12 at 23:09
• Thanks very much, this whole timing thing made my head spin :D Jan 12 at 23:28
• This is partially accurate. Tempo markings can differ for different metres: I don't know the English technical terms, but when you have bars based on triples, you can have "less" beats than `X`: for instance, it's common to consider 6/8 to have two beats (each one with 3 divisions). Tempo markings for those situations usually specify the unit, so you can have a tempo for the triplet, or even for the eight. DAWs commonly ignore that aspect for simplicity and only refer the bpm to the denominator, but it's not uncommon to have sheet music that actually requires to consider the `Z` too. Jan 13 at 1:00

## Tempo

Usually the tempo is given as BPM — beats per minute.
Where the tempo indication is shown as:
`"a note symbol that has the length of a beat, equal-sign, number (BMP)"`

By definition the BPM is the number of beats per minute. Putting this into an equation:
`"BPM" = "beats" / "time in minutes"`

Rearranging the equation:
`"time in minutes" = "beats" / "BPM"`

But if you'd rather have time measured in seconds, you'll have to multiply by 60 (seconds / minute):
`"time is seconds" = 60 x "beats" / "BPM" ` 

## Time Signature

Simple
The upper number in a simple time signature is equal to the number of beats per bar. The lower number is equivalent to the note symbol that is the length of a beat.
`"upper number of simple time signature" = "beats" / "bars"`

Rearranging this equation:
`"beats" = "upper number of simple time signature" x "bars"` [2s]

Compound
However, in a compound time signature the upper number is equal to the number of pulses per bar. The lower number is equivalent to the length of a pulse.
`"upper number of compound time signature" = "pulses" / "bars"`

Rearranging:
`"pulses" = "upper number of compound time signature" x "bars"`

In a compound time signature three pulses is equal to one beat; so the number of beats is equal to the number of pulses divided by three:
`"beats" = "pulses" / 3 = ("upper number of compound time signature" / 3) x "bars"` [2c]

# Results

Putting [eqn 2s], and [eqn 2c], into [eqn 1] we get:
`"time in seconds" = 60 x "upper number of simple time signature" x "bars" / "BPM"` [3s]

&
`"time in seconds" = 60 x ("upper number of compound time signature" / 3) x "bars" / "BPM"` [3c]

## In Symbolic Notation

Considering `N` bars of (a simple time signature) `Y/Z`, @ `Z = X BPM`:
`"time in seconds" = 60 x Y x N / X` [3s]

Considering `N` bars of (a compound time signature) `W/Z`, @ `Z = X BPM`:
`"time in seconds" = 60 x (W/3) x N / X` [3c]

## Concrete examples

Considering 1 bar of 4/4, @ quarter note = 120 BPM (eqn 3s):
`"time in seconds" = 60 x 4 x 1 / 120 = 2`

Considering 2 bars of 3/4, @ quarter note = 120 BPM (eqn 3s):
`"time in seconds" = 60 x 3 x 2 / 120 = 3`

Considering 4 bars 6/8, @ dotted quarter note = 120 BPM (eqn 3c):
`"time in seconds" = 60 x (6/3) x 4 / 120 = 4`

Considering 1 bar of 4/16, @ sixteenth note = 120 BPM (eqn 3s):
`"time in seconds" = 60 x 4 x 1 / 120 = 2`

So what went wrong with the last example?
Some DAWs will prefer to show the tempo as:
`"*quarter note*, equal-sign, number (BMP)"`

But the correct tempo indication has a note symbol that is the length of a beat:
`"a note symbol that has the length of a beat, equal-sign, number (BMP)"`

With the time signature 4/16, a beat is not a quarter note; a beat is clearly a sixteenth note.

(Some DAWs will be able to get away with this sloppiness because most of the users will usually use the time signature 4/4, where a quarter note is a beat.)

Msec = BeatsInBar * 60000 / BPM

Where BeatsInBar, is, well, the number of beats in a bar, regardless of how the beat is divided:

4/4 -> BeatsInBar = 4

3/4 -> BeatsInBar = 3

9/8 -> BeatsInBar = 3

6/8 -> BeatsInBar = 2

etc.

• Hey thanks for the answer! How did `9/8 -> BeatsInBar = 3` and `6/8 -> BeatsInBar = 2` get computed? Jan 12 at 22:36
• It's not computed, we just know that 9/8 time usually refers to a meter with 3 equal beats, and 6/8 time usually refers to a meter with 2 equal beats. There are fringe cases where it won't work that way. Jan 12 at 23:40
• The benefit of printed music, where the metronome marking specifies what the beats are. So you can tell whether 6/8 time is a quick 72 dotted crotchets a minute, or a slow 72 quavers a minute. Jan 13 at 13:21

Are you getting your tempo value from a DAW tempo display or from a piece of sheet music?

## DAW tempo

In most DAW software, the tempo is always in quarter notes per minute. Although DAW software and DAW users might refer to the DAW tempo values as being in BPM (beats per minute), when using a DAW like this, you have to understand that the tempo is really in quarter notes per minute. (In sheet music notation and in music theory, a beat is not always quarter note.)

If

• T is the tempo in quarter notes per minute
• N is the time signature numerator
• D is the time signature denominator

then

• ` 1 / T` is the duration of a quarter note in minutes
• ` 60 × 1 / T` is the duration of a quarter note in seconds
• `1000 × 60 × 1 / T` is the duration of a quarter note in milliseconds (A)

and

• ` N / D` is the length of a measure in whole notes
• `4 × N / D` is the length of a measure in quarter notes (B)

The duration of a measure in milliseconds is A × B:

• `(1000 × 60 × 1 / T) × (4 × N / D)`

which can be re-arranged to

• `(240000 × N / D) / T`

## Sheet music tempo

In sheet music notation and in music theory, a beat is not always a quarter note.

The sheet music will specify the tempo using notation like

• quarter note = T, where T is some number and quarter note is an actual quarter note symbol. This means the tempo is T beats per minute, and the beat is a quarter note.
• dotted quarter note = T, where T is some number and dotted quarter note is an actual dotted quarter note symbol. This means the tempo is T beats per minute, and the beat is a dotted quarter note.
• If you see a tempo notation with some other note value, that means that note value is the beat.

If

• T is the tempo in beats per minute
• N is the time signature numerator
• D is the time signature denominator
• V is the note value of the beat (1/2 for half note, 1/4 for quarter note, 1/16 for sixteenth note, 3/4 for dotted half note, 3/8 for dotted quarter note, and so on)

then

• ` 1 / T` is the duration of a beat in minutes
• ` 60 × 1 / T` is the duration of a beat in seconds
• `1000 × 60 × 1 / T` is the duration of a beat in milliseconds (A)

and

• ` (N / D)` is the length of a measure in whole notes
• `(1 / V) × (N / D)` is the length of a measure in beats (B)

The duration of a measure in milliseconds is A × B:

• `(1000 × 60 × 1 / T) × (1 / V) × (N / D)`

which can be re-arranged to

• `(1 / V) × (60000 × N / D) / T`

The first thing you need to work out is the Multiplier of the tempo unit in terms of quarter notes - i.e. a quarter note is 1, an eighth note is 0.5, dotted quarter is 1.5.

so, the length of a bar is

(60/Tempo) x (timeSigUpper/timeSigLower) x (4/Multiplier)

examples

4=120, ts 4/4 is 0.5 x 1 x 4 = 2 seconds 8=120, ts 7/8 is 0.5 x 0.875 x 2 = 875 ms 4.=30, ts 12/8 is 2 x 1.5 x 2.666 = 8 seconds