如何更改录制音频的音调让我下面的错误

问题描述:

终止应用程序由于未捕获的异常“com.apple.coreaudio.avfaudio”,理由是:“要求的条件是假的!节点=零”如何更改录制音频的音调让我下面的错误

AVAudioFile *file=[[AVAudioFile alloc] initForReading:_recordedvoice error:nil]; 
AVAudioFormat *format=file.processingFormat; 
AVAudioFrameCount capacity= (AVAudioFrameCount)file.length; 
AVAudioPCMBuffer *buffer=[[AVAudioPCMBuffer alloc] initWithPCMFormat:format frameCapacity:capacity]; 
[file readIntoBuffer:buffer error:nil]; 
[playerNode scheduleBuffer:buffer completionHandler:nil]; 

engine = [[AVAudioEngine alloc] init]; 
    playerNode = [[AVAudioPlayerNode alloc] init]; 

[engine attachNode: playerNode]; 

AVAudioMixerNode *mixer = engine.mainMixerNode; 
AVAudioUnitTimePitch *auTimePitch; 
auTimePitch.pitch=1200.0;// In cents. The default value is 1.0. The range of values is -2400 to 2400 
auTimePitch.rate = 2.0; //The default value is 1.0. The range of supported values is 1/32 to 32.0. 

//get the error in the following line 

[engine attachNode: auTimePitch]; 
[engine connect:playerNode to:auTimePitch format:[mixer outputFormatForBus:0]]; 
[engine connect:playerNode to:mixer format:[mixer outputFormatForBus:0]]; 

[playerNode play]; 
+0

可能是完成处理程序的一些内容。看看这个堆栈溢出的答案 - http://stackoverflow.com/a/29630124/5716449 – Ro4ch

+0

即时消息全新的目标ci想要将录制的声音变成不同的声音,如女童等你能帮我... –

+0

检查这个问题出来了。 http://stackoverflow.com/questions/1100495/real-time-pitch-shifting-on-the-iphone这应该可以帮助你完成任务。 – Ro4ch

在打电话前先尝试启动引擎:

[self.engine startAndReturnError:nil]; 
[playerNode play]; 
+0

如何保存这个音高改变了音频? –