Using VoiceProcessingIO audio unit subtype instead of RemoteIO causes unwanted drop in output volume

audiounit, avaudiosession, core-audio, ios, remoteio

Solution

I realize that this hasn't been answered in a long time, but I found that if you do the following between changing audio units:

AudioComponentInstanceDispose(_ioUnit);

[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient  error:&nsError];

[[AVAudioSession sharedInstance] setActive:NO error:&nsError];

Then it seems to not create such a huge loudness problem between each unit. At this point, just reinitialize your audio unit and set the session type to what you need.

Problem

I am using RemoteIO in my voice chat application. To enable echo canceling, I changed "kAudioUnitSubType_RemoteIO" to "kAudioUnitSubType_VoiceProcessingIO" after setting "kAudioSessionCategory_PlayAndRecord" as the session type. Now echo canceling works but the output volume level has dropped significantly versus the previous RemoteIO output level. Does anyone know how to get the same output volume level when using VoiceProcessingIO as when using RemoteIO?

Original source