Liking cljdoc? Tell your friends :D

com.blockether.vis.ext.foundation-voice.asr

Direct Java sherpa-onnx integration for Parakeet TDT ASR.

Direct Java sherpa-onnx integration for Parakeet TDT ASR.
raw docstring

chunk-planclj

(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.
sourceraw docstring

default-chunk-secondsclj

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.
sourceraw docstring

default-model-dirclj

(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.
sourceraw docstring

ensure-model!clj

(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`.
sourceraw docstring

min-audio-secondsclj

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.
sourceraw docstring

model-dirclj

(model-dir)
source

model-dir-envclj

source

model-filesclj

(model-files)
(model-files dir)
source

model-installed?clj

(model-installed?)
(model-installed? dir)
source

model-stateclj

(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)
sourceraw docstring

model-urlclj

source

start-download!clj

(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.
sourceraw docstring

transcribe-file!clj

(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.
sourceraw docstring

validate-wav-file!clj

(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.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close