I need to implement audio recording feature in my mac app.i am using the Apple sample
http://developer.apple.com/library/mac/#samplecode/AudioDataOutputToAudioUnit/Listings/main_m.html. Everything is working fine .The only issue is that the audio file created is echoing while playing.Please help!Later I checked, Apple sample also has the same problem
From the description of the sample code:
The built application uses a QTCaptureSession with a QTCaptureDecompressedAudioOutput to capture audio from the default system input device, applies an effect to that audio using a simple effect AudioUnit, and writes the modified audio to a file using the CoreAudio ExtAudioFile API.
From CaptureSessionController.m:
/* Create an effect audio unit to add an effect to the audio before it is written to a file. */
OSStatus err = noErr;
AudioComponentDescription effectAudioUnitComponentDescription;
effectAudioUnitComponentDescription.componentType = kAudioUnitType_Effect;
effectAudioUnitComponentDescription.componentSubType = kAudioUnitSubType_Delay;
It looks like this delay is intentional, as part of the demo.
Well I found the answer myself.Just need to comment
effectAudioUnitComponentDescription.componentSubType = kAudioUnitSubType_Delay;
From CaptureSessionController.m: