2011-04-09 89 views
2

我想在我的iPhone应用程序中录制音频,并且一旦录制了音频,我想要打开一个对话框来询问文件名。如何通过iPhone应用程序录制音频?

然后我想用该文件名将音频保存到我的应用程序中。我该怎么做?

+0

我已经在这里添加完整的答案http://stackoverflow.com/qu estions/1010343 /怎么办,我记录音频-ON-iphone与 - avaudiorecorder – swiftBoy 2015-02-02 11:46:45

回答

2

看看苹果公司的SpeakHere示例应用程序,可以在他们的iOS开发者网站上找到。

4

尝试使用AVAudioPlayer和AVAudioRecorder类音频录音和playback.Initially你必须建立一个音频会话使用AVAudio会话类

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]; 

然后初始化录像机和播放机类......希望这有助于

相关问题