24 float p = float(midiPitch) + (centsOffset / 100);
25 return concertA * powf(2.0, (p - 69.0) / 12.0);
30 float *centsOffsetReturn,
33 float p = 12.0 * (log(frequency / (concertA / 2.0)) / log(2.0)) + 57.0;
35 int midiPitch = int(p + 0.00001);
36 float centsOffset = (p - midiPitch) * 100.0;
38 if (centsOffset >= 50.0) {
39 midiPitch = midiPitch + 1;
40 centsOffset = -(100.0 - centsOffset);
43 if (centsOffsetReturn) *centsOffsetReturn = centsOffset;
static float getFrequencyForPitch(int midiPitch, float centsOffset=0, float concertA=440.0)
static int getPitchForFrequency(float frequency, float *centsOffsetReturn=0, float concertA=440.0)