2

Keeping it simple for now but assuming i have a ByteArray full of sample data is it possible to calculate the average frequency (thus a pitch) from the entire recording?

Is this along the right lines? p = 69 + 12 x log2(f/440hz) ...

Excuse my ignorance

Defocalize
  • 21
  • 1
  • 1
    Duplicate: http://stackoverflow.com/questions/6283104/pitch-detection-with-computespectrum-return-fft-values – endolith Nov 30 '11 at 14:45

1 Answers1

4

Your formula p = 69 + 12 * log2(f / 440) is for converting a frequency in Hz to a musical note (the MIDI note number). For this though you need f, the frequency of the note in Hz, which is a little trickier to determine. For a pure tone (sinusoid) with no noise it's relatively straightforward, otherwise you'll need to look at using an FFT or other method to identify the frequency of interest.

Paul R
  • 208,748
  • 37
  • 389
  • 560