Skip to content

Improved PR-340 Bluetooth with Gain Control - #444

Closed
fhajji wants to merge 4 commits into
FossifyOrg:mainfrom
fhajji:bluetooth
Closed

fhajji wants to merge 4 commits into
FossifyOrg:mainfrom
fhajji:bluetooth

Conversation

@fhajji

@fhajji fhajji commented Oct 25, 2026

Copy link
Copy Markdown

Type of change(s)

  • Feature / enhancement

What changed and why

  • This includes feat(bluetooth): add Bluetooth recording #340 and heavily modifies it to
    • Use the user's microphone mode instead of VOICE_COMMUNICATION on Android 12+ to prevent the 10 dB attenuation and loss of sampling rate. This brings it on par with how Blackmagic Design Camera App reads Bluetooth mics.
    • Add gain control with a live level meter and limiter to allow users to adjust the mic gain both for internal and Bluetooth mics. The adjustments can be done before and while the recording is taking place.
  • Additional considerations

Tests performed

  • Tested with a DJI Mic 3 transmitter in Bluetooth mode.
  • Tested the gain control with both internal and the bluetooth mic.

Closes the following issue(s)

Checklist

  • I read the contribution guidelines.
  • I manually tested my changes on device/emulator (if applicable).
  • I updated the "Unreleased" section in CHANGELOG.md (if applicable).
  • I have self-reviewed my pull request (no typos, formatting errors, etc.).
  • I understand every change in this pull request.

longregen and others added 4 commits April 1, 2026 22:44
it also improves Android 12+ compat and reduce warnings on build
Recording from a Bluetooth mic forced AudioSource.VOICE_COMMUNICATION and
switched the phone to MODE_IN_COMMUNICATION. That routes capture through the
VoIP path, which records about 10 dB quieter than a regular source.

Use the user's microphone mode (MIC for "System default") instead, and only
enter call mode on the pre-Android 12 startBluetoothSco path;
setCommunicationDevice routes the SCO mic without it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a gain slider (0 to +24 dB) and a peak level meter to the recorder
screen. Gain changes apply immediately, also during a recording, and are
ramped to avoid clicks; a soft limiter above -1 dBFS keeps boosted peaks
from hard clipping. The meter previews the input while idle on the
recorder tab, including over Bluetooth, so gain can be set before
recording.

Applying gain needs the raw samples, which MediaRecorder doesn't expose,
so m4a and ogg are now recorded by PcmEncoderRecorder (AudioRecord ->
GainProcessor -> MediaCodec -> MediaMuxer). MediaRecorderWrapper remains
as a fallback when no usable encoder is available. MP3 applies the gain
in its existing encode loop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fhajji
fhajji requested a review from naveensingh as a code owner October 25, 2026 05:19
@fossifybot

fossifybot Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Fossify accepts code contributions only for open issues labeled help wanted. This pull request does not meet that requirement or one of the documented exceptions, so it is being closed without review. Please read the contribution guidelines before starting work.

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.

2 participants