Recording audio

A notable feature on most iOS devices is the ability to record audio. In this recipe, we will use the microphone to record audio and save it to a temporary location on the disk using the AVAudioRecorder class. We will then play it back with a modified pitch using the CDSoundEngine class.

Recording audio

Getting ready

Please refer to the project RecipeCollection02 for full working code of this recipe.

How to do it...

Link the CoreAudio and AVFoundation frameworks to your project. Now, execute the following code:

#import <AVFoundation/AVFoundation.h> #import <CoreAudio/CoreAudioTypes.h> #import "CocosDenshion.h" @interface Ch6_RecordingAudio : Recipe <AVAudioRecorderDelegate> ...

Get Cocos2d for iPhone 1 Game Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.