Commit 4b0cf7f
authored
Fix ScaleSilence copying past the pause interval when scale > 1 (#3744)
GeneratedAudio::ScaleSilence() lengthens each detected pause by copying
n = (interval.end - interval.start) * scale samples starting at
interval.start.
When scale > 1 that is n > interval.end - interval.start, so the copy
runs past the end of the pause and into the audio that follows it. Two
consequences:
- The beginning of the next word is duplicated, which is audible as a
stutter after every pause.
- On the last interval, interval.end == num_samples, so
samples.begin() + interval.start + n is past samples.end() and the
insert reads out of bounds.
Copy the pause once and pad with zeros to the requested length instead.
For scale <= 1 the behaviour is unchanged, and scale == 1 still returns
early before reaching this code.1 parent 97293f0 commit 4b0cf7f
1 file changed
Lines changed: 15 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
86 | 97 | | |
87 | 98 | | |
88 | 99 | | |
| |||
0 commit comments