TTS redeems: envelope letter with words inked in as spoken

- TTS alerts use the new `tts` style: envelope opens, the letter rises out
  and settles in front near the top, words ink in as the voice says them
  (timed from a loudness curve the server sends: tts.loudness, tts_env,
  tts_prefix); if the voice fails, the full text shows
- Highlight my message keeps its taped note

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Bashy 2026-11-21 14:42:36 +02:00
parent 4fda6060bf
commit 060b2351f7
6 changed files with 122 additions and 9 deletions

View file

@ -50,8 +50,8 @@ function pick(variations) {
}
function toAlert(v, { user, input, emote }) {
const spoken = !!(v.tts_voice_id && input); // TTS variations are shown as the big paper note
const style = spoken ? 'message' : (STYLE[`${v.kind}:${v.key}`] || 'cassette');
const spoken = !!(v.tts_voice_id && input); // TTS variations: envelope letter (fx.js envelope())
const style = spoken ? 'tts' : (STYLE[`${v.kind}:${v.key}`] || 'cassette');
const line = spoken ? LINE.tts : LINE[style];
return {
type: 'redeem', kind: v.kind, key: v.key, style,
@ -81,6 +81,8 @@ async function addSpeech(v, alert) {
const out = await tts.synth(voice.config, say);
alert.tts = out.url;
alert.tts_ms = out.durationMs;
alert.tts_env = await tts.loudness(out.file); // word timing on the overlay
alert.tts_prefix = say === text ? 0 : 2; // words spoken before the message ("<name> says:")
} catch (e) {
console.warn(`[tts] ${alert.user}: ${e.message}`);
}