gpt4 book ai didi

ios - 惊人的音频引擎如何将过滤器应用于麦克风输入

转载 作者:可可西里 更新时间:2023-11-01 03:33:09 25 4
gpt4 key购买 nike

我正在尝试制作卡拉 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com