Sound bar visualizer in iOS

I am looking for a way to create an audio bar visualizer similar to this in iOS.

enter image description here

Each white bar will move up and down depending on the sound wave. I really got lost because I do not have much experience with audio in Objective-c.

EDIT: what I'm looking for is what the Overcast app does on its visualizer (a group of vertical orange stripes at the bottom of the podcast image)

Can anybody help? Thanks

EDIT: Thanks to Tomer's answer, I finally did it. First I made this tutorial to make everything clear. Then I created my own VisualizerView for my project, you can find it in this essence . It may not be perfect, but it does what I need.

+7
ios objective-c
source share
1 answer

Typically, you have several options if you want to understand something similar to iOS:

  • Use the simple AVAudioPlayer audio player, and then use the [audioPlayer averagePowerForChannel:] method to get the current sound level at the current moment. Check out this tutorial .
  • Use the Audio Queue API , which allows you to send any sound that you want to use for the speaker: you read audio from your source and fill the buffers with it every time. (If you are reading a file, use AVAssetReader ) Thus, you always know exactly what waveform you are playing, so you can, for example, calculate your power or process it in other ways, such as FFT. Then you update the bars accordingly.

EDIT . The standard way to do this is to use Fast Fourier Transform (FFT) - it extracts frequency information from sound. Here is a good example of using it on iOS ( Apple Guide here ). But, of course, in order to use it, you must know exactly what wave you play each time, so you probably want to use a lower-level API, such as Audio Queue.

+7
source share

All Articles