-1

I'm using EZAudio FFT to analyze audio as the iPhone "hears" it. I am listening for high-pitched sounds embedded into music (17 kHz+). When the iPhone hears the sounds with no music, it records the data perfectly and hears the pitch fine. However, when music is playing the sounds are no longer heard--or only 1 in about 8 are heard. Again, I am using EZAudio, to analyze the sound. I have an Android phone that has a similar app on it (displays an graph of Hz for incoming audio waves), but the Android phone can hear these sounds.

Why would the Android phone hear these high-pitched sounds but not the iPhone? Is it because of a flaw in EZAudio or is it due to a higher quality microphone?

Jameson
  • 4,198
  • 4
  • 17
  • 31
  • Most consumer-grade mics have a very poor frequency response above about 15 kHz. – Paul R Aug 05 '15 at 16:33
  • Well it can hear the pitch fine, just not well over loud music. Yet the android can. Is there anything I can do to fix this, you think? – Jameson Aug 05 '15 at 16:35
  • You need to identify the problem first - e.g. it's possible that here is AGC on the analogue input and the presence of music causes the level of the tone of interest to drop. Try capturing some buffers and do some off-line analysis with e.g. MATLAB or Octave. – Paul R Aug 05 '15 at 16:38

1 Answers1

3

The answer is most likely answer is Automatic Gain Control (AGC). This is enabled by default on the microphone, and is useful for telephony or voice recording.

At 17kHz, you're probably already at a frequency at which the microphone is not particularly sensitive, however, in the absence of audio at other frequencies, the AGC will have increase the gain of the microphone. As soon as other frequencies are present, the gain reduces again, and the 17kHz signal is in the noise.

Looking at the EZAudioFFT source code, it doesn't appear to be setting up the AVAUdioSession to use measurement-mode (which disables AGC, and the HPF on the microphone).

You can achieve this with:

NSError *pError = nil;
[[AVAudioSession sharedInstance] setMode:AVAudioSessionModeMeasurement];
marko
  • 9,029
  • 4
  • 30
  • 46