## Pitch shift formula

May 10, 2013 at 12:35pm

# Pitch shift formula

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. –
#68170
May 10, 2013 at 1:14pm

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.

#244748
May 10, 2013 at 2:17pm

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. –
#244749
May 10, 2013 at 2:22pm

presto, floating point:

– Pasted Max Patch, click to expand. –
#244750
May 10, 2013 at 2:31pm

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

#244751
May 10, 2013 at 3:09pm

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)

#244752
May 17, 2013 at 4:38am
#249659

You must be logged in to reply to this topic.