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 file that is deleted the moment the work is done. A caller that
names a sample rate (Parakeet reads 16 kHz) also gets every other WAV converted to
that rate, so a 48 kHz recording is not held in memory at three times its size.
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 file that is deleted the moment the work is done. A caller that names a sample rate (Parakeet reads 16 kHz) also gets every other WAV converted to that rate, so a 48 kHz recording is not held in memory at three times its size.
(->wav! file & [rate])file as a readable 16-bit PCM WAV, converted only when it is not one already.
With rate, a WAV whose fmt chunk is not mono 16-bit PCM at rate is converted
too, when this machine has ffmpeg.
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.
With `rate`, a WAV whose fmt chunk is not mono 16-bit PCM at `rate` is converted
too, when this machine has ffmpeg.
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.(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.
(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.
(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.
(with-wav file f)(with-wav file rate 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. rate is the sample rate the reader needs (->wav!).
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. `rate` is the sample rate the reader needs ([[->wav!]]).
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 |