[英]How to save a recorded audio with reverb effect
I am using theamazingaudioengine for recording, playing and adding effects like reverb for an iOS app. 我正在使用theamazingaudioengine来录制,播放和添加iOS应用程序的混响之类的效果。 I can record, play the recorded audio along with the reverb effect. 我可以录制,播放录制的音频以及混响效果。 But I am unable to save audio file with the reverb effect to the gallery. 但是我无法将带有混响效果的音频文件保存到图库中。 Can any one please help me with this. 谁能帮我这个忙。
I am saving the recorded audio like this. 我这样保存录制的音频。
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
NSArray *documentsFolders = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = [[documentsFolders objectAtIndex:0] stringByAppendingPathComponent:@"Recording.aiff"];
[library writeVideoAtPathToSavedPhotosAlbum:[NSURL URLWithString:path] completionBlock:^(NSURL *assetURL, NSError *error){
/*notify of completion*/
NSLog(@"AssetURL: %@",assetURL);
NSLog(@"Error: %@",error);
if (!error) {
//video saved
[[self appDelegate] showAlertWithTitle:@"Audio Saved" message:@""];
}
else{
[[self appDelegate] showAlertWithTitle:@"Error" message:error.domain];
}
}];
Thanks in advance! 提前致谢!
The AEAudioFileWriter
class allows you to easily write to any audio file format supported by the system. AEAudioFileWriter
类使您可以轻松地写入系统支持的任何音频文件格式。
To use it, instantiate it using initWithAudioDescription:
, passing in the audio format you wish to use. 要使用它,请使用initWithAudioDescription:
实例化它,并传入您要使用的音频格式。 Then, begin the operation by calling beginWritingToFileAtPath:fileType:error:
, passing in the path to the file you'd like to record to, and the file type to use. 然后,通过调用beginWritingToFileAtPath:fileType:error:
开始操作,传入要记录到的文件的路径以及要使用的文件类型。 Common file types include kAudioFileAIFFType
, kAudioFileWAVEType
, kAudioFileM4AType
(using AAC audio encoding), and kAudioFileCAFType
. 常见的文件类型包括kAudioFileAIFFType
, kAudioFileWAVEType
, kAudioFileM4AType
(使用AAC音频编码)和kAudioFileCAFType
。
Once the write operation has started, you use the C functions AEAudioFileWriterAddAudio
and AEAudioFileWriterAddAudioSynchronously
to write audio to the file. 一旦开始写操作,就可以使用C函数AEAudioFileWriterAddAudio
和AEAudioFileWriterAddAudioSynchronously
将音频写入文件。 Note that you should only use AEAudioFileWriterAddAudio
when writing audio from the Core Audio thread, as this is done asynchronously in a way that does not hold up the thread. 请注意,从Core Audio线程写入音频时,仅应使用AEAudioFileWriterAddAudio
,因为这是以不占用线程的方式异步进行的。
When you are finished, call finishWriting
to close the file. 完成后,调用finishWriting
关闭文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.