Keep the TTS echo at unity gain so the level drives the repeats
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user