Introduction¶
In the development scenarios of DSH Host, Text-to-Speech (TTS) typically requires binding to specific engines. The dsh-tts plugin decouples this logic, focusing on “synthesis” and “timestamp” calculation, while leaving the audio engine (such as Microsoft Edge or local command-line tools) as an external dependency. It does not decide which audio sounds better or how to concatenate clips; it simply produces files and numbers for the caller to process.
Core Features¶
The plugin provides three main tools, covering the entire workflow from synthesis to inspection:
tts_speak: Supports bothspeak(single text segment) anddialogue(multi-speaker script) modes.speakoutputs audio and a word-by-word timestamp sidecar file;dialoguegenerates a manifest and global word-level timestamps.tts_setup: Provides three actions:status,voices, andcheck. Used to verify engine availability, enumerate voice lists, and synthesize a self-test sentence.tts_guide: Provides four actions:overview,tool,action, andrules. Used to read complete reference documentation, including parameter descriptions, measured data, and edge cases.
Providers and Configuration¶
The plugin supports two providers, selected via configuration:
edge(default): Based on the Microsoft Edge Read Aloud endpoint. Requires no Key, relies on the network, and provides word-by-word timestamps (server-sideWordBoundary). Local testing identified 322 voices, including 14 starting with Chinese (zh).command: A local TTS command-line engine. Requires no network, and engine upgrades do not require modifying the plugin. Uses template placeholders to pass parameters, such as{out},{text},{timings}, etc.
command Configuration Example¶
command:
path: 'C:/tools/piper/piper.exe'
args: ['--model', 'C:/tools/piper/zh_CN-huayan-medium.onnx', '--output_file', '{out}']
textMode: 'stdin'
outFormat: 'wav'
voices: ['zh_CN-huayan-medium']
Installation and Activation¶
Installation requires no build step; it can be mounted directly in the profile using link:.
- insert:
- id: dsh-tts
name: 'dsh-tts'
config: { provider: null, outDir: null, ffprobePath: null, edge: { voice: null }, command: null }
By default, the edge provider is ready to use out of the box. If no local engine is configured, tts_setup will report this truthfully.
Typical Usage¶
Run src/bin/tts.mjs using Node.js:
- Check environment and ffprobe:
node src/bin/tts.mjs doctor
- View Chinese voice list:
node src/bin/tts.mjs voices --locale zh
- Synthesize a text segment:
node src/bin/tts.mjs say "text to speak" --out a.mp3
- Check synthesis quality (including trailing silence):
node src/bin/tts.mjs check
- Synthesize multi-speaker dialogue script:
node src/bin/tts.mjs dialogue --script s.txt --voices host-a=...,host-b=...
- View rules documentation:
node src/bin/tts.mjs rules
Output and Contract¶
A synthesis operation generates two files: an audio file and a sidecar file with the same name (.words.json). The words array contains word-by-word text and start/end times, which can be directly read by downstream subtitle workflows (such as video_narrate).
In dialogue mode, in addition to the aforementioned sidecar file, a dialogue.manifest (containing clips and verification) and dialogue.words.json are also generated. verification is used to check whether audio clips fall within file boundaries; its value is true (measured and within file), false (out of bounds), or null (not measured).
Notes¶
- Commercial Licensing: The commercial licensing for the
edgeprovider is unspecified; it is recommended for use only in drafts and personal content. For commercial use, please switch to thecommandprovider and use a locally hosted engine with explicit licensing. - Local Engine Limitations: There is currently no ready-made solution for Chinese word-level timestamps in pure Node local engines; local engine speed is approximately 1.1x real-time, and Chinese synthesis requires assistance from Python-side toolkits.
- Integration Dependencies: The integration dependency of
video_narrateondsh-video-audiohas not yet been rebuilt (as of 2026-10-04), so it currently cannot flow through the standard process.