2

I want to record audio in my iPhone app and once the audio is recorded I want a dialog box to open which asks for the filename.

And then I want to save the audio with that filename into my app. How can I do so?

halfer
  • 19,824
  • 17
  • 99
  • 186
Parth Bhatt
  • 19,381
  • 28
  • 133
  • 216
  • i have added complete answer here http://stackoverflow.com/questions/1010343/how-do-i-record-audio-on-iphone-with-avaudiorecorder – swiftBoy Feb 02 '15 at 11:46

3 Answers3

4

try using AVAudioPlayer and AVAudioRecorder classes for audio recording and playback.Initially you have to establish an audio session using AVAudio session class

AVAudioSession *audioS =[AVAudioSession sharedInstance];
[audioS setCategory:AVAudioSessionCategoryPlayAndRecord error:&error];
[audioS setActive:YES error:&error];

NSURL *url = [NSURL fileURLWithPath:@"/dev/null"];

NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat: 44100.0],AVSampleRateKey,
[NSNumber numberWithInt: kAudioFormatAppleLossless], AVFormatIDKey,
[NSNumber numberWithInt: 2],AVNumberOfChannelsKey,[NSNumber numberWithInt: AVAudioQualityMax],         AVEncoderAudioQualityKey,
                          nil];

and then initialize the recorder and player classes...Hope this helps

hardik hadwani
  • 556
  • 6
  • 24
shantrip
  • 41
  • 1
2

Look at Apple's SpeakHere sample app, available on their iOS developer site.

hotpaw2
  • 70,107
  • 14
  • 90
  • 153
2

you can see this question How do I record audio on iPhone with AVAudioRecorder? , which is pretty similar to your question or watch this sample code from apple http://developer.apple.com/library/ios/#samplecode/SpeakHere/Introduction/Intro.html

Community
  • 1
  • 1
Abdullah Md. Zubair
  • 3,312
  • 2
  • 30
  • 39