我正在尝试制作卡拉 OK 应用程序来录制来自文件和麦克风的背景音乐。 我还想为麦克风输入添加滤波器效果。
我可以使用令人惊叹的音频引擎 sdk 完成上述所有操作,但我无法弄清楚如何将麦克风输入添加为 channel ,以便我可以对其应用过滤器(而不是背景音乐。)
如有任何帮助,我们将不胜感激。
我目前的录音代码:
- (void)beginRecording {
// Init recorder
self.recorder = [[AERecorder alloc] initWithAudioController:_audioController];
NSString *documentsFolder = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)
objectAtIndex:0];
NSString *filePath = [documentsFolder stringByAppendingPathComponent:@"Recording.aiff"];
// Start the recording process
NSError *error = NULL;
if ( ![_recorder beginRecordingToFileAtPath:filePath
fileType:kAudioFileAIFFType
error:&error] ) {
// Report error
return;
}
// Receive both audio input and audio output. Note that if you're using
// AEPlaythroughChannel, mentioned above, you may not need to receive the input again.
[_audioController addInputReceiver:_recorder];
[_audioController addOutputReceiver:_recorder];
}
最佳答案
您可以通过使用不同的 channel 将您的背景音乐和麦克风分开,然后您可以仅将过滤器应用于您的麦克风 channel 。
首先在头文件中声明一个 channel 组
AEChannelGroupRef _group;
然后只需将您用于录制文件的播放器添加到该组
[_audioController addChannels:@[_player] toChannelGroup:_group ];
然后仅将过滤器添加到该组
[_audioController addFilter:_reverb toChannelGroup:_group];
关于ios - 惊人的音频引擎如何将过滤器应用于麦克风输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16752781/