0

I'm newbie to AVAudioEngine. My task is quite simple: I want to get sound from microphone, change it's pitch and save to file or just play result.

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 

ERROR: >avae> AVAudioEngineGraph.mm:685: InitializeActiveNodesInInputChain: required condition is false: false == isInputConnToConverter

Can anybody help? thanks.

2 Answers2

1

I found workaround: instead of connecting inputNode to pitch node I just install tap on it and play buffer with AVAudioPlayerNode in it's callback block

0

AVAudioUnitTimePitch(AVAudioUnitTimeEffect) is not supports for real time audio. You should save original audio data and use another engine with AVAudioUnitTimePitch for playing.

woosiki
  • 91
  • 6