Long audio: let Whistle window it, then take control only when needed
Thirty seconds is Whistle's encoding window, not a file-length limit. The current native API accepts recordings of arbitrary length, windows them automatically, and streams live audio without a fixed total-duration cap. Here is when to use that default and when manual control is still worth it.
Enter the recording length. Thirty seconds or less is one encoder window; a longer native transcription is windowed automatically. Manual cutting is only an optional implementation choice.
Why 30 seconds is an encoding window
Whistle's encoder is non-causal: a word at 3 seconds can look at information from 12 seconds. It therefore receives a complete 30-second window. The front end produces a frame every 10 ms, the convolutional stem halves that three times, and 30 seconds becomes 375 frames of 80 ms each. Longer native transcriptions are split into windows internally rather than rejected.
Three paths, one default
For a normal recording, pass the file to needle.transcribe() once and let automatic windowing handle it. The best-practices article says each window carries through to the last complete sentence, and the next window resumes there. For live or incrementally arriving audio, needle.stream(chunks) has no fixed total-duration limit. The community browser package [email protected] is different: its transcribe() call accepts at most 30 seconds, so a browser implementation must segment audio before calling it. If you need a precise split point, word timestamps, or control over a browser-side pipeline, use the manual splitter below as an optional route.
When manual split points are useful
Automatic windowing is the default; a manual splitter is for cases where you want a cut to land on a known pause or need to feed a constrained browser API. The helper below searches a 3-second band around each 24-second mark and picks the quietest 20 ms frame. The 24-second mark leaves headroom, and a cut in a quiet frame is less likely to divide a word. This is not required for native long-file transcription.
import wave, numpy as np
def frame_rms(x, sr, frame_ms=20, hop_ms=10):
f, h = int(sr*frame_ms/1000), int(sr*hop_ms/1000)
win = np.lib.stride_tricks.sliding_window_view(x, f)[::h]
return np.sqrt((win.astype(np.float64)**2).mean(axis=1)), np.arange(len(win))*h
def find_cut_points(x, sr, mark_s=24.0, search_s=3.0, max_s=30.0):
maxlen = int(sr*max_s)
if len(x) <= maxlen:
return [0, len(x)]
mark, window = int(sr*mark_s), int(sr*search_s)
cuts, pos = [0], 0
while len(x) - pos > maxlen:
center = pos + mark
lo = max(pos+1, center-window)
hi = min(center+window, pos+maxlen-1)
rms, offs = frame_rms(x[lo-int(sr*0.02):hi], sr)
pos = lo + int(offs[int(np.argmin(rms))]) if len(rms) else pos+maxlen
cuts.append(pos)
cuts.append(len(x))
return cuts
The optional manual route
If you choose to split manually, transcribe each piece and add that piece's offset to every returned word timestamp before merging the results. Use this path when you need a known manual boundary or are feeding the 30-second browser API. The native one-call path already performs automatic windowing, so do not add this layer unless it solves a concrete problem.
import needle
from core.splitter import read_wav_mono, find_cut_points, shift_words
x, sr = read_wav_mono("long.wav") # 16 kHz mono 16-bit PCM only
cuts = find_cut_points(x, sr)
segments, language = [], None
for i in range(len(cuts)-1):
piece = x[cuts[i]:cuts[i+1]]
out = needle.transcribe(piece, language=language, word_timestamps=True)
language = language or out["language"] # pin the language the first piece detected
segments.append({"offset_s": cuts[i]/sr, "words": out.get("words", [])})
print(out["text"])
words = shift_words(segments) # back onto the timeline of the whole file
Four details to recheck before shipping
The engine measures loudness before decoding and returns empty text below a threshold, so filter empty windows rather than treating them as a failure. A 30-second window also has a 320-token decoder ceiling, which very dense speech can reach. Browser transcribe() calls are limited to 30 seconds even though native transcription is not. Finally, the documentation does not define how word timestamps behave after automatic native windowing; request word timestamps on a representative long clip before you depend on them.
Why silence sometimes comes back as Thank you
A user reported on Hacker News that running Whistle over a television episode occasionally stalled and emitted "Thank you." for 60 seconds straight. The silence short-circuit handles clean silence, but noisy audio past the 30-second window can still trigger filler text. That is a known edge of a 16.9 MB model: when it happens, suspect audio outside the design case before reaching for parameters.
Questions people ask
Can I hand the native API a recording longer than 30 seconds?
Yes. The current README says needle.transcribe() accepts arbitrary lengths and automatically windows longer audio. The 30-second limit belongs to the encoder input, not the file. The browser package [email protected] is the exception: its transcribe() call accepts at most 30 seconds.
Does automatic windowing drop words at the seams?
The best-practices article says windowing carries through to the last complete sentence and resumes from there, which is designed to avoid cutting a sentence. That is still a model behaviour to measure on your audio. A manual hard cut can divide speech, so use the quiet-frame splitter only when you need explicit control.
Why not use Whisper's long-audio handling?
Both systems process audio in windows. The practical difference is integration and accuracy on your domain, not simply whether an API accepts a long file. Compare WER on the same long recording, review the seams, and include browser constraints if that is your runtime.
Related
- Whistle keeps mishearing my product name: how keyword biasing works and where it stops
- Measure a baseline before optimising anything
- Check the device can keep up with the cutting
- Whistle vs Whisper base, in full