Disable input/output AGC from RemoteIO and VPIO on iOS

CoreAudio is always a mystery due to lack of documentations. Recently I hit some stone again:

--- edited to provide more clarification ---

In my program, I invoke a RemoteIO first, then destroyed it, use another VoiceProcessingIO (VPIO) I created. I set AGC off using the follwing code:

if (desc.componentSubType == kAudioUnitSubType_VoiceProcessingIO) {
    UInt32 turnOff = 0;
    status = AudioUnitSetProperty(_mimuUnit,
                                  kAUVoiceIOProperty_VoiceProcessingEnableAGC,
                                  kAudioUnitScope_Global,
                                  0,
                                  &turnOff,
                                  sizeof(turnOff));
    NSAssert1(status == noErr, @"Error setting AGC status: %d", (int)status);
}

First of all, not sure if this disables the AGC on the microphone side or the speaker side, but anyways, let's continue.

in between the RemoteIO and VPIO usage, there's AVAudioSession adjustments to switch between playback only and playAndRecord etc.

So ever since the uesage of VPIO, when I log what's recorded on the microphone, the singal behaves like it has been heavily porcessed by an AGC, i.e. loud and sometimes pops. This caused the later analysis algorithms to fail.

Wonder if it's some kind of AudioUnit bug, or there's ways to get away from these? Thanks!



Read more here: https://stackoverflow.com/questions/67919706/disable-input-output-agc-from-remoteio-and-vpio-on-ios

Content Attribution

This content was originally published by Pei Xiang at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: