Direct Java sherpa-onnx integration for Parakeet TDT ASR.
Direct Java sherpa-onnx integration for Parakeet TDT ASR.
(chunk-plan total-samples sample-rate chunk-seconds)Pure: the [start end] SAMPLE ranges to decode, in order.
A recording shorter than chunk-seconds is ONE range (chunking cannot improve
a clip that decodes in a moment, and every extra boundary risks cutting a
word). A trailing piece shorter than min-audio-seconds is merged into the
one before it: a sliver of audio decodes blank or trips ONNX shape errors, and
it would be reported as a whole chunk of progress for nothing.
Pure: the `[start end]` SAMPLE ranges to decode, in order. A recording shorter than `chunk-seconds` is ONE range (chunking cannot improve a clip that decodes in a moment, and every extra boundary risks cutting a word). A trailing piece shorter than [[min-audio-seconds]] is merged into the one before it: a sliver of audio decodes blank or trips ONNX shape errors, and it would be reported as a whole chunk of progress for nothing.
Audio longer than this is decoded in pieces so PROGRESS is a measurement and
not an animation: each finished piece is a real fraction of the recording.
Parakeet is an offline (non-streaming) model, so a single decode call is a
black box of unknown length — the only honest progress it can report is how
much AUDIO has been consumed.
Audio longer than this is decoded in pieces so PROGRESS is a measurement and not an animation: each finished piece is a real fraction of the recording. Parakeet is an offline (non-streaming) model, so a single `decode` call is a black box of unknown length — the only honest progress it can report is how much AUDIO has been consumed.
(default-model-dir)~/.vis model path used when no env/config override is set. A function, never a
top-level def: native-image initializes this namespace at BUILD time, so a
captured user.home would point every installed binary at the BUILDER's home.
~/.vis model path used when no env/config override is set. A function, never a top-level `def`: `native-image` initializes this namespace at BUILD time, so a captured `user.home` would point every installed binary at the BUILDER's home.
(ensure-model!)(ensure-model! dir)Download + atomically install the Parakeet int8 model if missing (blocking).
Returns model dir. Used by the TUI's synchronous voice path; the web drives
a non-blocking download via start-download! + model-state.
Download + atomically install the Parakeet int8 model if missing (blocking). Returns model dir. Used by the TUI's synchronous voice path; the web drives a non-blocking download via `start-download!` + `model-state`.
Minimum microphone audio length sent to Parakeet ASR. Very short clips either transcribe blank or trigger opaque ONNX Conv_quant shape errors, so reject them before inference.
Minimum microphone audio length sent to Parakeet ASR. Very short clips either transcribe blank or trigger opaque ONNX Conv_quant shape errors, so reject them before inference.
(model-state)Current voice-model state for a UI to POLL: {:state :ready} model files installed {:state :downloading :progress 0..100} a background download is running {:state :failed :error "…"} the last download failed {:state :absent} not installed, idle (no download)
Current voice-model state for a UI to POLL:
{:state :ready} model files installed
{:state :downloading :progress 0..100} a background download is running
{:state :failed :error "…"} the last download failed
{:state :absent} not installed, idle (no download)(start-download!)Idempotent, NON-blocking: if the model is absent and no download is already
running, start one on a background thread (progress tracked in the atom).
Returns the current model-state immediately.
Idempotent, NON-blocking: if the model is absent and no download is already running, start one on a background thread (progress tracked in the atom). Returns the current `model-state` immediately.
(transcribe-file! audio-path)(transcribe-file! dir audio-path)(transcribe-file! dir audio-path {:keys [on-progress chunk-seconds]})Transcribe audio-path with local Parakeet TDT int8 through the sherpa-onnx
Java API. Auto-downloads the model on first use. Returns plain text.
opts may carry :on-progress, called with {:phase :progress} (:preparing
while the model and the native runtime are being made ready, then
:transcribing with 0..100 of the AUDIO consumed) and :chunk-seconds. A
throwing or slow callback can never fail a transcription: it is guarded here.
Transcribe `audio-path` with local Parakeet TDT int8 through the sherpa-onnx
Java API. Auto-downloads the model on first use. Returns plain text.
`opts` may carry `:on-progress`, called with `{:phase :progress}` (`:preparing`
while the model and the native runtime are being made ready, then
`:transcribing` with 0..100 of the AUDIO consumed) and `:chunk-seconds`. A
throwing or slow callback can never fail a transcription: it is guarded here.(validate-wav-file! audio-path)Structural RIFF/WAVE check in PURE JVM code before a file reaches
sherpa-onnx's native WaveReader, which SIGSEGVs AND ABORTS THE WHOLE JVM
on malformed input — including a well-formed header whose declared chunk
sizes overrun the bytes actually present (a truncated upload or partial
write; observed live). No catchable native exception is on offer, so
every chunk in the table must fit inside the file, and a 16-bit PCM
fmt chunk plus a data chunk must both be present (the only shape
either producer emits — ui.js's encoder and the TUI recorder — and the
only one WaveReader reads). Throws ex-info :voice-asr/invalid-wav.
Returns audio-path.
Structural RIFF/WAVE check in PURE JVM code before a file reaches sherpa-onnx's native WaveReader, which SIGSEGVs AND ABORTS THE WHOLE JVM on malformed input — including a well-formed header whose declared chunk sizes overrun the bytes actually present (a truncated upload or partial write; observed live). No catchable native exception is on offer, so every chunk in the table must fit inside the file, and a 16-bit PCM `fmt ` chunk plus a `data` chunk must both be present (the only shape either producer emits — ui.js's encoder and the TUI recorder — and the only one WaveReader reads). Throws ex-info :voice-asr/invalid-wav. Returns audio-path.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |