I have an interesting music math problem that I'm trying to solve.
I have a tempo map, drawn with straight line segments on a Cartesian plane where the X axis represents time (say, minutes) and the Y axis represents tempo (say, beats per minute). The tempo varies over the length of the song.
Example. Suppose a part of the map says that at 1.00min, the tempo is 60bpm, and that from there it rises linearly so that at 1.10min, the tempo is 120bpm.
Okay: now, what I have to do is mark off beats. Suppose I know that a beat begins at exactly 1.00min. What time is exactly one beat after that? Exactly two beats? (The tempo is increasing, you see.)
Since the X units are minutes, and the Y units are beats per minute, the units of the area under the "curve" are beat-minutes per minute, or just beats. So I need to determine the X value at the point where the area under the curve and to the left of the X value equals the number of beats I'm after.
So far, I've derived an equation for the area under the "curve" (in terms of the X value I want to find) by dividing it into a rectangle and a triangle, and adding them together. (The area under the curve, of course, is a right trapezoid turned on its side.) Then I've solved the equation for the X value I want.
However, because of the interpolation necessary to include the area of the triangle, I end up with a nasty-looking quadratic equation that simplifies to an only slightly less nasty-looking expression using the Quadratic Formula. (So far I've done it several times, and I've only gotten the same expression twice: apparently my algebra isn't everything it used to be.) In general, this expression has two real roots, with one of them being negative...meaning it's not the one I want. However, the one I do want is wrong.
For instance, in the example above, in the six seconds between x=1.00 and x=1.10 there are exactly nine beats; however, if I ask my expression to give me the time value that's nine beats after x=1.00, I get something significantly less than 1.10 that is not related to it in any clear way.
How would you approach the problem?
Last edited by Barak; 06/19/07. Reason: add reference to Quadratic Formula
"But whether the Constitution really be one thing, or another, this much is certain--that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist." --Lysander Spooner, 1867
If there were bicubic curves between the tempo values, okay, that'd be tougher...but hey!
"But whether the Constitution really be one thing, or another, this much is certain--that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist." --Lysander Spooner, 1867
It looks like what you're trying to calculate is acceleration - some web searching based on that term should provide the calculations you need. If you're still stuck this evening I'll take a whack at it.
Forgive me my nonsense, as I also forgive the nonsense of those that think they talk sense. Robert Frost
Sort of like finding the time of a throw objects height location. You have to get to the point where you know the height location and then reconfigure and then solve the equation where time is the only unknown.
You know the acceleration, which is linear. You integrate once and you get the beat velocity as a function of time. AT this point you would plug in the boundary conditions, the beginning and ending beat velocities. Then you can solve for the integration constants. Then you integrate again and get beats as a function of time. Then you would solve for the location of each individual beat.
I think. Been a while since I did any old fashioned ODEs.
Will
Last edited by Penguin; 06/19/07. Reason: Screwed up
What you've got is the equivalent to a linear motion problem with constant acceleration. Like the dropped apple in physics you plot the position of it using
x = x0 + v0*t + 0.5*a*t^2
x is the current position (in your case the beat number) x0 is the initial position (the first beat) v0 is the initial velocity (1 beat per second) a is the acceleration (dv/dt = 1/6 beats per sec^2) t is the time
So, for your example you've got 0.1 min = 6 sec for the total time, let x0=1 (for beat #1), v0=1 and therefore after 6 seconds you'd have
x-x0 = 1 * 6 + 0.5 * (1/6) * 6^2 x-x0 = 9 beats
You can then just substitute in the appropriate number of beats for x in the equation and you'll get a quadratic equation to solve that should give you the time duration (from start) to get to the nth beat.
Best of luck. But wait; call your closest university and ask for the math dept. There should be a professor who can help. If not, you know where NOT to send your kids...
Ex- USN (SS) '66-'69 Pro-Constitution. LET'S GO BRANDON!!!
Wannatikka must have his mechanics books right by his workstation. He was right on top of this one. Worst thing is though he is an old timer around here. He ought to know this was a good occasion to get in a little good natured ribbing on Barak.
Integrals ain't that hard. He'd have got the right equations eventually but now we don't get to watch him scratch his head once or twice. You're right about getting rusty though. When I took my qualifiers I could derive the Navier-Stokes equations from scratch in just a few minutes. Man that seems like a lifetime ago. Pride wouldn't let me attempt it now.
Drat! You're right, I missed a golden opportunity to have some fun at keeping Barak scratching his head. My bad, and I'll try to not let it happen again.
Regarding the equation, that one just was floating around in my head back from undergrad physics ... what? 22 years ago? I've been accused of having way too much diverse & esoteric information floating around inside the old noggin'. I figure it's good insurance in case I ever end up as the life-line call on a game show.
Funny you should mention N-S equations too. I spent a whole bunch of time using the general form eq. of motion for polymeric flows back in my research/disseration. I too doubt I could derive that one today without a handful of 'trial run' force balances. (of course I'd be too lazy and that one I would just go to Bird's book)
Aha! I knew they got those game show answer guys from somewhere. Now we know.
Bird, Stewart, and Lightfoot. You must have went to school at Madison. I think it is a right of passage for anyone majoring in engineering to have to purchase that book. I still have mine. There is another poster here, Cacciatore, who along with me went to school there. We'll have the SEC guys outnumbered when football season starts.
Yup, Badger red here. Good to hear there's more of us around here, though Steelhead is pretty tough to compete with when he's toutin' his gators. I'm hopin' this year I don't have to see Albert at any national championship games.
BSL is pretty much a required reference in my field (ME with ChemE minor) as well as Bird Armstrong & Hassager for polymeric flow. I still have both sitting around the office somewhere.