Skip to content

Keep the first input when raw capture folds a discrete-layout device into mono, instead of recording silence - #77

Open
AndrewYakovlev wants to merge 2 commits into
gsamat:masterfrom
AndrewYakovlev:fix/discrete-layout-mic-downmix
Open

AndrewYakovlev wants to merge 2 commits into
gsamat:masterfrom
AndrewYakovlev:fix/discrete-layout-mic-downmix

Conversation

@AndrewYakovlev

Copy link
Copy Markdown

Fixes #57.

The fix is Ilia Ablamonov's, from his fork (Flamefork/amanu@eba46e8). It was described in #57 but never opened as a PR, so I have carried it over with his authorship. For a discrete channel layout, AVAudioConverter maps no input channel to the mono output (channelMap == [-1]). Audio interfaces present their inputs this way, and the raw mic track came out as digital zeros. The converter now takes input 1 in that case, which is what it already does for a stereo mic.

My second commit adds a three-channel case to the test. #65 found that a newer MacBook's built-in microphone presents three discrete channels and records silence after a route change, so this bug affects built-in microphones too, not only studio interfaces. Without the fix, the 2-, 3- and 14-channel cases all fail. With it, they all pass. The full swift test run passes, except the locale-dependent MeetingLanguagesTests case that fails on master too.

Not tested on real hardware here. Ilia reports −3 dB peaks from a Babyface Pro with the change.

🤖 Generated with Claude Code

Flamefork and others added 2 commits November 28, 2026 14:18
…into mono, instead of recording silence

AVAudioConverter maps no input channel to mono for a discrete channel layout,
which is how audio interfaces present their inputs, so the mic track came out
as digital zeros. Taking input 1 matches what the converter already does for a
stereo microphone.
…presents, which gsamat#65 found recording silence the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

[Bug]: Raw mic capture records silence from a multichannel audio interface

2 participants