Skip to content

Keep a leased iOS simulator silent: ios.simulator.audio #1118

Closed
1 of 1 issue completed
Closed

Description

@leonardoxr

Request: #1099

Problem

In the reporter's words: "A leased iOS simulator plays sound through the worker Mac's speakers. One of our agents ran a browser game on a leased simulator, and its music and effects played out loud on the Mac. … Android already has a switch for this, android.emulator.audio: false. Nothing does the same for an iOS simulator."

Who it is for

An operator whose worker Mac sits in a room with people (a desk machine, a shared office Mac running a pool of agents), and the agents leasing iOS simulators on it, with any app or page that plays sound.

Outcome

  • A worker setting, ios.simulator.audio (default true, as today), the iOS counterpart of android.emulator.audio: false keeps every simulator on that worker silent, for every lease, with no change to what agents send.
  • The setting applies to every simulator Simlock makes ready for a lease after the daemon restarts: a new copy for a lease or the warm pool, and a leased device rebooted to recover it.
  • A simulator made silent stays usable: apps and pages that play audio run as they do with sound, they are just not heard. An app sees its output volume at 0, as on an iPhone turned all the way down.
  • When the command that silences a simulator fails, Simlock still grants the device, and the daemon log says so for that boot: Could not silence iOS simulator, with the device and the reason.

How it works for the user

