Keep the TTS echo at unity gain so the level drives the repeats

This commit is contained in:
Fisto
2026-09-21 18:29:13 +02:00
parent 63083c54ec
commit 267c31337c
4 changed files with 24 additions and 6 deletions
+7
View File
@@ -40,6 +40,13 @@ mobile draft at 390px.
- [x] C11 preview caching: Discord-hosted image/GIF previews (WebP 320px, hash-addressed, 5 MiB
cap, one attempt) run after every walk in both modes. Live run `...-20260916090722`:
`previewed: 2`; thumbs served over `/api/media/<scrape>/<item>/thumb` (200).
- [x] C73 Echo on the vox voice. `aecho`'s `in_gain`/`out_gain` scale the dry signal
as well as the repeats, so a low echo level quieted the whole line (the classic path's
loudnorm hid it; the streaming path has no measurement, so vox + stream word mode just
went quiet and the echo disappeared). The stage now runs at unity gain and the level
scales the repeats, with a limiter absorbing the summed peaks. Verified with the user's
settings: the no-echo, mild, and strong cases keep the same voice RMS while the echo
tail grows with the delay. Wrapper tests pass.
- [x] C72 Voice processing settings and the speak bypass. The TTS panel gained a **voice
processing** block (echo cancellation, auto gain, noise cancellation, and **off while
speaking**), stored in `preferences.voice` and applied live on save. While a TTS burst plays,
+1 -1
View File
@@ -665,7 +665,7 @@ Inputs: `{out}`, `{text_file}`, optional positional voice/speed/pitch/expression
| --- | --- |
| `VESKSLOP_TTS_PROFILE` | `pitch:27:...`/`key=value,...` overrides; the wrapper writes the full profile (defaults + overrides) to the Wine registry with `wine reg import` before every synthesis. |
| `VESKSLOP_TTS_HIGHPASS` | High-pass Hz, 40-400 (default 40). |
| `VESKSLOP_TTS_ECHO` | Mono echo 0-100 (`aecho`), default 0. |
| `VESKSLOP_TTS_ECHO` | Mono echo 0-100 (`aecho`), default 0. The echo is mixed under the dry voice, so the voice level does not change. |
| `VESKSLOP_TTS_WORDS` / `VESKSLOP_TTS_WORD_GAP_MS` | Word-by-word synthesis with silence gaps (Flextalk only). |
Placeholders `{profile}`, `{highpass}`, `{echo}`, `{words}`, `{word_gap_ms}` mirror the env vars.
+13 -3
View File
@@ -17,7 +17,8 @@
# VESKSLOP_TTS_HIGHPASS high-pass Hz (40-400, default 40)
# VESKSLOP_TTS_ECHO mono echo amount 0-100 (default 0)
# VESKSLOP_TTS_ECHO_DELAY_MS echo delay 10-400 (default 60)
# VESKSLOP_TTS_ECHO_LEVEL echo output gain 0-0.95 (default 0.85)
# VESKSLOP_TTS_ECHO_LEVEL echo repeat level 0-0.95, relative to the
# dry voice (default 0.85)
# VESKSLOP_TTS_CRUNCH off | hl90 | hl90hq | telephone | adpcm | crush
# (1990s lossy character, applied last)
# VESKSLOP_TTS_CRUNCH_BITS 1-16, overrides the preset bit depth
@@ -495,9 +496,18 @@ ECHO_LEVEL=$(awk -v v="$ECHO_LEVEL" 'BEGIN{ if (v<0) v=0; if (v>0.95) v=0.95; pr
SIL="silenceremove=start_periods=1:start_duration=0.05:start_silence=0.03:start_threshold=-50dB"
PRE="highpass=f=$HIGHPASS,$SIL,afade=t=in:st=0:d=0.008,areverse,$SIL,afade=t=in:st=0:d=0.008,areverse"
# aecho's in_gain/out_gain scale the dry signal as well, so a low ECHO_LEVEL used to
# quiet the whole line (and the streaming path, which skips the loudness measurement,
# had nothing to make it up). Keep both gains at unity and let the repeats' decay carry
# the level; the limiter absorbs the summed peaks.
if [ "$ECHO" -gt 0 ]; then
DECAY=$(awk -v e="$ECHO" 'BEGIN{printf "%.2f", 0.2 + e * 0.006}')
PRE="$PRE,aecho=0.8:${ECHO_LEVEL}:${ECHO_DELAY}:${DECAY}"
DECAY=$(awk -v e="$ECHO" -v l="$ECHO_LEVEL" 'BEGIN{
d = (0.2 + e * 0.006) * (l / 0.85);
if (d < 0.02) d = 0.02;
if (d > 0.95) d = 0.95;
printf "%.2f", d
}')
PRE="$PRE,aecho=1:1:${ECHO_DELAY}:${DECAY},alimiter=limit=0.98:level=disabled"
fi
# Compression stage ("crunch"): the lossy 1990s codec character, built as its own
+3 -2
View File
@@ -561,8 +561,9 @@
<span id="tts-echo-value" class="vk-mono vk-dim">off</span>
<span class="vk-micro-label">delay</span>
<input id="tts-echo-delay" class="input vk-num" type="number" min="10" max="400" />
<span class="vk-micro-label">level</span>
<input id="tts-echo-level" class="input vk-num" type="number" min="0" max="0.95" step="0.05" />
<span class="vk-micro-label" title="Echo repeat level, relative to the voice">lvl</span>
<input id="tts-echo-level" class="input vk-num" type="number" min="0" max="0.95" step="0.05"
title="Echo repeat level, relative to the voice; does not change the voice level" />
</div>
<div class="vk-profile-row">
<span class="vk-micro-label">crunch</span>