保存和访问录音

发布于 2024-11-26 19:05:37 字数 255 浏览 7 评论 0原文

好吧,我对 Objective-C 有点陌生。我使用 AVAudioRecorder 设置了录音机。效果很好。但是......我不知道如何访问保存的文件,我什至不知道它们是否被保存。该程序至少暂时将它们保存到名称“sounds.caf”下的 NSDocumentsDirectory 中。我想知道这些是否被永久保存,如果没有,那么我怎样才能做到这一点。然后我如何在保存它们后访问它们。感谢您的帮助。

另外,作为旁注,我想知道是否可以组合两个声音文件并将它们一起录制到一个新文件中。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

兰花执着 2024-12-03 19:05:37

您可以使用下面的代码来保存音频文件。

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

}

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;

}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文