Repository navigation
Commit f570ec0
npub1cc3ha7z055mu0rwwu7806t2wt8mj3pvu0uv5mfp2c50dahaqhczshdalg6
huddle(tts): drop leading fade-in to preserve consonant onsets
Symptom (reported 2026-05-18): "the first little sound or two in a
sentence is kind of getting skipped over." Affects every sentence,
not just the first one, and is independent of sentence length.
Root cause: `apply_fades` applied an 8 ms linear fade-in (192 samples
at 24 kHz) to the start of every synthesised sentence. Probing Pocket
TTS output across four prompts (Y/H/W/T onsets — see
`examples/pocket_onset_probe.rs`) shows real audio energy inside the
first millisecond:
prompt | samples[0] | peak@1ms rms@1ms
─────────────────────────────────────────────────────────────
Yep, I can hear you. | 0.00193 | 0.0331 0.0235
Hello there friend. | 0.00185 | 0.0288 0.0191
What can I help with? | 0.00180 | 0.0358 0.0242
Try this experiment now. | 0.00189 | 0.0197 0.0139
For 'Yep' and 'What' the first-1ms RMS is *equal to or greater than*
the first-5ms RMS — the consonant attack peaks inside the very window
the fade was nuking. A 0→1 linear ramp attenuated those onset samples
by ≥6 dB over the first 4 ms, which is exactly what Tyler heard as
"swallowed sounds".
`samples[0]` ≈ 0.0019 (≈ −54 dBFS) is far below any audible
DC-jump-click threshold, so removing the fade-in does not introduce
clicks. Fade-out is retained because end-of-sentence cuts *do* create
audible clicks when a non-zero waveform terminates abruptly.
Changes (3 files, +101/−24):
- `huddle/tts.rs`:
- Rename `apply_fades` → `apply_fade_out`. Body removes the leading
fade loop and operates on `&mut [f32]` instead of `&mut Vec<f32>`.
- New const `FIRST_APPEND_LEAD_IN_SAMPLES = 480` (20 ms) and a
single-shot `player.append(zeros)` at the `first_append` site, so
the OS audio device / rodio mixer gets a quiet ramp-up window
*without* scaling any real synthesis samples. Applied once per
utterance — sentence boundaries continue to use
`INTER_SENTENCE_SILENCE` (100 ms) and don't stack on this cushion.
- New regression test
`apply_fade_out_does_not_touch_leading_samples` locks in
`samples[0..FADE_OUT_SAMPLES]` are byte-equal to input. Will
fail loudly if anyone ever reintroduces a leading fade.
- `first_append_lead_in_is_sane` pins the 20 ms × 24 kHz = 480
constant and documents why that range is reasonable.
- Existing `apply_fades_*` tests renamed and updated; +2 net tests
(24 → 26 in tts.rs; 317 → 319 lib-wide).
- `examples/pocket_onset_probe.rs` (new, 137 lines): synthesises the
four probe prompts, dumps per-prompt onset stats (samples[0],
peak/RMS @ 1ms/5ms/20ms), and writes raw WAVs to /tmp for offline
inspection. Documents the measurement that justifies removing the
fade-in; runs against the same `/tmp/pocket-tts-bench` model
directory `pocket_bench` uses.
- `desktop/scripts/check-file-sizes.mjs`: bump `tts.rs` override
1130 → 1210 with updated description.
Verification before push:
- `cargo test --lib` (full) → 319/319 pass.
- `cargo fmt --check` clean.
- `cargo check` (desktop tauri crate) clean.
- `pnpm check` (biome + file-sizes) clean.
- Manual A/B not yet done from the worktree — Tyler will hear the
result on `cargo run` after pull.
Discussion: thread root c0f5988e in #sprout-desktop-lighter-tts
(initial diagnosis, Max's review of approach, probe data).
Signed-off-by: Tyler Longwell <[email protected]>
Signed-off-by: npub1cc3ha7z055mu0rwwu7806t2wt8mj3pvu0uv5mfp2c50dahaqhczshdalg6 <c6237ef84fa537c78dcee78efd2d4e59f728859c7f194da42ac51ededfa0be05@sprout-oss.stage.blox.sqprod.co>1 parent 1dbfa2c commit f570ec0
3 files changed
Lines changed: 247 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
74 | | - | |
75 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
76 | 91 | | |
77 | 92 | | |
78 | 93 | | |
| |||
385 | 400 | | |
386 | 401 | | |
387 | 402 | | |
388 | | - | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
389 | 416 | | |
390 | 417 | | |
391 | 418 | | |
| |||
474 | 501 | | |
475 | 502 | | |
476 | 503 | | |
477 | | - | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
478 | 509 | | |
479 | | - | |
480 | | - | |
481 | | - | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
482 | 527 | | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
| 528 | + | |
489 | 529 | | |
490 | 530 | | |
491 | 531 | | |
| |||
1036 | 1076 | | |
1037 | 1077 | | |
1038 | 1078 | | |
1039 | | - | |
| 1079 | + | |
1040 | 1080 | | |
| 1081 | + | |
| 1082 | + | |
1041 | 1083 | | |
1042 | | - | |
| 1084 | + | |
1043 | 1085 | | |
1044 | | - | |
1045 | | - | |
1046 | | - | |
1047 | | - | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
1048 | 1089 | | |
1049 | 1090 | | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
1050 | 1095 | | |
1051 | | - | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
1052 | 1115 | | |
1053 | | - | |
| 1116 | + | |
1054 | 1117 | | |
1055 | 1118 | | |
1056 | 1119 | | |
1057 | 1120 | | |
1058 | | - | |
| 1121 | + | |
| 1122 | + | |
1059 | 1123 | | |
1060 | | - | |
| 1124 | + | |
1061 | 1125 | | |
1062 | 1126 | | |
1063 | 1127 | | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
1064 | 1138 | | |
1065 | 1139 | | |
1066 | 1140 | | |
| |||
0 commit comments