Liking cljdoc? Tell your friends :D

com.blockether.vis.internal.speech.transcode

Whatever somebody recorded, as the 16-bit PCM WAV every local model reads.

A recorder never asks what the model wants. An iPhone memo is .m4a (AAC in an MP4 box), an Android one .amr, .aac or .m4a, a browser records .ogg or .webm, a shared clip arrives as .mp3, and sherpa-onnx reads exactly ONE container: RIFF/WAVE, 16-bit PCM. So every path that turns audio into text meets the SAME question — voice INPUT in the TUI, a recording ATTACHED to a message, a clip IMPORTED as a voice — and it is answered once, here.

Vis ships no decoder of its own: AAC, Opus and AMR are a codec suite rather than a namespace, and a wrong decoder is silence that transcribes into confident words. ffmpeg is the one converter a machine reliably has, so a non-WAV recording goes through it into a TEMP mono 16 kHz file that is deleted the moment the work is done.

Whatever somebody recorded, as the 16-bit PCM WAV every local model reads.

A recorder never asks what the model wants. An iPhone memo is `.m4a` (AAC in an
MP4 box), an Android one `.amr`, `.aac` or `.m4a`, a browser records `.ogg` or
`.webm`, a shared clip arrives as `.mp3`, and sherpa-onnx reads exactly ONE
container: RIFF/WAVE, 16-bit PCM. So every path that turns audio into text meets
the SAME question — voice INPUT in the TUI, a recording ATTACHED to a message,
a clip IMPORTED as a voice — and it is answered once, here.

Vis ships no decoder of its own: AAC, Opus and AMR are a codec suite rather than
a namespace, and a wrong decoder is silence that transcribes into confident
words. `ffmpeg` is the one converter a machine reliably has, so a non-WAV
recording goes through it
into a TEMP mono 16 kHz file that is deleted the moment the work is done.
raw docstring

->wav!clj

(->wav! file)

file as a readable 16-bit PCM WAV, converted only when it is not one already.

Answers {:file <File> :is-temp <bool>}; the caller DELETES a temp file (see with-wav, which is that contract written down). Throws :speech/no-ffmpeg when conversion is needed and impossible, :speech/unreadable when ffmpeg refused the container.

`file` as a readable 16-bit PCM WAV, converted only when it is not one already.

Answers `{:file <File> :is-temp <bool>}`; the caller DELETES a temp file (see
[[with-wav]], which is that contract written down). Throws `:speech/no-ffmpeg`
when conversion is needed and impossible, `:speech/unreadable` when ffmpeg
refused the container.
sourceraw docstring

ffmpeg-pathclj

(ffmpeg-path)

The ffmpeg this process can execute, or nil. Resolved per call: a machine that installs it while Vis runs converts the next recording without a restart.

The `ffmpeg` this process can execute, or nil. Resolved per call: a machine that
installs it while Vis runs converts the next recording without a restart.
sourceraw docstring

missing-ffmpeg-messageclj

(missing-ffmpeg-message file)

The refusal a human can ACT on: what is wrong, and the one command that fixes it.

The refusal a human can ACT on: what is wrong, and the one command that fixes it.
sourceraw docstring

wav?clj

(wav? file)

Is this file a RIFF/WAVE container at all? Cheap enough to ask before deciding whether a converter is needed — the head, never the whole recording.

Is this file a RIFF/WAVE container at all? Cheap enough to ask before deciding
whether a converter is needed — the head, never the whole recording.
sourceraw docstring

with-wavclj

(with-wav file f)

Call f with file as a 16-bit PCM WAV and delete the conversion afterwards.

The deletion is the whole point of the fn: a converted memo is a temp file per transcription, and a caller that forgets fills the temp directory with the user's own speech.

Call `f` with `file` as a 16-bit PCM WAV and delete the conversion afterwards.

The deletion is the whole point of the fn: a converted memo is a temp file per
transcription, and a caller that forgets fills the temp directory with the
user's own speech.
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