0

I have a note format with beats represented as measure fractions that I want to convert to actual time (seconds).

So given this data:

number, title, measure, position

1 NOTE 2 0.0
2 NOTE 2 0.25
3 NOTE 2 0.5
4 NOTE 2 0.75

5 NOTE 3 0.0
6 NOTE 3 0.25
7 NOTE 3 0.5
8 NOTE 3 0.75

I derived the formula for computing:

# This assumes 4/4 time signature, 4 beats per measure so...
1.) measure duration = (60/bpm) * 4;

2.) note timing (seconds) = measure duration * ( measure + position)

Giving me:

@130 bpm:

measure duration = (60/130) * 4 = 1.8461...

note timing = 1.8461 * ( measure + position)

number, title, measure, position, (seconds)

1 NOTE 2 0.0  ( 1.8461 * (2 + 0.0 ) )
2 NOTE 2 0.25 ( 1.8461 * (2 + 0.25) )
3 NOTE 2 0.5  ( 1.8461 * (2 + 0.5 ) )
4 NOTE 2 0.75 ( 1.8461 * (2 + 0.75) )

5 NOTE 3 0.0  (and so on...)
6 NOTE 3 0.25
7 NOTE 3 0.5
8 NOTE 3 0.75

So my question is, how should the succeeding notes' timings be affected if there would be a BPM change after note 2? If the bpm increased to 200, what should be the timings of the next 6 notes?

  • In this format, is the very start of the piece measure 1, or measure 0? And when you say "if there would be a BPM change after note 2", do you mean immediately after note 2, or just before note 3? or somewhere in between? – topo morto Feb 17 '18 at 7:35
  • 2
    Whatever you're trying to sort out, music in 99.9% cases doesn't chop and change its bpm. That's one of the endearing factors - latch on to a rhythm/tempo, and enjoy it. Of course you can write a program that encompasses this, but to me it's a broken pencil - pointless... – Tim Feb 17 '18 at 8:25
  • @Tim, have you never heard pieces that slow down or speed up at the end? They were fairly common when I was practicing piano. – Dekkadeci Feb 17 '18 at 18:56
  • 1
    @Dekkadeci - funnily enough yes. But they never had a change of bpm noted ! It was/is called rubato/accelerando/ deccelerando and we just got on with it... – Tim Feb 17 '18 at 20:22
  • If this is the new music, I'm going to have to go back to school. – skinny peacock Feb 18 '18 at 3:35
1

If you think in terms of algebra, the BPM is like the slope of a line in y = mx + b. Here y = mt + b where y is a beat and t is discrete (quantized) time. For the first BPM, b = 0 because the the slope starts at t = 0. When you change to a new BPM, you need a non-zero y-intercept! That y-intercept will have to stay there forever.

One way you can do it is by including a reference to the last note before the bpm change at t = 2.5.

BPM#1 measure duration = (60/130) * 4 = 1.8461
BPM#2 measure duration = (60/200) * 4 = 1.2

number, title, measure, position, (seconds)

1 NOTE 2 0.0  ( 1.8461 * (2 + 0.0 ) )
2 NOTE 2 0.25 ( 1.8461 * (2 + 0.25) )
3 NOTE 2 0.5  (    1.2 * (0 + 0.0 ) + 1.8461 * (2 + 0.5 ) )
4 NOTE 2 0.75 (    1.2 * (0 + 0.25) + 1.8461 * (2 + 0.5) )

5 NOTE 3 0.0  (    1.2 * (0 + 0.50) + 1.8461 * (2 + 0.5) )
6 NOTE 3 0.25 (    1.2 * (0 + 0.75) + 1.8461 * (2 + 0.5) )
7 NOTE 3 0.5  (    1.2 * (1 + 0.0 ) + 1.8461 * (2 + 0.5) )
8 NOTE 3 0.75 (    1.2 * (1 + 0.25) + 1.8461 * (2 + 0.5) )

Notice how the beat grid changes, starting on measure 0 position 0 for the new bpm. This is like resetting the time axis in algebra, t = 2.5 -> t = 0.0.

To specify the y-intercept without changing the beat grid, there is a way, but we still need to refer to the last note before the BPM changes. Suppose we have two BPM-slopes, a = 1.8461 and b = 1.2, referring to 130 BPM and 200 BPM, respectively. Observe that at = bt + (a-b)t_fixed, where t_fixed is a constant that represents when the bpm was changed. This formula lets us express the new timing of the notes using the same beat grid:

BPM#1 measure duration = (60/130) * 4 = 1.8461
BPM#2 measure duration = (60/200) * 4 = 1.2

number, title, measure, position, (seconds)

1 NOTE 2 0.0  ( 1.8461 * (2 + 0.0 ) )
2 NOTE 2 0.25 ( 1.8461 * (2 + 0.25) )
3 NOTE 2 0.5  (    1.2 * (2 + 0.50) + (1.8461 - 1.2) * (2 + 0.5 ))
4 NOTE 2 0.75 (    1.2 * (2 + 0.75) + (1.8461 - 1.2) * (2 + 0.5) )

5 NOTE 3 0.0  (    1.2 * (3 + 0.0 ) + (1.8461 - 1.2) * (2 + 0.5) )
6 NOTE 3 0.25 (    1.2 * (3 + 0.25) + (1.8461 - 1.2) * (2 + 0.5) )
7 NOTE 3 0.5  (    1.2 * (3 + 0.50) + (1.8461 - 1.2) * (2 + 0.5) )
8 NOTE 3 0.75 (    1.2 * (3 + 0.75) + (1.8461 - 1.2) * (2 + 0.5) )

You should notice that in your system, the values in the parentheses represent attacks or onsets of the notes. The notes have no sustain, so this is like programming a drum machine. So in your system, 'after the end of the second note' means 'after the beginning of the third note'. In MIDI you need to encode when the note ends, too (with "Note Off" events).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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