SynthesizerSherpa¶
processing extra: synthesizer-sherpa
Text to speech with sherpa-onnx, on CPU and without torch: the text of each message becomes one audio message.
- Node type:
SynthesizerSherpa- Input:
ObjectPayload- Output:
AudioPayload- Extra:
synthesizer-sherpa
$ pip install "juturna-nodes[synthesizer-sherpa]"
The node downloads its default model on first use. The node README describes the model cache, the input and output messages, and the licenses of the code and the weights.
Model and lexicon¶
The node supports the Kitten and Kokoro model families of the sherpa-onnx releases. Since sherpa-onnx 2.0 these models need a pronunciation lexicon.
By default the node downloads on first use:
Kitten nano int8 (no license stated, see License):
model.int8.onnx,voices.binandtokens.txt, 28 MB, from the Hugging Face repository at a pinned revision;when
lexiconis empty,lexicon-en-us.txt(6.3 MB) from thetts-modelsrelease of sherpa-onnx.
Each file is checked against its size and SHA-256 on download. The files are
kept in ~/.cache/juturna/models/<model>/ (or under $XDG_CACHE_HOME), and
later runs reuse them after checking their size and SHA-256.
The lexicon is not distributed with this package: the node downloads it from
the sherpa-onnx release. Its header says it was generated from CMUdict and
an en_list word list; the sherpa-onnx release states no license for it.
To use a model you already have, for example Kokoro, set model_dir to its
folder and model_type to its family; model is then ignored.
Words missing from the lexicon are skipped, which includes most names. Kitten nano int8 (28 MB) is the smaller and faster model; Kokoro int8 (Apache-2.0, 140 MB) has a more natural voice but is slower.
Arguments¶
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Model downloaded into the cache; the default is the only model this node supports |
|
|
|
Model folder, holding one ONNX file, |
|
|
|
Model family: |
|
|
|
Pronunciation lexicon file; empty to download |
|
|
|
Voice to use, among the voices of the model |
|
|
|
Speech speed, 1.0 being the natural speed of the voice |
|
|
|
CPU threads used by the model |
Input message¶
Field |
Use |
|---|---|
|
The text to speak, required. An empty or missing text is ignored |
meta is not read. PrompterOllama produces this format.
Output message¶
Field |
Content |
|---|---|
|
Mono |
|
Rate of the model (24000 Hz for Kitten and Kokoro) |
|
|
|
|
|
The text that was spoken |
The message keeps the version and the timers of the input message, and adds
a <node name> timer with the synthesis time. If the model produces no audio
(for example, every word is missing from the lexicon), a warning is logged
and nothing is transmitted.
License¶
The default voice is for demos: its weights and lexicon state no license.
Weights: the default model is downloaded from csukuangfj2/kitten-nano-en-v0_8-int8, whose card states no license; it is converted from KittenML/kitten-tts-nano-0.8-int8, Apache-2.0 on its model card. With
model_dir, the license is the one of the model you use.Lexicon:
lexicon-en-us.txtcomes from the sherpa-onnxtts-modelsrelease; no source we found states its license.Runtime: sherpa-onnx, Apache-2.0.
requests: Apache-2.0 (the license of requests on PyPI), to download the default model.
Pipeline usage¶
{
"name": "tts",
"type": "SynthesizerSherpa",
"configuration": {}
}
Configuration¶
Default node arguments, as defined in the node config.toml file. Any of
them can be overridden in the node configuration of a pipeline.
[arguments]
model = "kitten-nano-en-v0_8-int8"
model_dir = ""
model_type = "kitten"
lexicon = ""
speaker_id = 0
speed = 1.0
num_threads = 2
[meta]
Reference¶
- class SynthesizerSherpa(
- model: str,
- model_dir: str,
- model_type: str,
- lexicon: str,
- speaker_id: int,
- speed: float,
- num_threads: int,
- **kwargs,
Synthesize speech from text with a sherpa-onnx model