Equalizer from audio data

2019-05-21 17:41发布

问题:

I have a mp3 file, so I need to play it, and display an equalizer (like in attached image).
So playing is not problem, but I have no idea how to measure power of current playing sample's dBs based on frequency.

By which steps I can get data for displaying dBs of current sample?
As I guess, I need to get some array of powers in different frequencies, am I right?

Here is examples of what I want to achieve:
https://www.youtube.com/watch?v=7oeb-OIOe-0
https://www.youtube.com/watch?v=PwmUhTDr0Y0

回答1:

The standard way to transform from time domain to frequency domain is a Fourier Transform.

Apple provide one in vDSP (vector Digital Signal Processing).

Walkthrough using this library here. Another example (for bats!) here.

By the way, I wouldn't call this an equalizer - to me that would be something that alters the relative components of a waveform in different frequency bands.