Files
hermeven/docs/decisions/0006-spoken-answers.md
T
DanandClaude Fable 5.2 9874e1bb5b Answers read aloud: Voice on the menu, ElevenLabs voices per agent via the bridge (0.5.0)
- bridge: GET /v1/speech (which agents have a voice) and GET /v1/turns/{id}/speech (MP3 of the
  caller's own finished answer, markup removed, first 900 characters). ElevenLabs adapter; key
  and voice ids from the environment; per-device budget; last three clips kept in memory.
  speech.done / speech.failed log ids, lengths and durations only.
- bridge: forceCloseConnections. A request the client had abandoned kept shutdown waiting for
  ever (also true of /v1/transcribe as deployed). Regression test for both routes.
- client: 'Voice: off/on' on the opening menu when the bridge offers it and the page can play
  sound; off at every launch. With it on, a finished answer is fetched and played; it stops
  when the answer leaves the screen; the app does not leave the glasses while it plays.
- tests: fake provider, fake loudspeaker (tests/integration/voice.test.ts).
- docs: 0006, security 3g-3i, device plan E, 0.4.1 rollout and Dan's sound check report.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-29 12:11:38 -08:00

3.7 KiB

0006: Spoken answers through the page, switched on by hand

Date: 2026-11-29. Status: built for trial (0.5.0), not reviewed, not on the device.

What Dan asked for

"Pivot time - I'd like to get the voice thing going for the ability to get spoken replies back in my galaxy pro ear buds when they're connected. Part of the scope in #1"

Earlier (2026-11-28) he had described the eventual shape: the phone or app detecting Android Auto or a Bluetooth headset "so that the agents can use their elevenlab voices and return their responses into a speaker as well as on screen."

What the sound check showed (0.4.1, Dan's phone, 2026-11-29)

Reported by Dan from the Sound check section, earbuds connected; full text in docs/evidence/device/2026-11-29.md.

Question Result
Can the page play sound, and where is it heard? Yes; in the earbuds
Without a touch on the phone? "allowed"
20 s after a press? Played
The phone's own voice (speechSynthesis)? "not available in this page"
Which outputs can the page see? "1. without names"

So: the existing page can play sound and Android routes it; a voice has to be made somewhere else; and the page cannot know whether earbuds are connected.

Decision

  1. No native companion yet. Issue #1 proposes one for route awareness. The page can already do the playing, and Android's own routing satisfies the issue's rule of never forcing a route. What the page cannot do is know the route, which is item 2.
  2. Voice is a switch on the opening menu, off at every launch. Proposed to Dan as the consequence of the last row above; his answer: "yes on the voice menu entry, cap it". It is not saved, so a forgotten setting cannot speak from the loudspeaker next time.
  3. ElevenLabs, called by the bridge. Dan named it. The key stays on the server; the app receives audio only. One voice id per agent (HERMEVEN_AGENT_<ID>_VOICE); an agent without one is not read.
  4. Capped. Asked "speak the whole thing, or cap it (say the first 60 seconds)", Dan: "cap it". Implemented as characters, not seconds: 900 by default, cut at a sentence end. 900 characters is roughly a minute at an ordinary speaking rate; that equivalence is an estimate and has not been measured with any voice.
  5. Speech is of a turn, not of text. GET /v1/turns/{id}/speech reads only the caller's own finished answer. There is no endpoint that speaks arbitrary text, so a device credential cannot be used as a general speech account.
  6. Stopping. Reading stops when the answer leaves the screen (double tap, a new question by tap, name or typing) or Voice is switched off. Turning the page does not stop it. The app does not leave the glasses while it is reading.

Not done, on purpose

  • Detecting earbuds, the car, or "worn". Not possible from the page; issue #1 remains open for it.
  • Audio focus (pausing music, ducking), Android Auto behaviour, phone calls. Untested.
  • Streaming the audio as it is generated. The whole clip is fetched, then played.
  • A marker on the glasses that Voice is on outside the menu.
  • Reading questions back, or any speech not tied to an answer.

Risks to judge

  • Answers now go to a third party when Voice is on (security 3g).
  • The loudspeaker case (security 3h).
  • Cost is per character at ElevenLabs. Bounded per device by the cap and six syntheses a minute; not bounded per day.
  • MP3 decoding and playback in the Even app's WebView is untested. The sound check played a generated tone, not a decoded file.
  • The provider's API was written from its documentation as read on 2026-11-29 and has never been called by this code. The tests use a fake that imitates the documented request.