Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS change method of bypassing voice processing #1195

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

snystedt
Copy link

@snystedt snystedt commented Feb 7, 2023

The implementation of AudioIODevice::setAudioPreprocessingEnabled in juce_ios_Audio.cpp uses the AVAudioSession::setMode method to set the AVAudioSessionMode of the session to AVAudioSessionModeMeasurement. However, this also removes the processing of output signals, causing a drastic reduction in output playback level (see https://developer.apple.com/documentation/avfaudio/avaudiosessionmodemeasurement?language=objc). While this might be desirable behaviour for specific use cases, the setAudioPreprocessingEnabled description in juce_AudioIODevice.h states that

/** On devices which support it, this allows automatic gain control or other
    mic processing to be disabled.
    If the device doesn't support this operation, it'll return false.
*/

suggesting the intention is to only bypass audio input preprocessing.

My proposal is to instead use the AudioUnitProperty kAUVoiceIOProperty_BypassVoiceProcessing which only disables the input processing, not the output processing. (https://developer.apple.com/documentation/audiotoolbox/1534007-voice-processing_i_o_audio_unit_proper/kauvoiceioproperty_bypassvoiceprocessing?language=objc)

If this is not desirable, then I would recommend that another method be added, AudioIODevice::setInputProcessingEnabled, which would do the same thing suggested above.

This is crucial to record singing/vocals on iOS, since the Automatic Gain Control in the phones introduce a ton of noise when not actively singing/talking, as in when you're waiting for the place you want to come in with your singing.

@snystedt snystedt force-pushed the ios-bypass-voice-processing branch from 6cac7c1 to 2b6e83e Compare February 7, 2023 13:08
@snystedt snystedt force-pushed the ios-bypass-voice-processing branch from 2b6e83e to ce7b1ef Compare February 7, 2023 13:11
@snystedt
Copy link
Author

snystedt commented Mar 2, 2023

Alright, so this was kind of a fast PR I made when discovering the issues with AVAudioSessionModeMeasurement. I'll come back to this and clean up the code. However it would be good to know if this is something that you'd consider merging in near-time. Currently I have to hack a modified juce_ios_audio.cpp into our build process and would obviously prefer to stop doing so asap. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant