Skip to main content

Speaker — Play / Stop / Mute

WhatWhere
Route modulehal/routes/music.py
POST /audio/play — search YouTube for a track and play itdef audio_play(req: MusicPlayRequest)
POST /audio/stop — stop current playbackdef audio_stop()
POST /speaker/mute — mute the speaker at the ALSA level (TTS still runs but silent)def mute_speaker()
POST /speaker/unmute — restoredef unmute_speaker()
GET /audio/status — what's playing right nowdef audio_status()
POST /audio/play-tone — bounded test tone (frequency, duration_ms query params)hal/routes/audio.py — def play_tone(...)
# Play a track — `query` is a song name or search string
# (this is the same endpoint the LLM's music skill calls)
curl -X POST http://127.0.0.1:5001/audio/play \
-H 'Content-Type: application/json' \
-d '{"query": "The Calling - Wherever You Will Go"}'

# Stop
curl -X POST http://127.0.0.1:5001/audio/stop

# Speaker mute / unmute — TTS keeps running, output is silenced
curl -X POST http://127.0.0.1:5001/speaker/mute
curl -X POST http://127.0.0.1:5001/speaker/unmute

# Quick "is the speaker wired up?" check — 440 Hz for half a second
curl -X POST 'http://127.0.0.1:5001/audio/play-tone?frequency=440&duration_ms=500'

Volume​

WhatWhere
GET /audio/volume — current volume and ceilinghal/routes/audio.py — def get_volume()
POST /audio/volume — set volume, {"volume": 0–100}hal/routes/audio.py — def set_volume(req: VolumeRequest)
curl -s http://127.0.0.1:5001/audio/volume
curl -s -X POST http://127.0.0.1:5001/audio/volume \
-H 'Content-Type: application/json' -d '{"volume":60}'

The value persists across reboots. Requests above the audio.max_volume ceiling in the device's SAFETY.md are clamped (Intern v2 ships without one, so the full 0–100 range applies).

Notes​

/audio/play returns {"status": "suppressed"} instead of playing when the speaker is muted, during the quiet hours set in the device's SAFETY.md, or right after the user cancelled the turn with a button click.

/speaker/mute is the right knob if you want the device to still "think out loud" internally but not disturb the room — TTS advances, LEDs still pulse, only the audio out is muted. Use /tts/stop if you want it to actually shut up.