我正在使用QTKit进行录制和播放,但是当我记录产生的文件有很多噪音(空气压力)时。
我使用
QTCaptureDevice *audioDevice = [QTCaptureDevice defaultInputDeviceWithMediaType:QTMediaTypeSound];
和捕获会话
captureSession = [[QTCaptureSession alloc] init];
这些
QTCaptureDecompressedAudioOutput *captureAudioDataOutput;
AudioUnit effectAudioUnit;
ExtAudioFileRef extAudioFile;
AudioStreamBasicDescription currentInputASBD;
AudioBufferList *currentInputAudioBufferList;
还有这些行(可能是噪声的原因)
/* 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 = 0;
effectAudioUnitComponentDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
effectAudioUnitComponentDescription.componentFlags = 0;
effectAudioUnitComponentDescription.componentFlagsMask = 0;
谁来帮帮我
如果设置正确,应该不会收到任何噪音。基本上,您根本不需要设置音频设备。你需要买一个并使用它。系统中可用音频设备的列表可以从QTCaptureDevice类获得:
[QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeSound]
选择你需要的,并得到它的音频输入:
[STCaptureDeviceInput captureDeviceInputWithDevice:audioDevice type:STCaptureDeviceAudio]
在录制之前将输入设置为捕获会话:
[_captureSession addInput:captureAudioDeviceInput error:&error]