You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The default remains unchanged: if androidInputPreset is omitted/null, miniaudio leaves the Android input preset unset and the plugin keeps the previous platform-default behavior.
Changes
Add public AndroidInputPreset enum with the common AAudio/OpenSL-backed presets:
generic
camcorder
voiceRecognition
voiceCommunication
unprocessed
Extend the Dart init path and native FFI init ABI with an Android preset integer.
Map the value on Android to both:
deviceConfig.aaudio.inputPreset
deviceConfig.opensl.recordingPreset
Keep non-Android platforms, including web, as documented no-ops.
Add a small Android-only selector in the example app for manual comparison.
Update README/API docs and add an Unreleased changelog entry.
Add focused tests for stable enum values and null/default mapping.
Validation
Automated checks run locally:
dart analyze -> no issues found
flutter analyze --no-pub example -> no issues found
flutter test --no-pub test/android_input_preset_test.dart -> all tests passed
Compared the current default path against voiceRecognition, voiceCommunication, camcorder, and unprocessed.
voiceCommunication produced the needed louder/fuller speech capture on this device, while the default remains unchanged for existing users.
Scope
This intentionally does not add a larger audio_session integration. audio_session remains useful for session/focus/route management, but Android input preset selection needs to be passed to miniaudio's capture config before device initialization.
Added a follow-up stabilization commit after device testing on Lenovo TB328FU.
The original AAudio voiceCommunication path could intermittently fail ma_device_start() even though Android moved the stream to STARTED immediately afterward. The follow-up commit routes the Android default-device voiceCommunication preset through OpenSL, which supports the same VOICE_COMMUNICATION recording preset and avoids the observed AAudio state-transition race on this OEM path.
Additional validation after the follow-up commit:
dart analyze -> no issues found
flutter analyze --no-pub example -> no issues found
flutter test --no-pub test/android_input_preset_test.dart -> all tests passed
Thanks a lot @Avejack! This PR is much appreciated.
I didn't know about mic presets. I tried this and it works great. I found that on my Samsung Galaxy S22, using voiceRecognition and unprocessed, the mic volume is louder, but this depends, I think, on the brand manufacturer.
I should give this repo more consideration. If you find any other features or fixes, please feel free to make new PRs :).
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
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.
Closes #44
Summary
This adds a small Android-specific capture input preset option to
Recorder.init:The default remains unchanged: if
androidInputPresetis omitted/null, miniaudio leaves the Android input preset unset and the plugin keeps the previous platform-default behavior.Changes
AndroidInputPresetenum with the common AAudio/OpenSL-backed presets:genericcamcordervoiceRecognitionvoiceCommunicationunprocesseddeviceConfig.aaudio.inputPresetdeviceConfig.opensl.recordingPresetValidation
Automated checks run locally:
dart analyze-> no issues foundflutter analyze --no-pub example-> no issues foundflutter test --no-pub test/android_input_preset_test.dart-> all tests passedcmake -S src -B /tmp/flutter_recorder_build && cmake --build /tmp/flutter_recorder_build-> native target built successfullygit diff --check-> cleanManual Android testing:
voiceRecognition,voiceCommunication,camcorder, andunprocessed.voiceCommunicationproduced the needed louder/fuller speech capture on this device, while the default remains unchanged for existing users.Scope
This intentionally does not add a larger
audio_sessionintegration.audio_sessionremains useful for session/focus/route management, but Android input preset selection needs to be passed to miniaudio's capture config before device initialization.