Forums > MaxMSP

Pitch shift formula

May 10, 2013 | 12:35 pm

Hi.
At this moment i’m working on calculator patch which will allow to work with different values. But i can’t figure it out how to calculate an amount of pitch shift in percentage and st required to change tempo of loops from "BPM1" to "BPM2".
A this moment i have something like this:
Percentage value of pitch shift = ((BPM1 – BPM2)/BPM2)*100
And to translate % to St, i’m just dividing %/0.12
But it is totaly wrong… And i can’t even understand where i’m wrong…

– Pasted Max Patch, click to expand. –

May 10, 2013 | 1:14 pm

Have you tried looking at the help files for mtof and/or ftom? They include equivalent expr formulae for converting frequency to "pitch" (in terms of MIDI notes). There’s still a bit of work to go from your "percentage of pitch shift" to pitch, but this should put you on the right path.


May 10, 2013 | 2:17 pm

Oh, thanks.
I forgot about such a nice objects. That’s realy made my calculations easear.

But i’ve already found a little problem: mtof working just with integer values of semitones, which makes calculations not so accurate as if it were calculated with cent values…
Here is what i get just for Semitone values:

– Pasted Max Patch, click to expand. –

May 10, 2013 | 2:22 pm

presto, floating point:

– Pasted Max Patch, click to expand. –

May 10, 2013 | 2:31 pm

Thanks. =)
It’s so hard to be noob =((


May 10, 2013 | 3:09 pm

the 0. thing is true for most objects, and even long time users sometimes run into this trap. :)

also, in dont think [mtof] will be of much help when you want "cents" as a result.
the conversion from playspeed to midi note numbers has nothing to do with frequency (in Hertz), you can calculate that the direct way from BPM to cent offset much easier.
you´d just have to define the original playspeed and the original key as default, then do some simple math to convert changed values for the BPM setting to new note numbers/cents (dont know offhand now)


May 17, 2013 | 4:38 am

Here is what i made.

http://www.maxforlive.com/library/device/1665/sick-calculation-tools


Viewing 7 posts - 1 through 7 (of 7 total)