Шум при записи в приложении Mac - PullRequest
1 голос
/ 23 сентября 2011

Я использую 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;

Пожалуйста, помогите мне.

1 Ответ

0 голосов
/ 17 октября 2011

Вы не должны слышать шум, если настроите его правильно. В принципе вам не нужно настраивать аудиоустройство вообще. Вы должны получить один и использовать его. Список доступных аудиоустройств в вашей системе можно получить из класса QTCaptureDevice:

[QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeSound]

Выберите тот, который вам нужен, и получите для него аудиовход:

[STCaptureDeviceInput captureDeviceInputWithDevice:audioDevice type:STCaptureDeviceAudio]

Установите вход для сеанса захвата перед записью:

[_captureSession addInput:captureAudioDeviceInput error:&error]

Это должно просто сработать.

...