令人惊叹的音频引擎如何将滤波器应用于麦克风输入

use*_*790 7 audio-recording audiounit ios

我试图制作卡拉OK应用程序,记录文件和麦克风的背景音乐.我还想为麦克风输入添加滤镜效果.

我可以使用惊人的音频引擎sdk完成上述所有事情,但我无法弄清楚如何将麦克风输入添加为频道,以便我可以应用滤镜(而不是背景音乐.)

任何帮助,将不胜感激.

我目前的录音代码:

- (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];
}
Run Code Online (Sandbox Code Playgroud)

Kar*_*run 0

self.reverb = [[[AEAudioUnitFilter alloc] initWithComponentDescription:AEAudioComponentDescriptionMake(kAudioUnitManufacturer_Apple, kAudioUnitType_Effect, kAudioUnitSubType_Reverb2) audioController:_audioController error:NULL] autorelease];

AudioUnitSetParameter(_reverb.audioUnit, kReverb2Param_DryWetMix, kAudioUnitScope_Global, 0, 100.f, 0);

[_audioController addFilter:_reverb];
Run Code Online (Sandbox Code Playgroud)

您可以在播放录制的音频时应用过滤器。