app_audio
This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET
Capture what the device plays: start, stop with a path to save it as a WAV, or omit the action to ask whether a capture is running. Stop answers with a timeline — when there was sound and when silence, to a tenth of a second, and each sound's pitch and level — and with what interrupted the app: a call muting it, a ringtone, alarm or notification sounding over it, read from Android's audio service. Assert on sound, silence and pitch, not level: the result gives the media volume, and at its lowest a playing app is silence. Everything the device played is in the sound, the system's too: with touch sounds on, a tap is a tenth of a second of it. An Android emulator captures the sound; an iOS simulator captures the app's own sound alone, through a tap on the Mac that needs macOS's System Audio Recording allowed for what runs mobium, and says when the app never opened audio; an Android phone, whose sound nothing outside it hears, records only the interruptions; an iPhone is refused. One capture per device; ending the session discards it.
Changes the device, the app or the session: readOnlyHint is false.
Arguments
| Name | Type | Required | What it is |
|---|---|---|---|
action | string: start, stop | start or stop. Omit to ask whether a capture is running. | |
app | string | On start: the app whose interruptions to report, by package — a call muting it, a ringtone, alarm or notification over it. Default: the app in front. | |
device | string | Device serial to target, e.g. "emulator-5554". Omit when only one device is running. | |
driver | string: uiautomator2, uiautomator, wda | Driver to use: "uiautomator2" (default for Android; fast, installs a server APK on first use), "uiautomator" (Android, installs nothing, slower, cannot type), or "wda" (WebDriverAgent: iOS simulators and iPhones). | |
expect | array of object | On stop: the sounds the capture must hold, in order — each a pitch, 0 for a sound with no one pitch, with an optional length; [] is silence. A sound of ignore_ms or less on its own does not count; short ones that run on into each other do. A capture that holds anything else fails as not_confirmed, saying what was heard, and is still saved. | |
ignore_ms | integer | With expect: sounds this short or shorter do not count — a tap's own click is 100. Default 200. | |
path | string | Where to save the audio, on stop — a .wav on this machine. | |
return_data | boolean | On stop without a path: return the WAV, base64, instead of saving it — for a daemon on another machine; the CLI and pipe ask for it and save it where the caller said. |
Examples
Each is the arguments of a tools/call request; the first is shown whole.
Start capturing what an app plays
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "app_audio",
"arguments": {
"action": "start",
"app": "dev.mobium.mobiumapp"
}
}
}
On an Android 15 emulator the answer's text was:
capturing audio — stop it with action "stop" and a path
Stop, save the capture, and assert what was heard
{
"action": "stop",
"path": "heard.wav",
"expect": [
{
"hz": 440
}
]
}
On an Android 15 emulator the answer's text was:
saved …/heard.wav: 3.746s of audio: 0.0–0.5s silence, 0.5–0.6s sound, no one pitch (-46 dBFS), 0.6–2.6s 440 Hz (-42 dBFS), 2.6–3.7s silence — at media volume 5 of 15