objective c - how to change the pitch of recorded audio getting me following error -


terminating app due uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition false: node != nil'

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. default value 1.0. range of values -2400 2400 autimepitch.rate = 2.0; //the default value 1.0. range of supported values 1/32 32.0.  //get error in 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]; 

try starting engine first before calling play:

[self.engine startandreturnerror:nil]; [playernode play]; 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -