Liking cljdoc? Tell your friends :D

com.blockether.vis.internal.speech.qwen

Qwen3-TTS-12Hz-1.7B-CustomVoice text to speech through ONNX Runtime.

:qwen3-tts-local Nine built-in speakers. Each speaker can read ten languages, and the language of the text selects the language prompt.

The bundle is the cpu_int4 ONNX export of speed-brain-ai. Its graphs are:

text_embed text token ids to projected embeddings codec_embed codec token ids to talker embeddings talker_cache the talker with a KV cache: the first codebook of a frame code_predictor_loop the other 15 codebooks of a frame, sampled in the graph residual_embed the 16 codes of a frame to the next talker input tok_decoder frames to 24 kHz audio, 1920 samples for each frame

A voice imported from a recording uses the Base model, the cpu_int4 export of onnx-community. It has its own codec_embed and residual_embed, and these graphs:

speaker_encoder 24 kHz audio to the speaker vector of the codec prompt tok_encoder one second of 24 kHz audio to 13 frames of codes

bin/export-qwen-base makes its other graphs. Its text_embed and talker_cache are the onnx-community graphs with int8 activations, which are several times faster on a CPU. Its code predictor has a KV cache, so each codebook is one step of one row:

code_predictor_step rows and a KV cache to the logits of one codebook code_predictor_embed a code of one codebook to its input row

It uses the tokenizer and the decoder of the speaker bundle.

The prompt and the sampling follow the reference generation of Qwen3-TTS (Qwen3TTSModel.generate in mlx-audio): the whole text goes into the prefill, and each later step feeds the embedded frame plus the pad embedding. The KV caches stay in native memory, as in com.blockether.vis.internal.speech.vibevoice.

Qwen3-TTS-12Hz-1.7B-CustomVoice text to speech through ONNX Runtime.

  :qwen3-tts-local  Nine built-in speakers. Each speaker can read ten languages,
                    and the language of the text selects the language prompt.

The bundle is the `cpu_int4` ONNX export of speed-brain-ai. Its graphs are:

  text_embed           text token ids to projected embeddings
  codec_embed          codec token ids to talker embeddings
  talker_cache         the talker with a KV cache: the first codebook of a frame
  code_predictor_loop  the other 15 codebooks of a frame, sampled in the graph
  residual_embed       the 16 codes of a frame to the next talker input
  tok_decoder          frames to 24 kHz audio, 1920 samples for each frame

A voice imported from a recording uses the Base model, the `cpu_int4` export of
onnx-community. It has its own codec_embed and residual_embed, and these graphs:

  speaker_encoder  24 kHz audio to the speaker vector of the codec prompt
  tok_encoder      one second of 24 kHz audio to 13 frames of codes

`bin/export-qwen-base` makes its other graphs. Its text_embed and talker_cache
are the onnx-community graphs with int8 activations, which are several times faster
on a CPU. Its code predictor has a KV cache, so each codebook is one step of one row:

  code_predictor_step   rows and a KV cache to the logits of one codebook
  code_predictor_embed  a code of one codebook to its input row

It uses the tokenizer and the decoder of the speaker bundle.

The prompt and the sampling follow the reference generation of Qwen3-TTS
(`Qwen3TTSModel.generate` in mlx-audio): the whole text goes into the prefill,
and each later step feeds the embedded frame plus the pad embedding. The KV
caches stay in native memory, as in [[com.blockether.vis.internal.speech.vibevoice]].
raw docstring

assetclj

(asset)
source

asset-idclj

source

chunk-charsclj

The longest text of one generation. A longer text is split at sentence ends, as the quality of one prefill drops on long text.

The longest text of one generation. A longer text is split at sentence ends, as
the quality of one prefill drops on long text.
sourceraw docstring

chunk-gap-secondsclj

Silence between two chunks of one text.

Silence between two chunks of one text.
sourceraw docstring

chunksclj

(chunks text)

text in pieces of at most chunk-chars, split at sentence ends and line breaks. A sentence that is longer stays whole.

`text` in pieces of at most [[chunk-chars]], split at sentence ends and line
breaks. A sentence that is longer stays whole.
sourceraw docstring

clone-assetclj

(clone-asset)
source

clone-asset-idclj

The Base model, which speaks in an imported voice.

The Base model, which speaks in an imported voice.
sourceraw docstring

codec-vocabclj

Codec tokens of the talker head, with the control tokens above 2047.

Codec tokens of the talker head, with the control tokens above 2047.
sourceraw docstring

decode-framesclj

(decode-frames bundle frames)
(decode-frames {:keys [graphs]} frames context)

