]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commit
whisper : fix VAD processing for skipped audio segments (#3230)
authorDaniel Bevenius <redacted>
Fri, 13 Jun 2025 15:35:52 +0000 (17:35 +0200)
committerGitHub <redacted>
Fri, 13 Jun 2025 15:35:52 +0000 (17:35 +0200)
commit705db0f728310c32bc96f4e355e2b18076932f75
tree6123dd0c274da2a814b0abde336a80d47af69b76
parent0a4d85cf8a301b18642f0ed98502d9677cb26857
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`.
src/whisper.cpp