When I play middle A on my full scale midi piano (using its own sound source) I hear a tone at the same pitch as the one from my tuning fork marked 440Hz.
When I connect the piano to juce synth demo and press the same A-key, the synth demo sounds an octave lower.
A cause for this diskrepancy might be the function
I haven’t looked at the code in question, but Midi Note 69 is A4, which would generally be 440 Hz.
I’m not sure how to express it in text, but you typically get piano notes by multiplying A4 (440Hz) by 12th-root-of-2’s. That appears to be what the second line in the function is effectively doing, but it is shifting from A5 (81), not A4. This might be intentional. I don’t know the context. But if you pass in 880 as the frequency of A (A5), it seems to me it should work.
It’s hardly intentional, while the parameter frequencyOfA acc to the spec is optional and means the freq of normal-A, usually 440-442Hz. The first (second) line of the function ought to read
I remember researching the correct conversion formula when I wrote that, but looking again, it does seem to be wrong, and yes, 69 should equal 440. Odd. Maybe I got my info from a dodgy source…
Well, I guess I should change it, but am slightly afraid that it might mess up people’s synths. Grrr…