Add chime endpoint to TTS server

POST /chime {name} plays chimes/<name>.wav or .ogg via pacat.
Goes through the same queue as speak so playback stays ordered.
chimes/ directory holds the audio files (not committed).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-30 05:23:18 +00:00
parent 8604d7ea51
commit 688549a6c3
3 changed files with 50 additions and 4 deletions

View File

@@ -36,6 +36,18 @@ export class Tts_Client {
return res.json() // { voices: [{name, description, active}], current }
}
async chime(name) {
const res = await fetch(`${this._url}/chime`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name }),
})
if (!res.ok) {
const data = await res.json().catch(() => ({}))
throw new Error(data.error ?? `HTTP ${res.status}`)
}
}
async set_voice(name) {
const res = await fetch(`${this._url}/voice`, {
method: 'POST',