Using exponent for note to pitch conversion

Hi, I’ve noticed over the years that exp() is still faster than pow().
So in getMidiNoteInHertz I replace:

return frequencyOfA * std::pow (2.0, (noteNumber - 69) / 12.0)

with

return frequencyOfA * std::exp((noteNumber - 69)* 0.057762265046662153);

Where the constant is log(pow(2.0,(1.0/12.0)))
Useful if you’re changing pitch every sample and you need the speed.

8 Likes