【问题标题】:Is it possible to use kAudioUnitSubType_VoiceProcessingIO without automatic gain control (mode = measurement)是否可以在没有自动增益控制的情况下使用 kAudioUnitSubType_VoiceProcessingIO(模式 = 测量)
【发布时间】:2019-10-07 14:42:57
【问题描述】:

我正在尝试使用kAudioUnitSubType_VoiceProcessingIO 进行信号处理。但我想禁用所有像 AGC 这样的自动巫术。我正在尝试这样做

        [sessionInstance setMode:AVAudioSessionModeMeasurement error:&error];

        AudioComponentDescription desc;
        desc.componentType         = kAudioUnitType_Output;
        desc.componentSubType      = kAudioUnitSubType_VoiceProcessingIO;
        desc.componentManufacturer = kAudioUnitManufacturer_Apple;
        desc.componentFlags        = 0;
        desc.componentFlagsMask    = 0;

但是当我记录会话模式时,我看到它被重置为AVAudioSessionModeVoiceChat

当使用默认的kAudioUnitSubType_RemoteIO 时,我看到模式停留在AVAudioSessionModeMeasurement

有没有办法在使用 VoiceProcessingIO 时禁用所有自动功能(如 AGC、过滤器)?

【问题讨论】:

    标签: ios avaudiosession audiounit


    【解决方案1】:

    试试下面的 sn-p,其中 agcIsOn 是您的布尔值,audioUnit 是您拥有的 AudioUnit 对象。

                var uValue: Int32 = agcIsOn ? 1 : 0;
                // 0 turns off AGC
                // 1 turns on AGC
                let status = AudioUnitSetProperty(audioUnit, kAUVoiceIOProperty_VoiceProcessingEnableAGC,
                                              kAudioUnitScope_Global, AudioEngine.kInputBus,
                                              &uValue, memorySize(of: uValue))
    

    【讨论】:

    • 谢谢.. 我已经尝试过了,但是当我记录缓冲区时,我可以看到仍然应用 AGC。同时我发现 VoiceProcessingIO 是高度不可控的。所以系统可以在没有事先通知的情况下决定发生什么
    • 我认为你需要在启动音频单元之前设置这个属性,即在AudioOutputUnitStart()之前。如果你需要在中途设置它,你必须停止它,设置属性,然后重新开始。
    猜你喜欢
    • 2020-05-28
    • 2018-05-28
    • 2021-11-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-16
    相关资源
    最近更新 更多