flowchart LR
  O[Operator: simlock config set ios.simulator.audio false] --> R[restart the daemon]
  R --> B[each simulator boots, then its volume is set to 0]
  B --> L[agent leases it, plays a game]
  L --> Q[nothing comes out of the Mac's speakers]
Loading
$ simlock config set ios.simulator.audio false
Updated ios.simulator.audio in ~/.simlock/config.json; takes effect on daemon restart.

Examples

ios.simulator.audio Today After
unset sound plays sound plays
true unknown key sound plays
false unknown key silent
"no" unknown key invalid config, as any non-boolean

What could go wrong

  • A future Xcode ignores the volume setting, and simulators play sound again. Expected: the slow lane catches it on a new Xcode. An operator on an Xcode the slow lane has not run gets no warning; they hear it.
  • An agent turns the volume back up, or reboots its leased simulator itself through simlock simctl. Expected: it hears sound until Simlock next boots that device; Simlock does not watch the volume.
  • While an app plays sound on a silent simulator, the Mac still counts audio as playing and does not idle-sleep. Expected: as with sound; the configuration reference says so.

Words used

  • silent: no sound from the simulator reaches the worker Mac's audio output; the app inside still plays, at volume 0.
  • simulator volume: the simulated hardware volume, 0 to 100, default 60, inside a booted simulator. It resets to 60 on every boot.

Non-goals

  • A per-lease --muted option or a mute action on a lease (the request accepts a worker setting; an operator decides for the room).
  • Physical iPhones (their sound comes from the phone).
  • Changing Android's android.emulator.audio.
  • Recording or streaming a simulator's audio.
  • Keeping a simulator silent after an agent changes its volume or reboots it outside Simlock.
  • A simlock doctor check: silence is checked on each boot instead, since only a booted simulator can show it.

Completion conditions

  • With ios.simulator.audio: false, every simulator Simlock makes ready for a lease reads volume 0 within 120 s of the grant (decided in delivery, pending the maintainer): the first lease's, a second lease's (a new copy), and one recovered by a reboot (slow lane).
  • With the setting unset, a simulator's volume is left as the simulator sets it.
  • The configuration reference lists the key beside android.emulator.audio.

Open questions

none

Decisions

none: one driver change and one config key; no ADR. The mechanism, found by the spike #1119 (findings: #1118 (comment)), lives in the iOS driver only.

Decided in the session:

  • A simulator that cannot be made silent is granted with a warning in the daemon log, not failed (maintainer).
  • The proof is the slow lane reading the volume back; no person's listening check (maintainer).
  • No check that the volume took: the daemon warns only when the volume command fails; the slow lane proves the volume reads 0 on each new Xcode (maintainer).

Shared values

none: a one-task feature.

Behaviours

Behaviour (invoker, action, what it sees) Seam Cases Task
An operator sets ios.simulator.audio and the daemon loads it and answers it in config.get loadConfig, config.get unset → true; true; false; "no" → invalid config naming the key; config.get returns ios.simulator.audio #1238
Simlock makes a simulator ready with ios.simulator.audio: false, and sets its volume to 0 before handing it on iOS driver makeReady prepare; recover; slim and full; the setting true → no notifyutil call; the volume command fails or times out → device ready, onSilenceFailed with the stderr or timed out #1238
The daemon logs a silence failure logSilenceFailure in daemon/main one failure gives one warn line Could not silence iOS simulator with deviceId and detail #1238
A leased simulator on a worker with ios.simulator.audio: false reads volume 0 slow lane first lease; a second lease (a new copy); after a recovery reboot #1238

Tasks

Completion conditions: all three are #1238's.

Open work in the same area:

Written by an agent.

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    feature:spec
    on Nov 3, 2026
  2. V3RON commented on Nov 3, 2026

    @V3RON
    Contributor

    Spike #1119: keep an iOS simulator silent (findings)

    Run on 2026-11-03 on the maintainer's Mac (Darwin 25.6.0). Every simulator was booted the way Simlock boots one: xcrun simctl --set /tmp/spike-1119-set boot <udid> then bootstatus -b, with no Simulator.app. All spike devices, the scratch set and their overrides folders were deleted afterwards. The Mac's audio settings were not changed.

    Xcode Runtime CoreSimulator
    26.4.1 (DEVELOPER_DIR=/Applications/Xcode-26.4.1.app/Contents/Developer) iOS 26.4 (23E254a) 1171.7
    27.0 (default) iOS 27.0 (24A5423a) 1171.7

    Caveat: CoreSimulator is shared system-wide (/Library/Developer/PrivateFrameworks), so both Xcodes ran on 1171.7, the version Xcode 27 installs. A Mac with only Xcode 26.4 runs an older CoreSimulator and was not tested here.

    How the simulator's audio reaches the Mac

    • There is no audio daemon in the path. An app process in the simulator is a host process. Its in-simulator AudioToolbox opens an IO directly on the host's coreaudiod, on the host output device named by sim_output_device_uid. coreaudiod's assertion names the app's own PID: com.apple.audio.iOSSimulatorAudioDevice-<pid>-0 … Resources: audio-out <host device UID>. For a web page, that PID is com.apple.WebKit.GPU.
    • The simulator's audio settings live in <device>/data/var/run/simulatoraudio/audiosettings.plist (sim_output_device_uid, sim_volume, sim_ringer_state). The boot environment points to it through SIMULATOR_AUDIO_SETTINGS_PATH. CoreSimulatorBridge writes it from inside the simulator. Its sim_volume comes from the simulator's notify state com.apple.springboard.volumestate, which is the simulated hardware volume, 0–100, default 60. The in-simulator AudioToolbox and AudioSession apply that volume to every process's output, and they pick up a change live.
    • Host side: SimAudioProcessorService.xpc, inside CoreSimulator, is the routing service that Simulator.app's Audio Output menu uses. Simlock does not run Simulator.app.

    How silence was measured

    1. Host IO signal (presence). pmset -g assertions: coreaudiod's audio-out assertion, which names the simulator process. It was absent before every run and appeared within 1 s of the test app starting. It went away when the app was terminated.
    2. Host sample signal (level), the deciding one. /tmp/spike-1119/tap/tap <pid> 3 is a host CoreAudio process tap (CATapDescription(stereoMixdownOfProcesses:) on a private aggregate device, removed on exit). It measures the RMS and peak of the samples that one simulator process sends to coreaudiod. It needed no permission prompt in this session.
      • Baseline at volume 60: Tone app RMS 0.0509 / peak 0.072; page RMS 0.055–0.063 / peak 0.105.
      • Silenced: RMS 0.00000 / peak 0.00000, exactly zero.
    3. Sound sources.
      • Mobile Safari through simctl openurl did not work: autoplay is blocked without a tap (paused=true, AudioContext suspended). It still opened a host IO from com.apple.WebKit.GPU.
      • Built for the spike with swiftc (sources in /tmp/spike-1119/app/):
        • Tone.app: AVAudioEngine playing a 523 Hz sine through AVAudioSession .playback. Prints tick n running= rendered=<frames> vol=<outputVolume> every second.
        • WebTone.app: WKWebView with autoplay allowed, playing the same page as Safari (looping <audio> WAV + WebAudio oscillator). Each JS tick is sent back to stdout with paused, currentTime and AudioContext.state.
      • "Kept running" means the ticks kept coming, rendered kept growing (~48k frames/s), running=true, the page said paused=false with currentTime advancing and ac=running, and screenshots (simctl io screenshot) showed the app updating.

    Candidates

    (a) Disable an audio daemon inside the simulator: does not work

    • Label found: com.apple.audio.systemsoundserver-simd, the only audio launchd job in the iOS 26.4 runtime's /System/Library/LaunchDaemons. Nothing in launchctl list is an audio server; mediaremoted and MediaRemoteUI handle Now Playing.
    • Commands (Xcode 26.4.1, iOS 26.4):
      xcrun simctl --set $SET spawn $U launchctl disable system/com.apple.audio.systemsoundserver-simd
      xcrun simctl --set $SET shutdown $U && xcrun simctl --set $SET boot $U && xcrun simctl --set $SET bootstatus $U -b
      
    • Silent? No. print-disabled confirmed the label was disabled. The app and page still opened a host IO (assertion 6/6 s and 5/8 s, audio-out 34-0E-22-5B-D5-82:output) at volume 0.6. Apps talk to coreaudiod directly, so this daemon only serves system sounds.
    • Page/app kept running: yes. Not repeated on iOS 27, because the app's audio does not pass through any in-simulator daemon.

    (b1) Route the simulator's output elsewhere: does not work

    • Edited sim_output_device_uid in audiosettings.plist while the simulator was booted; each new process reads it.
    • Results:
      • Bogus UID, empty string, or key removed: falls back to the host default output, and the sound still reaches the Mac (assertion on 34-0E-22-5B-D5-82:output).
      • An input-only device (BuiltInMicrophoneDevice): no host IO, but AVAudioEngine fails to start (-10851, kAUInitialize), so the app breaks. Rejected.
    • Routing to a silent host device would need such a device on every worker, meaning a virtual audio driver or a public aggregate device. That is a host-wide audio change and out of scope.
    • Not persistent anyway: the file is rewritten at every boot.

    (b2) Simulated hardware volume = 0: works on both Xcodes (chosen)

    • Command, run after bootstatus -b (it needs the simulator booted):

      xcrun simctl --set $SET spawn $U notifyutil -s com.apple.springboard.volumestate 0
      xcrun simctl --set $SET spawn $U notifyutil -p com.apple.springboard.volumestate
      

      CoreSimulatorBridge then writes sim_volume = 0 to audiosettings.plist. Writing the plist directly works only for processes started later, and is overwritten. Use the notify state.

    • Silent? Yes, by sample level.

      Run Xcode / runtime Tone.app (tap RMS) Page in WebTone (tap RMS)
      baseline, volume 60 26.4.1 / 26.4 0.0509 0.0588–0.0602
      volume 0 26.4.1 / 26.4 0.00000 0.00000
      baseline, volume 60 27.0 / 27.0 0.0509 0.0553–0.0634
      volume 0 27.0 / 27.0 0.00000 0.00000
    • Page/app kept running: yes on both runtimes, with no hang or crash. Tone kept running=true and kept rendering. The page kept ticking with paused=false, ac=running and currentTime advancing. What an app sees: AVAudioSession.outputVolume == 0.0, the same as a user turning an iPhone all the way down.

    • Live: switching volume 0 → 60 while the app played changed its outputVolume within 1 s. A device silenced after an app has started is silenced right away.

    • Host IO stays open: the coreaudiod audio-out assertion is still present while silenced. The process streams zeros to the host device and holds a PreventUserIdleSystemSleep assertion while an app plays, as it does with sound.

    • Survival:

      Event 26.4 27.0
      Holds for 30–60 s after applying (nothing resets it) yes yes
      Shutdown + boot no, back to 60 no, back to 60
      simctl erase + boot no, 60; re-applied → RMS 0 no, 60; re-applied → RMS 0
      simctl clone of a silenced device + boot no, 60; re-applied → RMS 0 no, 60; re-applied → RMS 0

      The value lives only in in-memory notify state and in var/run, so it must be re-applied after every boot: prepare, recover, after reclaim, and clones. One simctl spawn takes about 1 s.

    • Slim conflict: none. On a device whose disabled.plist disabled all 171 labels of SLIM_CATEGORIES (print-disabled showed 171), the baseline still played (RMS 0.0509) and volume 0 gave RMS 0 for both app and page, on both runtimes. Neither CoreSimulatorBridge, SpringBoard nor notifyd is in any slim category.

    • Before re-applying after a boot, the device is at 60, so a sound started in that gap would be audible. In Simlock's flow no app runs before the grant, so applying it right after bootstatus (before the listapps poll) closes the gap.

    (c) Other things looked at

    • sim_ringer_state 0 is the mute switch. It silences only ringer/ambient sounds; .playback apps and pages still play. Not tested further.
    • SIMCTL_CHILD_* / boot environment: the in-simulator AudioToolbox reads only SIMULATOR_AUDIO_SETTINGS_PATH and SIMULATOR_ROOT. CoreAudio has no environment switch to turn the HAL off.
    • defaults of com.apple.iphonesimulator: its audio keys (RecentAudioOutputDeviceUIDs) are read only by Simulator.app. No com.apple.CoreSimulator.SimAudioProcessorService domain exists.
    • device.plist has no audio keys. simctl has no audio subcommand.

    Chosen mechanism

    Set the simulated hardware volume to 0 after every boot: simctl spawn <udid> notifyutil -s com.apple.springboard.volumestate 0 then notifyutil -p com.apple.springboard.volumestate, run right after bootstatus on every makeReady (prepare and recover). It does not persist, so it must be applied every time. It works on iOS 26.4 (Xcode 26.4.1) and iOS 27.0 (Xcode 27.0), with or without slim. Apps and pages keep playing and see outputVolume == 0.

    Suggested readback for the implementation and for doctor: simctl spawn <udid> notifyutil -g com.apple.springboard.volumestate should print 0, and <device>/data/var/run/simulatoraudio/audiosettings.plist should have sim_volume = 0.

    Confidence: high on this Mac, because a baseline-checked sample-level measurement went from RMS ≈0.05 to exactly 0 on both runtimes. Medium for other setups, because both runs used CoreSimulator 1171.7 and the mechanism depends on two undocumented parts: CoreSimulatorBridge's handling of volumestate and the runtime's handling of sim_volume.

    Needs a person

    On a worker Mac with speakers on, boot a simulator through Simlock with the setting off and confirm two things by ear:

    1. The tone or page is heard at the default volume, and nothing is heard after notifyutil -s com.apple.springboard.volumestate 0 + -p, while the app keeps ticking.
    2. It is still silent after a reclaim (erase) and the next boot.

    Ideally do this once on a Mac with only Xcode 26.4 installed, so the older CoreSimulator is covered too.

    Reproduction kit (left in /tmp, not in the repo)

    • /tmp/spike-1119/app/: Tone.app, WebTone.app and their sources (main.swift, web.swift).
    • /tmp/spike-1119/tap/tap.swift: the host process-tap meter.
    • /tmp/spike-1119/meter.sh, run.sh, silence.sh: launch, measure and apply.

    Written by an agent.

  3. added
    feature:planned
    and removed
    feature:spec
    on Nov 3, 2026
  4. V3RON commented on Nov 3, 2026

    @V3RON
    Contributor

    Spec approved: the mechanism from the spike (volume 0 after every boot, checked in the background), Decisions, Behaviours and task #1238, checked ready. No ADR. #1238 waits on #1204 and #1208 (baselines stack).

    Written by an agent.

  5. V3RON commented on Nov 3, 2026

    @V3RON
    Contributor

    Spec updated: the background read-back is dropped (maintainer). The daemon warns only when the volume command fails; the slow lane proves volume 0 on each new Xcode. Rechecked: feature and #1238 ready.

    Written by an agent.

  6. V3RON commented on Nov 4, 2026

    @V3RON
    Contributor

    Delivery run

    Merged: none
    Parked: #1238 — slow lane: the second lease's simulator stays at volume 60; the hardware loop gave up after 13 failed lane runs (PR #1258, draft)

    Written by an agent.

  7. github-actions commented on Nov 4, 2026

    @github-actions
    Contributor

    Closing: all 1 sub-issues are closed. The PR that closed the last one walks the completion conditions (delivery rule 9); reopen this if one does not hold on main. Flip its ADRs to Accepted if delivery has not.

  8. V3RON commented on Nov 4, 2026

    @V3RON
    Contributor

    Delivery run

    Merged: #1258 (#1238)
    Decided: #1238 — the volume lands 45 to 110 s after boot on a busy Mac, and "wait first" cannot catch it → (b) send once, grant at once; the slow lane waits 120 s and the configuration reference says "up to 2 minutes" (pending the maintainer; the alternative is to hold the grant until the volume reads 0)

    This replaces the earlier park: the run resumed after the maintainer's answer.

    Written by an agent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:planned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions