feat(app): an earcon tells the speaker Jarvis took the call

A short two-tone chime, made in code, plays right before each voice answer
starts and at once for a wake word said alone while Jarvis is free; the
question that joins it gets no second one. call.earcon turns it off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-12 10:30:55 +09:00
parent 1bebc1c531
commit cefe9b9253
9 changed files with 224 additions and 14 deletions

View File

@@ -34,6 +34,7 @@ app/
├── src/discord.rs # Discord client (serenity), voice (songbird), slash command, chat channels
├── src/receive.rs # per-speaker reorder window and Opus decoding
├── src/playback.rs # speech queue (TTS requests -> sentence clips -> player)
├── src/earcon.rs # the earcon sound, made in code
├── src/speakers.rs # who is transcribed right now (max speakers)
├── src/chat.rs # chat channel access rules and message splitting
├── src/worker_client.rs # WebSocket client for the voice worker
@@ -155,6 +156,9 @@ and the late "left" update cancelled the new join (seen on real Discord).
`cancel(id)` stops one request (its clip if playing, the worker's unsent sentences, or the speech of
an answer still being written) and the rest of the queue goes on. `ask_addressed(id, user, text)` and
`ask_rank(id, candidates)` pass the conversation's questions to the brain.
- **Earcon** (M4): `earcon()` queues the app's own earcon clip (`app/src/earcon.rs`, 48 kHz stereo,
peak 0.3 of full scale) as a request of its own: no worker round trip, `SpeakStart`/`SpeakEnd` like
any request, dropped by a stop. None when not in a voice channel.
- **Stop** (slash command `stop`, or `stop()`): the current clip stops at the next 20 ms mix, every
queued request is dropped, and unfinished requests are cancelled at the worker; each ends with
`cancelled: true`. Stopping by voice ("자비스, 멈춰") is call detection's stop (`conversation.spec.md`),
@@ -206,7 +210,8 @@ registered until it is removed (M5 setup).
## Tests
- `cargo test`: unit tests for the receive window (with a tagging fake and real libopus), playback
order, gaps, stop and cancel, speaker limit, chat access and splitting, settings, frames; the worker
order, gaps, stop and cancel, the earcon clip (before an answer, dropped by a stop; its sound short,
silent at both ends, below its peak), speaker limit, chat access and splitting, settings, frames; the worker
link against a fake server (hello, events, reconnect, failed TTS); the worker process with a
stand-in `voice_worker` package run by a real Python (token only in the environment, restart on the
same port, stop).