VAD-based pre-segmentation of long recordings for transcription with Whisper models such as FrWhisper: fewer repetition loops, reliable time axis.
Author: Annette Gerstenberg
Code drafted with assistance from Anthropic Claude (Opus 4.8, Fable 5.2), 2026
Reviewed and tested by the author
Repository: https://github.com/gerstanne/vad-presegmentation
The workflow was developed for and tested with FrWhisper, a Whisper model fine-tuned for French, and uses it by default. FrWhisper is a verbatim transcription model, trained on voices of different ages, including older speakers.
For other languages, change one line. FrWhisper transcribes French. For recordings in
another language, set MODEL at the top of 3_transcribe.py to another Whisper-type model
from Hugging Face, for example openai/whisper-large-v3. Everything else in the workflow
is independent of the model.
Whisper-type models can fall into repetition loops: the model loses its place and writes the same word or phrase over and over, dozens of times. This text is invented; it has no basis in the audio. When a long recording (for example an interview of an hour) is transcribed as one stream, such loops can swallow whole passages, and the time axis of the transcript can break down as well.
This workflow reduces both problems by cutting each recording at pauses before transcription. Every chunk is transcribed on its own and keeps the global start and end time it had in the recording, so the time axis of the final transcript comes from the cut, never from the model's own timestamps. Loops become rarer, and a loop stays confined to one chunk of a few seconds.
Loops do not disappear. A single short chunk can still come back with the same phrase repeated dozens of times. The last step of the workflow therefore looks for such repetitions and lists every affected chunk on screen and in a log, so that these places can be checked against the audio. The transcript itself keeps the model output unchanged. If you want, the loops can also be shortened automatically; this is switched off by default. See Repetition loops.
| file | step | purpose |
|---|---|---|
1_vad_textgrid.py |
1 | Silero VAD; writes a chunks TextGrid and a manifest of global chunk times per recording |
2_Divide_folder_by_tiername.praat |
2 | cuts each long WAV into one WAV per labelled chunk |
3_transcribe.py |
3 | transcribes the chunk WAVs into one TSV |
4a_tsv_to_trs.py |
4 | reassembles one Transcriber .trs per recording on the global time axis |
4b_tsv_to_textgrid.py |
4 | writes the transcribed text into the chunk intervals of the VAD TextGrid |
requirements.txt |
Python packages | |
references.bib, CITATION.cff |
citations |
Whisper-type models transcribe in 30-second windows and stitch the timestamps of these windows back into one time axis. On long and difficult recordings this stitching can fail: the returned timestamps stop far before the end of the recording, and the text collapses into a few very long blocks. The workflow therefore does not rely on the model's timestamps.
- Silero VAD detects speech and silence. It is a small neural detector that runs on CPU. Unlike an intensity threshold, it does not mistake low-energy speech sounds such as long voiceless fricatives for silence.
- The recording is cut at silences of a minimum length (
MIN_PAUSE_MS). Chunks longer than an upper bound (MAX_CHUNK_S) are split at their best internal pause. - Each chunk is transcribed on its own and placed back at the global time recorded when the recording was cut.
- Python 3 with a virtual environment
- Praat (tested with version 7.0; the cutting script uses
createFolder) - Several GB of disk space for the transcription model (downloaded on the first run)
Set up and activate a virtual environment.
Windows PowerShell:
python -m venv .venv
.venv\Scripts\Activate.ps1
macOS / Linux:
python3 -m venv .venv
source .venv/bin/activate
Install the packages:
python -m pip install -r requirements.txt
For a CPU-only installation of torch, install torch and torchaudio first from the CPU index:
python -m pip install "torch<2.9" "torchaudio<2.9" --index-url https://download.pytorch.org/whl/cpu
python -m pip install -r requirements.txt
torch and torchaudio are limited to versions below 2.9. From version 2.9 on, torchaudio
needs the additional package torchcodec to read audio files; the earlier versions work
without it. They announce this change with two warnings every time an audio file is read.
1_vad_textgrid.py hides these two notices; all other warnings and all errors stay visible.
Check before the first run:
python -c "import silero_vad, soundfile, torchaudio, transformers; print('ok')"
The model is downloaded from Hugging Face on the first run of step 3. If this fails with a message about access or authentication, the model requires a Hugging Face account:
- Create an account on https://huggingface.co and, if the model page asks for it, request access to the model there.
- Create an access token in your account settings (Access Tokens).
- In the activated environment, run
hf auth loginonce and paste the token (older versions of the package usehuggingface-cli login).
To try the workflow without an account, set MODEL in 3_transcribe.py to an open model
such as openai/whisper-large-v3.
The scripts contain no machine-specific paths. Put them into one project folder; they create and read the following subfolders and files of that folder:
project folder/
├── 1_vad_textgrid.py ... 4b_tsv_to_textgrid.py
├── long/ long source WAVs; TextGrids, manifests and final outputs
│ └── chunks/ chunk WAVs and TextGrids cut by Praat
├── transcripts.tsv transcription output (model output, unchanged)
├── transcribe_errors.log transcription errors, if any
└── workflow.log record of every run
Audio files and all outputs are excluded from version control by .gitignore.
All settings are at the top of the scripts.
| script | setting | meaning |
|---|---|---|
1_vad_textgrid.py |
VAD parameters | see VAD parameters |
3_transcribe.py |
MODEL |
default aihpi/FrWhisper (French). For other languages any Whisper-type model from Hugging Face, for example openai/whisper-large-v3 |
3_transcribe.py |
LANGUAGE |
None: the model detects the language of each file itself. With a multilingual model, set it (for example "german") to fix the language; recommended, because detection can fail on short chunks |
3_transcribe.py |
MODE |
"append" resumes an interrupted run, "overwrite" starts over (the old TSV is kept as a backup copy) |
4a_tsv_to_trs.py |
LANG |
the xml:lang attribute written into the .trs header (for example "fr"). It only labels the file and has nothing to do with LANGUAGE in step 3 |
4a_tsv_to_trs.py |
SCRIBE |
the scribe attribute of the .trs; enter the name of the model here to record it in the transcript |
4a_tsv_to_trs.py |
SPK1_NAME |
name of the first speaker |
4a, 4b |
COLLAPSE_REPEATS |
False (default): repetition loops are reported, the transcript is not changed. True: loops are shortened as well. See Repetition loops |
4a, 4b |
MAX_REPEAT |
a phrase repeated more often than this in a row (default 3) counts as a loop |
4a, 4b |
OUTPUT_SUFFIX |
appended to the name of the recording in the output file name |
Preparation. Put all long WAV files into the folder long.
-
VAD. Run
python 1_vad_textgrid.pyFor every
<source>.wavit writes intolong:<source>.TextGridwith achunkstier: speech chunks labelled 1..N, pauses empty;<source>_chunks.tsv, the manifest with the global start and end of every chunk.
This step does not cut any audio.
-
Cut. Open
2_Divide_folder_by_tiername.praatin Praat and run it withDirectory_name:long(default),Tier_name:chunks,Segment_prefix:utt(default).
It writes one WAV and one TextGrid per chunk into
long/chunks, named<source>_utt01.wav,<source>_utt02.wav, ... Pauses are not cut.If Praat reports that no WAV files were found, enter the full path of the folder in
Directory_name, with forward slashes, for exampleC:/project/long. -
Transcribe. Run
python 3_transcribe.pyIt transcribes every WAV in
long/chunksand writes the segments totranscripts.tsv. The name of the model is shown when it is loaded and again at the end of the run, and it is recorded inworkflow.log.The TSV has the columns
file,segment,start,end,duration,text.startandendare the model's timestamps inside the chunk;endis usually empty, because the model gives no end time for the last segment of a file. Neither is used later. -
Reassemble. Run either or both:
python 4a_tsv_to_trs.py python 4b_tsv_to_textgrid.py4awriteslong/<source>_asr.trs, one<Turn>per chunk underspk2, with a<Sync/>at the chunk's global start;4bwriteslong/<source>_asr.TextGrid, the VAD TextGrid with the transcribed text in the chunk intervals.
Both match chunks by the number in the file name; the
.trstakes its times from the manifests inlong. Both report repetition loops (see below).
Check the result: look up the chunks with repetition loops listed in workflow.log and
compare them with the audio (see Repetition loops and
Caveats).
Running the workflow again. If you repeat step 1 with other VAD parameters, the chunks
change. Delete the folder long/chunks and the file transcripts.tsv before you continue
(or set MODE = "overwrite" in step 3). Otherwise step 3 skips chunk files whose names are
already in the TSV, and the old transcripts are placed on the new chunk times.
- Loops are always detected and listed. In step 4, a word or phrase of up to six words
that is repeated more than
MAX_REPEATtimes in a row (default 3) counts as a loop. Each affected chunk is named on screen and inworkflow.log, with the recording, the chunk number and the number of words. This is the list of places to check against the audio. - By default nothing is changed. With
COLLAPSE_REPEATS = False, the.trsand the TextGrid contain exactly what the model returned, including complete loops. - Shortening is optional. With
COLLAPSE_REPEATS = Truein4aand4b, the loops are cut down. Because the count can start in the middle of a loop, up toMAX_REPEAT+ 1 occurrences of the phrase may remain, often followed by a broken-off fragment. Long loops or loops with varying wording are reduced, but not fully removed. - Shortened text is still invented text. The shortening makes a loop smaller, not correct. These places have to be corrected by hand in either case.
- Genuine repetitions look the same. The scripts cannot tell a loop from a speaker who really repeats a word. Five times "no" in a row are reported as a loop, and become three if the shortening is on. This is the reason why the shortening is off by default.
- The model output is always kept.
transcripts.tsvcontains what the model returned for each chunk and is never shortened, whatever the setting.
Set at the top of 1_vad_textgrid.py. All values are starting points; adjust to your data.
| parameter | value | meaning |
|---|---|---|
MIN_PAUSE_MS |
800 | minimum silence that closes a chunk |
MAX_CHUNK_S |
10 | upper bound for chunk length; longer chunks are split at their best internal pause |
SPEECH_PAD_MS |
200 | audio kept on each side of a chunk |
MIN_SPEECH_MS |
300 | shorter speech is dropped |
THRESHOLD |
0.5 | speech probability threshold |
Small changes of the chunk boundaries can change the wording of the transcript, and a repetition loop can appear or disappear with them.
Each Python script appends one block per run to workflow.log: date and time, the name of
the script, its settings, the versions of Python and of the packages it uses, and the
result. The file is never overwritten. Example (version numbers are placeholders):
[2026-11-17 10:15:02] 1_vad_textgrid.py
settings: MIN_PAUSE_MS=800, MAX_CHUNK_S=10, SPEECH_PAD_MS=200, MIN_SPEECH_MS=300, THRESHOLD=0.5, TIER_NAME=chunks
versions: python x.y.z, torch x.y.z, torchaudio x.y.z, silero-vad x.y.z
rec01.wav: 26 chunks, 185.336 s
[2026-11-17 10:42:37] 4a_tsv_to_trs.py
settings: OUTPUT_SUFFIX=_asr, SCRIBE=ASR, LANG=fr, COLLAPSE_REPEATS=False, MAX_REPEAT=3
versions: python x.y.z
rec01: 26 chunks -> rec01_asr.trs
repetition loops found in 1 chunk(s), not shortened
rec01 chunk 21: 247 words, 27 when shortened
The Praat script shows its result in the Info window and does not write to the log.
Errors during transcription are written to transcribe_errors.log.
- Speaker assignment is manual. The VAD does not distinguish speakers; all chunks are
placed under
spk2, and turns are assigned to speakers later in Transcriber. - The VAD is a coarse pre-segmentation. Its chunks sit at acoustic pauses, not at syntactic boundaries.
- One Sync per chunk. Chunk boundaries come from the cut; the model's timestamps inside a chunk are not used.
- Repetition loops remain possible, see above.
The Python scripts and the documentation are released under the MIT License (see LICENSE):
you may use, modify and redistribute them, provided the copyright notice is kept.
2_Divide_folder_by_tiername.praat extends Christian DiCanio's Sound_file_division.praat
and is included here with his permission. The copyright of the original script remains
with Christian DiCanio; it is not covered by the MIT License of this repository.
If you use this workflow, please cite it (see also CITATION.cff):
@misc{Gerstenberg.2026,
author = {Gerstenberg, Annette},
title = {Pause-based pre-segmentation for long-form transcription with {Whisper}-type models},
year = {2026},
address = {Potsdam},
url = {https://github.com/gerstanne/vad-presegmentation},
note = {Python and Praat scripts, developed for transcription with FrWhisper}
}If you transcribe with the default model, please cite FrWhisper as well:
@misc{FrWhisper.2026,
author = {Müller, Hanno and Gerstenberg, Annette},
title = {FrWhisper},
year = {2026},
address = {Potsdam},
url = {https://huggingface.co/aihpi/FrWhisper}
}Please also cite the tools the workflow builds on, in particular DiCanio's script, as he
requests. All entries are in references.bib: Praat (Boersma.2026), DiCanio.2020 and
Silero VAD (Silero.2024).