views:

1029

answers:

1

Hi

I am using the AVAudioRecorder class to record to a wav file. I would like to implement a recording feedback (like the SpeakHere example) which shows the recording level.

I did go through the SpeakHere sample but could not understand how the recording level was changed. Can someone please guide me as to what needs to be done?

Thanks.

A: 

If you are using AVAudioRecorder, you might want to just use the following to get the power levels:

- (float)peakPowerForChannel:(NSUInteger)channelNumber
- (void)updateMeters

Those give you the values to graph. There are simpler ways to graph those values, but to see how the SpeakHere sample does it, see their README:

AQLevelMeter.h
AQLevelMeter.mm

The AQLevelMeter class defines the level meter view for the applcation, displaying the metering data from an AudioQueue object

LevelMeter.h
LevelMeter.m

LevelMeter is a base metering class, providing simple functionality for displaying level data

GLLevelMeter.h
GLLevelMeter.m

GLLevelMeter is a subclass of LevelMeter that uses OpenGL for drawing

AQRecorder.h
AQRecorder.m
mahboudz
But using these would just get me the values. How exactly does SpeakHere use Core Animation to show the recording level bars? Thanks.
lostInTransit
And what is the simpler way? Can you also please include that!
lostInTransit
The simplest way it to use have eleven different png's and use them, one for each level from 0-10 to represent the level. Then there is UIProgressBar. And if you wanted to have something that can show you the max level at the same time as the current level, then you could use one png for the background, and one png for a bar, and draw the bar a few times to show the level, and leave the highest bar on for a few seconds for a max, and fade it out later. YOu can have a red bar in addition to a green bar to signify values over a limit.
mahboudz