Tempo to beat length in ms - weird output..
Hey all,
Firstly, as this is my first post, l'm Paul, i'm new here and to MAX/MSP. I'm at university doing a degree in Music and Audio Technology.
Trying to build a step sequencer in MAX 7 and i've got it working but wanted to add a user adjustable tempo dial which calculates the beat length in ms.
The basic calc is:
(60 / tempo) * 1000
...so, say the tempo is 120, the output should 500.
In the attached patch, the output is only ever 0 or 1000 (dependant on what the tempo is selected).
Any ideas what i might be missing? :)
Paul
Paul, you're doing W-A-Y better than I did when I started! I haven't woken up yet, so I re-arranged your patch a bit for the benefit of my sleepy brain - hope you don't mind, and I hope this is what you actually wanted.
There's a really neat thing in Max that you apparently haven't found yet - copy the following hieroglyphics to the clipboard, then in Max's file menu choose New From Clipboard. To make the hieroglyphics choose Copy Compressed from the Edit menu.
Hey Bill, thank you so much for that.
Sorry I've literally only just seen your response as the link to this thread still says my topic needs approval (as it was my first thread) - it was only when i clicked on my profile that i saw it was live.
I can see how you've simplified the patch but for my learning and reference, I presume the !/ means the inverse of the division?
Again, thank you so much..
Paul
so it's
tempo = 60000. / input
my guess is you might need the 60000 (not 60000 / input) or it does integer divide and you get the rounded number I didn't look at the patch.
@Paul: Yep, [!/ 60000.] = 60000. divided by the left input, so it's the same as the formula you gave: (60 / tempo) * 1000, but all in one object. (There are a few objects that use "!" to reverse things, can remember which ones they are.)
@Venetian: Max apparently doesn't round - it truncates. I used [!/ 60000.] in the patch because [metro] does receive floats as its tempo input. I don't know whether it rounds or truncates the float tempo input, or whether it can run at tempos that include fractions of a millisecond.