I want to make music in computer programming language. but I don't know how to calculate music sheet symbols duration by attention to tempo and time signature.

I was confused about that because everyone explains that in a different way.

It's not important that what your way is, I just hope it isn't software dependent.

Note: I use the midi file to save my data and use the javascript library for reading and writing in the midi file.


3 Answers 3


Tempo is a type of frequency.
A tempo mark indicates the note value of a beat, and the number of beats that occur per minute (BPM).

Duration (time) is the inverse of frequency.
So you just have to take the inverse of the tempo to find the duration of a beat.
(But, I imagine you will want to measure the duration in seconds rather than in minutes, so you will have to convert the units.)

Simple Example

If the tempo mark is a quarter-note = 120, this means that the duration per beat will be:
1 / 120 BPM
= 1 minuet / 120 beats [ x 60 seconds / minute ]
= 0.5 seconds / beat

The total duration of a bar of 3/4 (3 beats per bar, each with the value of a quarter-note) will be:
3 beats x 0.5 seconds / beat
= 1.5 seconds

whereas the total duration of a bar of 4/4 will be:
4 beats x 0.5 seconds / beat
= 2 seconds

Compound Example

If the tempo mark is a dotted-quarter-note = 60, the duration per beat will be:
1 / 60 BPM
= 1 minuet / 60 beats
= 1 seconds / beat

The total duration of a bar of 6/8 (6 pulses per bar, each with the value of an eighth-note, AKA 2 beats per bar, each with the value of a dotted-quarter-note) will be:
2 beats x 1 seconds / beat
= 2 seconds

Sometimes the tempo mark of a compound time signature indicates the note value of a pulse (instead of a beat), and the number of pulses that occur per minute (PPM).

If the tempo mark is an eighth-note = 180, the duration per pulse will be:
1 / 180 PPM
= 1 minuet / 180 pulses
= (1/3) seconds / pulse

The duration of a bar of 6/8 will be:
6 pulses x 1/3 seconds / pulse
= 2 seconds

  • I think this is not helping me but your answer is in this link is wonderful. but i was very confused that how you chose the Number of bars in this formula "time in seconds" = 60 x "upper number of simple time signature" x "bars" / "BPM" can I choose Any number I want for bars?
    – asmanp2012
    Dec 14, 2021 at 5:26
  • @asmanp2012 That question was about the duration of a bar. I made the number of bars a variable, at first I called this variable "bars", then that I later called it "N". If you want to calculate the duration of just 1 bar, then "N" = 1. But if you want to find the duration of more than just one bar, then "N" is whatever number of bars you want. Dec 14, 2021 at 5:40
  • For example if you piece of music is in 4/4, at a BPM of 120, then one bar will be have a duration of: 60 x 4 x 1 / 120 = 2 seconds. If the piece is 24 bars long, then the whole piece will have a duration of: 60 x 4 x 24 / 120 = 48 seconds Dec 14, 2021 at 5:50

It's software dependent :) . More exactly, the timing in a Midi file is measured in MIDI ticks, and the header defines how many MIDI ticks make up a MIDI quarternote (unless it declares the use of SMPTE time codes for the MIDI timing).

When MIDI events refer to a duration, that is usually done in terms of MIDI clocks, with 24 MIDI clocks to a MIDI quarternote and the musical size of a MIDI quarternote established with Time Signature meta events (in terms of notated 32nd notes per MIDI quarternote, so typically 8) while the timing is established with Set Tempo meta events (in microseconds per MIDI quarternote).

  • I know about tik and use that. but I don't know how many beat is on the 3/4 or 6/8 time signature in the same tempo. @user83206
    – asmanp2012
    Nov 25, 2021 at 17:40

I figure out that. It's not important how long a beat and beat duration depend on the tempo and don't change with the time signature.

for calculating music sheet symbols we should attention to the denominator.

denominator equivalent to whole note. for example:

  1. if the denominator was 6 then whole note equivalent 6 beat.
  2. if the denominator was 4 then whole note equivalent 4 beat.
  • The number at the bottom of a time signature (denominator) is only every going to be a power of 2 (i.e. 2, 4, 8, 16, ...). Do you mean the numerator? Jan 21, 2022 at 21:16
  • exactly I referer to the denominator. because the denominator, Specifies the whole note have how many beats. I use that and, it's working on all DWA software. @ElementsinSpace
    – asmanp2012
    Jan 22, 2022 at 1:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.