Saving and accessing audio recordings

情到浓时终转凉″ 提交于 2019-12-25 01:14:36

问题


Ok so im kind of new to objective-c. I set up an audio recorder using AVAudioRecorder. It works great. but.... i dont know how to access the saved files, heck i dont even know if they get saved. The program is saving them to NSDocumentsDirectory under the name "sounds.caf" at least temporarily. I want to know if these are being permanently saved, if not, then how can i make it so. And then how can i access them after they are saved. Thanks for the help.

Also as a side note id like to know if its possible to combine two sound files and record them together into a new file.


回答1:


You can use below code for saving your audio files.

#define DOCUMENTS_FOLDER [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]
#define DOCUMENTS_FOLDER1 [DOCUMENTS_FOLDER stringByAppendingPathComponent:@"Recordering"]
#define FILEPATH [DOCUMENTS_FOLDER stringByAppendingPathComponent:[self dateString]]


BOOL success = [self.myRecorder startRecording:FILEPATH];

if (!success){

   printf("Error starting recording\n");

   [self.myRecorder stopRecording];

   self.myRecorder = nil;

   isRecording = NO;

   return;

}


来源:https://stackoverflow.com/questions/6849880/saving-and-accessing-audio-recordings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!