Repository navigation
Meter the Mac microphone like a stock one (omarchy-mac 0.1.3) - #28
Conversation
The default input was a null sink typed Audio/Source/Virtual. The desktop shell types only exact media classes, so it drove that source's volume and mute through wpctl and showed no level meter for it; its peak monitor on asahi-audio's mono DSP source drops every buffer. The microphone never behaved like a stock one in the audio panel. The mapper now loads pipewire-pulse's module-remap-source instead: a loopback whose capture stream records the DSP source and whose other side is an Audio/Source with front-left and front-right, named and described as before. WirePlumber links the mono port to the left side only, so the mapper waits for that link and adds the right one. The panel then drives volume, mute and the meter through its normal typed path. On its first pass after an upgrade the mapper replaces 0.1.2's virtual source, keeping its gain, mute and selection. The audio hints hide the remap's own capture stream, which would otherwise count as an app recording.
omarchy-audio-asahi-mic-level recorded the virtual mapping for a panel meter that never landed upstream. The typed microphone source is metered by the panel itself, so the helper and its test go.
pw-link reports "File exists" both when WirePlumber linked the same ports meanwhile and when a link it left in error still holds them. Only the first is a working link; the second carried nothing and, with the source already built, was never rebuilt. The mapper now deletes a failed link and links the ports itself. The upgrade test also drops the default to a monitor when the 0.1.2 source goes, as PipeWire does, so it checks the handoff that reselects the microphone.
scottjones
left a comment
There was a problem hiding this comment.
Thanks Marcelo, this is a really nice change. Getting the mic onto the panel's normal path, meter included, is exactly what it needed.
I tested it on my 14" MacBook Pro M2 Max (J414c) with omarchy-mac 0.1.0-10, asahi-audio 4.1, PipeWire 1.6.9 and WirePlumber 0.5.17. I ran the mapper once from a checkout at 89f6c16 (no --watch):
- It converted my existing null-sink mapping, and "MacBook Microphone" came up as an
Audio/Source. - The internal mic PCM (card0,
AppleJ414HPAIpcm0c) stayed closed for 30 s at idle. pw-recordmade it RUNNING, and it closed 6 s after the recording stopped.- The panel's level meter moved with speech, and the PCM closed 3 s after I closed the panel.
So there's no idle cost, which matches my reading that the remap source's capture link is passive.
One small thing, not blocking: if I remove the WirePlumber FL wait in the mapper (omarchy-audio-asahi-mic-map lines 551-555), mic-test.sh still passes. The delays at mic-test.sh:344 are (0, 3), which are too short to need the wait. Adding a delay of 8 fails without the wait and passes with it.
The version bump can come out once #30 lands, since the release will set it. No need to hold this one for that.
Summary
The Mac microphone now reaches the audio panel the same way a stock microphone does: the panel's normal path handles volume, mute and the input level meter. Nothing in the runtime changes.
omarchy-audio-asahi-mic-map): loadsmodule-remap-source master=<dsp>in place of the virtual null sink. WirePlumber links the mono port to one input only (si-standard-link gives each output port one best input), so the mapper waits for its FL link and then adds FR. It adds FL as well only if WirePlumber never makes it. A link WirePlumber left inerroris replaced. Kept as before: the node name, the description, the selection rules, the #505 sample, the #99 untargeted-route check, outage handling and gain persistence.retire_virtual()removes 0.1.2's virtual source with the same name and keeps its gain, mute and selection. Only a mapper restarted inside a session meets one; a new session's pipewire-pulse starts with no modules, and the saved state carries the gain.audio.jsonhidesinput.omarchy_asahi_mic, which would otherwise count as an app recording in the bar's mic widget.omarchy-audio-asahi-mic-level. It belonged to the panel meter that was dropped from Converge omarchy-mac and omarchy-mx-mac into upstream Omarchy omarchy#14431, and nothing calls it.sourceAvailabilityonly admits untyped sources. A stock UCM laptop with a separate headset node shows the same entry.Evidence
Tested on the M2 Max (j416; pipewire 1.6.9, wireplumber 0.5.18, Quickshell 0.3.1, runtime e1b0e5e9b) with this branch's package (
pacman -U omarchy-mac-0.1.3-1, source-revision 89f6c16).omarchy_asahi_micisAudio/Source/Virtual. With the audio panel open there is no peak stream (untyped). When the default was the DSP, the shell loggedPwNode(id=64) is missing channels present in capture streamabout 47 times a second.After:
pw-cli info:media.class = "Audio/Source",audio.position = [ FL, FR ], default sourceomarchy_asahi_mic. The open panel's "Quickshell Peak Detect" stream is linkedomarchy_asahi_mic:capture_FL/FR → quickshell[active], with no peak errors.parec(#99 case) is fed by{omarchy_asahi_mic}with signal on both channels (peak 0.0049 L/R).parecordwith no device: peak 132/132 (s16).wpctl set-volume <mic> 0.2scales the recorded peak to 0.8%,set-mute 1gives exact zeros, and the gain is saved toasahi-mic-gain.json.pacman -U, then restarted the unit. Result: one "MacBook Microphone", still the default, 70% kept, the open panel's peak monitor follows it, the level helper is gone.audio_effect.j416-convolver, so speakers and headphones are untouched.omarchy-mac/test/all,omarchy-mac-boot/test/allandtest/integration/allall pass. New mic tests cover the remap load, waiting for WirePlumber's link, the race with it, replacing a failed link, and the 0.1.2 migration. The handoff test fails when the DSP handoff is removed.Merge Danger
Door: two-way
Rolling back to 0.1.2 is safe: its mapper reports the remap source as "a source this service does not own" until the next login, when pipewire-pulse starts empty and it builds its virtual source again. The saved gain format is unchanged.
Blast Radius: Apple-Silicon-microphone
Only Apple Silicon runs any of this: the mapper and unit are gated on
omarchy-hw-apple-silicon, and x86 is untouched. Apps that record from the default or from "MacBook Microphone" keep the same node name. Inwpctl statusthe mic now appears under Filters (loopback group), like asahi-audio's speaker node.