The samples of frames. The decoder hears the last frames of context first.

The samples of `frames`. The decoder hears the last frames of `context` first.
sourceraw docstring

default-seedclj

Noise seed of a request without one, so the same text in the same voice gives the same audio.

Noise seed of a request without one, so the same text in the same voice gives
the same audio.
sourceraw docstring

descriptorclj

source

encode-referenceclj

(encode-reference {:keys [graphs]} samples)

The codec frames of 24 kHz samples, one for each started 80 ms.

The codec frames of 24 kHz `samples`, one for each started 80 ms.
sourceraw docstring

export-assetclj

(export-asset)
source

export-asset-idclj

The Vis export of the Base model: its code predictor, talker and text_embed.

The Vis export of the Base model: its code predictor, talker and text_embed.
sourceraw docstring

frame-limitclj

(frame-limit piece)

The most frames for the text piece. One character takes about one frame, and a Chinese character about three. A clone that never ends its speech stops here, not at max-frames.

The most frames for the text `piece`. One character takes about one frame, and a
Chinese character about three. A clone that never ends its speech stops here,
not at [[max-frames]].
sourceraw docstring

generate-framesclj

(generate-frames {:keys [graphs config]} prompt limit noise report)

The codec frames of one chunk, up to limit. Calls report with the frame count.

The codec frames of one chunk, up to `limit`. Calls `report` with the frame count.
sourceraw docstring

max-framesclj

The most frames of one text chunk, about 160 seconds. Generation stops here even without an end-of-speech token.

The most frames of one text chunk, about 160 seconds. Generation stops here even
without an end-of-speech token.
sourceraw docstring

prefill-embeddingsclj

(prefill-embeddings bundle ids codec)
(prefill-embeddings {:keys [graphs config]} ids codec {:keys [text-ids steps]})

The talker input of the prefill. A clone adds the transcript and codec frames of its reference recording.

The talker input of the prefill. A clone adds the transcript and codec frames of
its reference recording.
sourceraw docstring

prepare-voice-sample!clj

(prepare-voice-sample! voice-id)

Speak the shared sample sentence in voice-id with the installed model and keep the file. Never downloads the model.

Speak the shared sample sentence in `voice-id` with the installed model and keep
the file. Never downloads the model.
sourceraw docstring

referenceclj

(reference {:keys [graphs tokenizer] :as bundle} {:keys [clip clip-text]})

The speaker vector of a recording and, if it has a transcript, its text ids, codec frames and frame embeddings.

The speaker vector of a recording and, if it has a transcript, its text ids,
codec frames and frame embeddings.
sourceraw docstring

sample-first-codeclj

(sample-first-code logits offset history eos noise)

Draw the first code of a frame, with control tokens blocked except end of speech.

Draw the first code of a frame, with control tokens blocked except end of speech.
sourceraw docstring

sample-rateclj

source

speakclj

(speak dir text voice)
(speak dir
       text
       voice
       {:keys [seed report] :or {seed default-seed report (fn [_])}})

Speak text in voice with the speaker bundle in dir. An imported voice uses the installed Base model. Returns the mono samples and their rate.

Speak `text` in `voice` with the speaker bundle in `dir`. An imported voice uses
the installed Base model. Returns the mono samples and their rate.
sourceraw docstring

synthesize!clj

(synthesize! {:keys [text voice-id on-progress seed]})

Speak text and return the WAV that was written, plus the facts a player needs. The model is installed first when it is missing, reported as :preparing.

Speak `text` and return the WAV that was written, plus the facts a player
needs. The model is installed first when it is missing, reported as `:preparing`.
sourceraw docstring

text-languageclj

(text-language text)

The language of text as a Qwen3-TTS language name, or nil when the text is in none of its ten languages. The script decides first; for Latin script, the most frequent common words decide.

The language of `text` as a Qwen3-TTS language name, or nil when the text is in
none of its ten languages. The script decides first; for Latin script, the most
frequent common words decide.
sourceraw docstring

voice-sampleclj

(voice-sample voice-id)

The sample of voice-id, without making one: {:audio-path …} on disk, {:is-preparable true} when the installed model can speak it, or nil.

The sample of `voice-id`, without making one: `{:audio-path …}` on disk,
`{:is-preparable true}` when the installed model can speak it, or nil.
sourceraw docstring

voicesclj

(voices)

The speakers of the bundle, from the manifest, so a surface can list them before the download. Then the voices imported from a recording, which the Base model speaks.

The speakers of the bundle, from the manifest, so a surface can list them before
the download. Then the voices imported from a recording, which the Base model
speaks.
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