TTS: allow up to 500 characters, smaller handwriting on the letter for long messages
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
50fd4b1cad
commit
cf90b6be54
5 changed files with 12 additions and 7 deletions
|
|
@ -46,9 +46,14 @@
|
||||||
@keyframes fx-flap { from { transform:rotateX(180deg); z-index:4; } }
|
@keyframes fx-flap { from { transform:rotateX(180deg); z-index:4; } }
|
||||||
#fx-alert .envl .slot { position:absolute; left:-40px; right:-40px; bottom:0; top:-400px; overflow:hidden; z-index:2; animation:fx-zswap 1.6s .8s both; }
|
#fx-alert .envl .slot { position:absolute; left:-40px; right:-40px; bottom:0; top:-400px; overflow:hidden; z-index:2; animation:fx-zswap 1.6s .8s both; }
|
||||||
@keyframes fx-zswap { 0%, 54% { z-index:2; } 55%, 100% { z-index:6; } }
|
@keyframes fx-zswap { 0%, 54% { z-index:2; } 55%, 100% { z-index:6; } }
|
||||||
#fx-alert .envl .letter { position:absolute; left:62px; bottom:30px; width:316px; min-height:290px; background:#fffdf7; padding:18px 22px 22px;
|
#fx-alert .envl .letter { --fs:24px; --lh:30px; position:absolute; left:62px; bottom:30px; width:316px; min-height:290px; background:#fffdf7; padding:18px 22px 22px;
|
||||||
box-shadow:0 4px 12px rgba(0,0,0,.3); animation:fx-rise 1.6s .8s both;
|
box-shadow:0 4px 12px rgba(0,0,0,.3); animation:fx-rise 1.6s .8s both;
|
||||||
background-image:repeating-linear-gradient(transparent 0 29px, rgba(110,150,200,.3) 29px 30px); background-position:0 46px; }
|
background-image:repeating-linear-gradient(transparent 0 calc(var(--lh) - 1px), rgba(110,150,200,.3) calc(var(--lh) - 1px) var(--lh));
|
||||||
|
background-position:0 calc(22px + var(--lh) - 6px); }
|
||||||
|
/* longer messages: smaller handwriting, the ruled lines follow */
|
||||||
|
#fx-alert .envl .letter.long { --fs:20px; --lh:25px; }
|
||||||
|
#fx-alert .envl .letter.longer { --fs:17px; --lh:21px; width:340px; }
|
||||||
|
#fx-alert .envl .letter.huge { --fs:15px; --lh:18px; width:356px; }
|
||||||
@keyframes fx-rise {
|
@keyframes fx-rise {
|
||||||
0% { transform:translateY(110px); animation-timing-function:cubic-bezier(.3,.7,.4,1); }
|
0% { transform:translateY(110px); animation-timing-function:cubic-bezier(.3,.7,.4,1); }
|
||||||
45% { transform:translateY(-200px) rotate(-1deg); }
|
45% { transform:translateY(-200px) rotate(-1deg); }
|
||||||
|
|
@ -56,7 +61,7 @@
|
||||||
100% { transform:translateY(-14px) rotate(-2deg); }
|
100% { transform:translateY(-14px) rotate(-2deg); }
|
||||||
}
|
}
|
||||||
#fx-alert .envl .to { font:700 22px/1 Caveat, cursive; color:var(--red); margin-bottom:6px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
#fx-alert .envl .to { font:700 22px/1 Caveat, cursive; color:var(--red); margin-bottom:6px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
||||||
#fx-alert .envl .tx { font:700 24px/30px Caveat, cursive; color:var(--ink); word-wrap:break-word; }
|
#fx-alert .envl .tx { font:700 var(--fs)/var(--lh) Caveat, cursive; color:var(--ink); word-wrap:break-word; }
|
||||||
#fx-alert .envl .w { opacity:.12; transition:opacity .25s; }
|
#fx-alert .envl .w { opacity:.12; transition:opacity .25s; }
|
||||||
#fx-alert .envl .w.on { opacity:1; }
|
#fx-alert .envl .w.on { opacity:1; }
|
||||||
#fx-alert .envl .seal { position:absolute; left:157px; bottom:86px; width:46px; height:46px; z-index:5; border-radius:50%; background:#b74347;
|
#fx-alert .envl .seal { position:absolute; left:157px; bottom:86px; width:46px; height:46px; z-index:5; border-radius:50%; background:#b74347;
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@
|
||||||
const text = d.msg || '';
|
const text = d.msg || '';
|
||||||
const words = text.split(/\s+/).filter(Boolean);
|
const words = text.split(/\s+/).filter(Boolean);
|
||||||
el.innerHTML = `<div class="envl"><div class="flap"></div>
|
el.innerHTML = `<div class="envl"><div class="flap"></div>
|
||||||
<div class="slot"><div class="letter"><div class="to">from ${esc(d.name)} ♡</div>
|
<div class="slot"><div class="letter ${text.length > 340 ? 'huge' : text.length > 230 ? 'longer' : text.length > 140 ? 'long' : ''}"><div class="to">from ${esc(d.name)} ♡</div>
|
||||||
<div class="tx">${words.map(w => `<span class="w">${esc(w)}</span>`).join(' ')}</div></div></div>
|
<div class="tx">${words.map(w => `<span class="w">${esc(w)}</span>`).join(' ')}</div></div></div>
|
||||||
<div class="env"></div><div class="seal">♥</div></div>`;
|
<div class="env"></div><div class="seal">♥</div></div>`;
|
||||||
el.style.visibility = 'visible';
|
el.style.visibility = 'visible';
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ router.post('/', (req, res) => {
|
||||||
gap_audio_min_volume: flt(b.gap_audio_min_volume, 0.2),
|
gap_audio_min_volume: flt(b.gap_audio_min_volume, 0.2),
|
||||||
gap_audio_max_volume: flt(b.gap_audio_max_volume, 1.0),
|
gap_audio_max_volume: flt(b.gap_audio_max_volume, 1.0),
|
||||||
gap_audio_loud_after: int(b.gap_audio_loud_after, 3600),
|
gap_audio_loud_after: int(b.gap_audio_loud_after, 3600),
|
||||||
tts_max_chars: Math.max(20, Math.min(300, int(b.tts_max_chars, 200))),
|
tts_max_chars: Math.max(20, Math.min(500, int(b.tts_max_chars, 200))),
|
||||||
tts_say_name: b.tts_say_name === 'on' ? 1 : 0,
|
tts_say_name: b.tts_say_name === 'on' ? 1 : 0,
|
||||||
tts_blocklist: String(b.tts_blocklist || '').slice(0, 20000),
|
tts_blocklist: String(b.tts_blocklist || '').slice(0, 20000),
|
||||||
custom_css: b.custom_css || '',
|
custom_css: b.custom_css || '',
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ const VOICES_DIR = process.env.TTS_VOICES_DIR || path.join(ROOT, 'tools/tts/voic
|
||||||
const OUT_DIR = path.join(ROOT, 'public/tts');
|
const OUT_DIR = path.join(ROOT, 'public/tts');
|
||||||
const TMP_DIR = path.join(OUT_DIR, 'tmp');
|
const TMP_DIR = path.join(OUT_DIR, 'tmp');
|
||||||
const KEEP_FILES = 300; // cached mp3s kept in public/tts (oldest deleted first)
|
const KEEP_FILES = 300; // cached mp3s kept in public/tts (oldest deleted first)
|
||||||
const MAX_CHARS = 300;
|
const MAX_CHARS = 500; // Twitch chat messages are max 500 characters
|
||||||
const SR = 44100;
|
const SR = 44100;
|
||||||
|
|
||||||
const LIMITS = {
|
const LIMITS = {
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@
|
||||||
<div style="display:grid; grid-template-columns:1fr 1fr; gap:1rem;">
|
<div style="display:grid; grid-template-columns:1fr 1fr; gap:1rem;">
|
||||||
<label>
|
<label>
|
||||||
Max length (characters)
|
Max length (characters)
|
||||||
<input type="number" name="tts_max_chars" value="<%= settings.tts_max_chars %>" min="20" max="300">
|
<input type="number" name="tts_max_chars" value="<%= settings.tts_max_chars %>" min="20" max="500">
|
||||||
<small>Longer messages are cut at a word.</small>
|
<small>Longer messages are cut at a word.</small>
|
||||||
</label>
|
</label>
|
||||||
<label style="align-self:center;">
|
<label style="align-self:center;">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue