Skip to content

Fix Apple Silicon mic, screen recording, and speakersafetyd recovery - #374

Closed
ijt wants to merge 3 commits into
omacom:quattrofrom
ijt:asahi-mic-screenrecord
Closed

ijt wants to merge 3 commits into
omacom:quattrofrom
ijt:asahi-mic-screenrecord

Conversation

@ijt

@ijt ijt commented Sep 7, 2026

Copy link
Copy Markdown

On Apple Silicon (Asahi), the built-in mic is silent to apps, screen recordings either have no audio or play as silence, Capture Stop disappears while wf-recorder is running, the webcam overlay steals focus, and a speakersafetyd start-limit can leave the speakers muted at -100 dB.

Verified on a MacBook Air M1 (J313).

What this does

Screen recording

  • wf-recorder -R 48000 — Asahi speaker DSP advertises 96 kHz, and wf-recorder follows that into a 96 kHz AAC track that this PipeWire graph (and many players) play as silence. 48 kHz is the rate the rest of the session already uses.
  • Stop / bar / menu matching — pgrep -f '^wf-recorder' misses argv[0] when it is a full path (/usr/bin/wf-recorder). Match (^|/)(gpu-screen-recorder|wf-recorder)( |$) so Capture Stop and the bar indicator work on the Asahi software path. The existing Stop row and English labels are unchanged.
  • Webcam overlay — no_initial_focus was not enough; a click still focused mpv and froze the mini-me. Set no_focus and no_follow_mouse.

Mic array

asahi-audio publishes the beamformed laptop mics as AUX0. Recorders and the desktop+mic null-sink ask for FL/FR, so they either fail to link or write left-only audio that loudnorm then ruins.

  • omarchy-hw-apple — aarch64 plus apple, in the device tree.
  • omarchy-audio-asahi-mic-map — wait for effect_output.j*-mic, create a low-priority stereo null sink omarchy_asahi_mic, pw-link AUX0 onto FL and FR, use the monitor as the default source, restore the default sink to the asahi-audio convolver. Never moves existing source-outputs — that steals the DSP chain's capture from the raw mics and kills the filter.
  • Headset jack drop-in — the unplugged 3.5mm headset source advertises a MONO map and often wins the default. Lower its priority.session to 1.
  • Wired from install/user/hardware/apple/mic.sh (fresh users) and Hyprland start (every login). Existing installs get it from the migration.

Speakers

speakersafetyd can panic on a bad IV-sense sample (Negative power, bad ivsense data?), hit start-limit, and leave the kernel holding the drivers at -100 dB. After enable --now, if the unit is still inactive, reset-failed and try start once more.

Design notes

  • No global PipeWire 48 kHz lock. That would fight asahi-audio's 96 kHz speaker graph. The sample-rate pin is only on the recorder.
  • No new systemd user unit. omarchy-settings lists user units explicitly in its PKGBUILD; a new unit would need a second PR against omarchy-pkgs. Hyprland autostart plus the user-setup leaf is enough, and bin/ is glob-installed by the omarchy package.
  • No-op off Apple Silicon. omarchy-hw-apple is the gate; x86 and non-Apple aarch64 leave the graph alone.

Testing

  • test/cli — metadata check passes (omarchy-hw-apple, hidden omarchy-audio-asahi-mic-map).
  • bash test/shell.d/asahi-mic-map-test.sh — hardware gate, AUX0→FL/FR mapping, no move-source-output, headset drop-in, install/autostart/migration wiring.
  • bash test/shell.d/asahi-audio-install-test.sh — existing Asahi audio package coverage plus speakersafetyd start-limit recovery.
  • bash test/shell.d/screenrecording-test.sh — 48 kHz, process matching, overlay no_focus / no_follow_mouse.
  • bash test/shell.d/install-stage-wiring-test.sh — user/hardware/apple/mic.sh is sourced from install/user/all.sh.
  • On J313: DSP source meters, speakers at 0 dB after the speakersafetyd retry, and a 48 kHz screen recording with audible microphone audio.

Existing installs pick this up through omarchy update → omarchy-migrate. Factory-reset buyers get it from the packaged /usr/share/omarchy defaults once this is in a release; it does not belong in @factory as a home-directory overlay.

ijt added 2 commits September 7, 2026 23:41
wf-recorder follows the Asahi DSP clock into a 96 kHz AAC track that this PipeWire graph (and many players) play as silence. Pin the sample rate at 48 kHz.

Stop/bar/menu matched ^wf-recorder, which misses argv[0] when it is a full path. Match the basename at a path or line boundary so Capture Stop and the bar indicator work on Apple Silicon.

The webcam overlay already skipped initial focus; clicks still stole the session. Ignore focus and mouse-follow so the mini-me stays put.
asahi-audio publishes the beamformed laptop mics as AUX0. Recorders ask for FL/FR, so they fail to link or write left-only audio that loudnorm ruins. Duplicate AUX0 onto a low-priority stereo sink and use its monitor as the default source, without moving existing source-outputs (that steals the DSP capture).

speakersafetyd can hit start-limit after a bad IV-sense sample and leave the speakers muted at -100 dB; clear that and try once more.
@ijt
ijt requested review from dhh and ryanrhughes as code owners September 7, 2026 23:42
A new null sink can steal the session output. Putting the speaker convolver back unconditionally bounced headphones and Bluetooth to the internal speakers on every login. Snapshot the default first and restore it; only fall back to the convolver when the dummy sink is what is left.
@malik-na

malik-na commented Sep 9, 2026

Copy link
Copy Markdown
Member

No code blocker found here. Please record the pending reboot, headphone, and audible audio checks on #377, then use one merge path so these commits are not carried by two open PRs.

@malik-na

Copy link
Copy Markdown
Member

Superseded by #377 (integrated). Closing without merge.

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