Skip to main content

Sherpa TTS Node

SherpaTTS node is responsible for converting text into natural-sounding speech using advanced text-to-speech algorithms.

Configuration

NameTypeDescription
textStringInitial text to render.

Values

This object does not provide any values.

Actions

NameParametersDescription
synthesizetext: StringStarts rendering of text as audio.
loadModelmodelPath: String
tokensPath: String
dataPath: String
Loads a Sherpa model from the provided paths.

Events

This object does not provide any events.

Example

This example generates speech audio and renders it in real-time on the device's speaker.

{
"type": "RealTimeGraphRenderer",
"config": {
"graph": {
"config": {
"sampleRate": 16000,
"bufferSize": 512
},
"nodes": [
{
"id": "ttsNode",
"type": "Sherpa.SherpaTTSNode"
},
{
"id": "monoToMultiChannelNode",
"type": "MonoToMultiChannel"
}
],
"connections": [
{
"sourceNode": "ttsNode",
"destinationNode": "monoToMultiChannelNode"
},
{
"sourceNode": "monoToMultiChannelNode",
"destinationNode": "outputNode"
}
]
}
}
}

To generate speech with the TTS node, call the synthesize action and provide the desired text as a parameter.

auto result = SwitchboardV3::callAction("ttsNode", "synthesize", { { "text", text } });