Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c AVAudioEngine准备过程中出错_Objective C_Avaudioengine - Fatal编程技术网

Objective c AVAudioEngine准备过程中出错

Objective c AVAudioEngine准备过程中出错,objective-c,avaudioengine,Objective C,Avaudioengine,我是AVAudioEngine的新手。 我的任务很简单:我想从麦克风中获取声音,改变它的音调并保存到文件中,或者只是播放结果 self.engine = [[AVAudioEngine alloc] init]; self.pitchNode = [[AVAudioUnitTimePitch alloc] init]; self.recordNode = self.engine.inputNode; [self.engine attachNode:self.pitchNode]; AVAud

我是AVAudioEngine的新手。 我的任务很简单:我想从麦克风中获取声音,改变它的音调并保存到文件中,或者只是播放结果

self.engine = [[AVAudioEngine alloc] init];
self.pitchNode = [[AVAudioUnitTimePitch alloc] init];
self.recordNode = self.engine.inputNode;

[self.engine attachNode:self.pitchNode];

AVAudioFormat *fmt = [self.recordNode inputFormatForBus:0];

[self.engine connect:self.recordNode to:self.pitchNode format:fmt];
[self.engine connect:self.pitchNode to:self.engine.mainMixerNode fromBus:0 toBus:1 format:fmt];
[self.engine connect:self.engine.mainMixerNode to:self.engine.outputNode format:fmt];
 [self.engine prepare]; // at this line i got error message 
错误:>avae>AVAudioEngineGraph.mm:685:InitializeActiveNodesInInputChain:所需条件为false:false==isInputConnToConverter


有人能帮忙吗?谢谢。

我找到了解决方法:我没有将inputNode连接到pitch节点,而是在其回调块中安装tap并播放带有AVAudioPlayerNode的缓冲区。

AVAudioUnitTimePitch(AVAudioUnitTimeEffect)不支持实时音频。您应该保存原始音频数据,并使用另一个带有AVAudioUnitTimePitch的引擎进行播放。

您可以在此处发布您使用的工作代码吗?