Commit 705db0f
authored
whisper : fix VAD processing for skipped audio segments (#3230)
This commit addresses an issue with token timestamps when audio segments
are skipped, in `whisper_exp_compute_token_level_timestamps` related to
the VAD processing and the energy levels.
The motivation for this is that the token timestamps exceed the energy
array bounds due to segment timing misalignment:
```console
(skipped introduction)
↓
Audio segment: [2600ms → 5600ms] (3 seconds of actual audio)
Energy array: [0 → 480652] (samples for 3 seconds)
Token timestamps: [3266ms → 3408ms] (absolute timestamps)
```
So both `s0` and `t1` get clamped to the maximum sample index (480652)
which causes the start/end timestamps to be the same for all the tokens
after a certain point.
This is addressed by using segment-relative timestamps in the
`timestamp_to_sample` and `sample_to_timestamp`.1 parent 0a4d85c commit 705db0f
1 file changed
+18
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8325 | 8325 | | |
8326 | 8326 | | |
8327 | 8327 | | |
8328 | | - | |
8329 | | - | |
8330 | | - | |
8331 | | - | |
8332 | 8328 | | |
8333 | 8329 | | |
8334 | 8330 | | |
| |||
8378 | 8374 | | |
8379 | 8375 | | |
8380 | 8376 | | |
| 8377 | + | |
| 8378 | + | |
| 8379 | + | |
| 8380 | + | |
| 8381 | + | |
| 8382 | + | |
| 8383 | + | |
| 8384 | + | |
| 8385 | + | |
| 8386 | + | |
| 8387 | + | |
| 8388 | + | |
8381 | 8389 | | |
8382 | 8390 | | |
8383 | 8391 | | |
| |||
8518 | 8526 | | |
8519 | 8527 | | |
8520 | 8528 | | |
8521 | | - | |
8522 | | - | |
| 8529 | + | |
| 8530 | + | |
8523 | 8531 | | |
8524 | 8532 | | |
8525 | 8533 | | |
| |||
8540 | 8548 | | |
8541 | 8549 | | |
8542 | 8550 | | |
8543 | | - | |
| 8551 | + | |
8544 | 8552 | | |
8545 | 8553 | | |
8546 | 8554 | | |
| |||
8551 | 8559 | | |
8552 | 8560 | | |
8553 | 8561 | | |
8554 | | - | |
| 8562 | + | |
8555 | 8563 | | |
8556 | 8564 | | |
8557 | 8565 | | |
| |||
8561 | 8569 | | |
8562 | 8570 | | |
8563 | 8571 | | |
8564 | | - | |
| 8572 | + | |
8565 | 8573 | | |
8566 | 8574 | | |
8567 | 8575 | | |
| |||
8572 | 8580 | | |
8573 | 8581 | | |
8574 | 8582 | | |
8575 | | - | |
| 8583 | + | |
8576 | 8584 | | |
8577 | 8585 | | |
8578 | 8586 | | |
| |||
0 commit comments