dsh-voice-recite: Emotion-Based Text-to-Speech Plugin with Duration Control

Introduction

The DeepSeek Harness (DSH) plugin ecosystem is built on the philosophy of “everything is a plugin,” allowing developers to encapsulate specific capabilities into modular components. In agent development scenarios, generating expressive speech from a model’s output is a common need. However, existing solutions often lack precise control over duration and struggle with personalized treatment of specific characters (e.g., stretching a particular syllable or adding vibrato). The DSH plugin dsh-voice-recite provides a “spoken narration” capability tailored for DSH, enabling text-to-expressive-audio conversion through both a form panel and an Agent tool, with fine-grained control over the timeline and vocal quality.

What It Is

dsh-voice-recite is a plugin for DeepSeek Harness, developed by maintainer FDE-fast. It leverages Microsoft’s Edge Neural Speech service (edge-tts) to synthesize expressive speech from text, supporting precise duration control via a timeline, independent elongation and vibrato for specified characters, and simultaneous output in both WAV and MP3 formats.

The plugin provides a dedicated panel in DSH’s left sidebar with a form-based interface; it also registers the Agent tool recite, which can be called directly from agent code.

Core Features

  • Precise Duration Control: Specify the audio start and end points in seconds via the “Start Time” and “End Time” parameters. Audio duration = End − Start. WAV is precise to the sample point; MP3 is limited to ~36 ms due to frame length.
  • Elongation: Independently stretch a specified character longer. In the panel, enter the “Elongation Text” and “Elongation Seconds” (extra seconds to stretch) or use the multiplier slider. Elongation only affects the vowel core, avoiding consonants and pauses for a natural result.
  • Vibrato: Independently add vibrato to a specified character. Enter the “Vibrato Text” and adjust vibrato depth (in cents). The plugin also supports sentence-final vibrato and pitch drop.
  • Voice & Rate/Pitch: Supports Edge voices, specifiable via the voice parameter; speech rate (rate) and pitch (pitch) are adjustable, with defaults of -25% and +18Hz respectively.
  • Output Formats: Simultaneously outputs WAV (24 kHz PCM) and MP3 (32 kHz / 128 kbps).
  • Preview & Confirm: The panel provides a “Preview” button for auditioning; after confirmation, “Confirm Output” writes the files to the target directory.

Installation & Activation

Search for Spoken Narration or dsh-voice-recite in DSH’s Plugins → Discover section to install.

Option 2: From npm

dsh plugin --profile <profile> add dsh-voice-recite

Option 3: Local Directory

After downloading the repository, select the package directory in Plugins → Add Plugin, or:

dsh plugin --profile <profile> add /path/to/dsh-voice-recite

Typical Usage

Panel Operations

  1. Click “Spoken Narration” in the left sidebar.
  2. Enter the text to be read, and select the voice and rate/pitch.
  3. Fill in “Start Time” and “End Time” in seconds (up to two decimal places), e.g., 5.14 and 8.13 to produce a 2.99-second audio.
  4. Use “Browse…” to select the output directory.
  5. Enter the “Elongation Text” (e.g., 大) and “Elongation Seconds” (e.g., 0.6, meaning stretch an additional 0.6 seconds; enter 0 to use the multiplier slider).
  6. Enter the “Vibrato Text” (e.g., 了) and adjust the vibrato depth.
  7. Click “Preview” to audition; once satisfied, click “Confirm Output” to write to the directory.

Agent Invocation Example

recite({
  text: "老大,我摔倒了。",
  voice: "zh-CN-XiaoyiNeural",
  startTime: 5.14,
  endTime: 8.13,
  outputDir: "C:\\Users\\me\\Desktop\\out",
  dragText: "大",
  dragSeconds: 0.6,
  vibratoText: "了",
  vibrato: 12,
})

Parameter Reference

Parameter Description
text The text to be read aloud
voice Edge voice short name, defaults to zh-CN-XiaoyiNeural
startTime / endTime In seconds; duration = end − start
outputDir Output directory (absolute path)
dragText / elongate / dragSeconds Character(s) to elongate; when dragSeconds > 0, the “extra seconds” mode takes priority
vibratoText / vibrato Character(s) to add vibrato to, and the depth (in cents)
tailVibrato / tailFall Sentence-final vibrato and pitch drop
rate / pitch Speech rate and pitch, defaults -25% / +18Hz
filename Output filename (without extension)

How It Works

  1. Synthesizes text using Microsoft Edge Neural Speech (edge-tts), obtaining MP3 and word-boundary timestamps.
  2. Locates specific syllables by character, stretching only the vowel core (not consonants or pauses) for a more natural elongation.
  3. Applies subtle vibrato and a pitch drop at the sentence end to simulate a specific tonal conclusion.
  4. Trims the overall output to the target duration: prioritizes trimming leading/trailing silence, and applies slight time-stretching if necessary.
  5. WAV is written directly as 24 kHz PCM (precise to the sample point); MP3 is encoded via LAME to the nearest frame (32 kHz / 128 kbps).

Dependencies & Limitations

  • Internet required: Synthesis relies on Microsoft Edge’s online speech service.
  • Python 3.10+ required: The plugin bundles dependencies for Windows/Python 3.12; on other platforms, the first run will install engine/requirements.txt into the user cache directory via pip.
  • Edge voices are part of Microsoft’s service; usage is subject to their terms. This repository contains only the invocation code.
  • MP3 frame length is 36 ms, so sample-level precision is not achievable; use WAV for projects with strict timing requirements.

Use Cases & Caveats

  • Ideal for scenarios requiring expressive speech generation in DSH with fine-grained control over duration and specific characters, such as audiobooks, dubbing scripts, and interactive audio content.
  • The plugin runs with the current DSH process permissions. It is recommended to review the source code and license before installing.
  • This plugin has no official affiliation with DeepSeek / High-Flyer (幻方); the community directory is an independent site.

Summary

dsh-voice-recite provides DeepSeek Harness with expressive text-to-speech capability, supporting precise timeline-based duration control, independent elongation and vibrato, and dual WAV/MP3 output. It is well-suited for agent development scenarios that require controllable speech content generation.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye