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:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user