feat(android): AudioRecorder input preset option (androidInputPreset) - #1210
Open
lpmv wants to merge 1 commit into
Open
feat(android): AudioRecorder input preset option (androidInputPreset)#1210lpmv wants to merge 1 commit into
lpmv wants to merge 1 commit into
Conversation
The Oboe input stream builder never calls setInputPreset, so every capture
stream runs on Oboe's implicit default, InputPreset::VoiceRecognition - the
speech-recognition preprocessing chain, which applies no acoustic echo
cancellation. For duplex voice apps (playing audio through the same device
while recording, VoIP-style) that makes Android capture echo-raw, while the
equivalent iOS setup gets AEC from the voiceChat session mode.
This adds an optional constructor option to AudioRecorder:
new AudioRecorder({ androidInputPreset: 'voiceCommunication' })
mapping to Oboe's InputPreset on the capture stream builder. When the option
is omitted (or names an unknown preset) no setInputPreset call is made, so
existing behavior is preserved exactly. iOS ignores the option; its input
chain is selected by the AVAudioSession mode instead.
Presets exposed: generic, camcorder, voiceRecognition, voiceCommunication,
unprocessed, voicePerformance.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The Oboe input stream builder in
AndroidAudioRecorder::openAudioStreamnever callssetInputPreset, so every capture stream runs on Oboe's implicit default,InputPreset::VoiceRecognition— the speech-recognition preprocessing chain, which applies no acoustic echo cancellation. For duplex voice apps (playing TTS/voice through the same device while recording, VoIP-style — the use case asked about in #670), that makes Android capture echo-raw, while the equivalent iOS setup gets AEC from thevoiceChatsession mode.What
An optional constructor option on
AudioRecorder:mapped to Oboe's
InputPreseton the capture stream builder.voiceCommunicationengages the platform AEC/NS chain — the Android twin of iOSvoiceChat.setInputPresetcall is made, so existing behavior is preserved exactly.generic,camcorder,voiceRecognition,voiceCommunication,unprocessed,voicePerformance.Notes
We measured the difference in a duplex probe (1024-sample pcm16 frames at 24 kHz, speaker playback at full volume while recording): on iOS under
voiceChatthe played audio re-enters the mic at +1.9 dB over the room floor; Android capture through the current builder has no platform AEC path at all. Happy to adjust the option's shape (e.g. a generalAudioRecorderOptionsbag was chosen so future per-platform stream options have a home).