2013-05-25 23 views
7

我試着做卡拉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]; 
} 
+1

你有沒有解決這個問題?我仍然面臨同樣的問題。 – Colin

回答

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

您可以在播放錄製的音頻時應用過濾器。

3

可以分開你的你的背景音樂,並通過不同的渠道你的麥克風,然後你可以過濾器只適用於您的麥克風通道。

在頭文件首先聲明一個信道組

AEChannelGroupRef _group; 

然後簡單地添加要使用記錄文件到該組

[_audioController addChannels:@[_player] toChannelGroup:_group ]; 

,然後將過濾器添加到該組玩家只有

[_audioController addFilter:_reverb toChannelGroup:_group]; 
+0

這很好,但你也應該描述如何去做。 –

+0

亞歷山大,請給予好評我的答案,如果你認爲它有用。 –

相關問題