保存和访问录音 [英] Saving and accessing audio recordings

查看:59
本文介绍了保存和访问录音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,这对Objective-C来说是一种新事物.我使用AVAudioRecorder设置了一个录音机.效果很好.但是....我不知道如何访问已保存的文件,哎呀,我什至不知道它们是否被保存了.该程序至少暂时将它们保存在NSDocumentsDirectory下,名称为"sounds.caf".我想知道是否将这些永久保存,否则如何保存.保存之后,我该如何访问它们.谢谢您的帮助.

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.

作为旁注id,我想知道是否可以合并两个声音文件并将它们记录到一个新文件中.

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.

推荐答案

您可以使用以下代码保存音频文件.

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;

}

这篇关于保存和访问录音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