syedhali / EZAudio

An iOS and macOS audio visualization framework built upon Core Audio useful for anyone doing real-time, low-latency audio processing and visualizations.
Other
4.94k stars 822 forks source link

AVAudioRecorder metering #285

Open kajensen opened 8 years ago

kajensen commented 8 years ago

Is there a way to use this library to get the meter (really want [mic averagePowerForChannel:0]) of the microphone input?

dxclancy commented 8 years ago

Hi, I know very little about audio, or this library.

Here is how I am achieving it. I don't know if it is dumb or if there is an easier way, etc...

What I do is i use EZAudioFFT. You can take a look at the sample app that is provided. Essentially, you feed the delegate data from the player or microphone to the FFT. From the FFT delegate you can get float maxFrequencyMagnitude = [fft maxFrequencyMagnitude]; This may be enough to achieve what you want. Again, it may be overkill or the wrong approach, but it is feasible.