dsh-pet-tts
English | 中文
Speak the dsh-pet pet's speech bubbles aloud using Microsoft Edge's online neural voices. The browser half watches the .dsh-pet-bubble DOM node; the host half synthesizes mp3 through a private Python virtualenv running the open-source edge-tts client.
Not a general-purpose "read the assistant's reply" plugin — it is scoped to the pet's own bubbles, so it stays quiet unless the pet actually says something. If you want the assistant's messages read instead, use one of the reply-reading plugins in the market.
Requirements
- DeepSeek Harness with a web UI (dsh web / the desktop app's web view). Tested on 0.2.1-rc.5.
- dsh-pet for the bubbles (optional — the console API below works even without it).
- Python 3.9+ on
PATH, or pointDSH_PET_TTS_SYSTEM_PYTHONat an interpreter. - Network access to
speech.platform.bing.com, and once to PyPI (or a mirror) for the one-timeedge-ttsinstall. - Node.js 20+.
Install
dsh plugin --profile <your-profile> add github:jimmyfenwick/dsh-pet-tts
or from a release tarball:
dsh plugin --profile <your-profile> add https://github.com/jimmyfenwick/dsh-pet-tts/releases/latest/download/dsh-pet-tts.tgz
Restart or reload the host, then click once inside the page (browsers block audio before a user gesture) and let the pet say something.
On first synthesis the plugin creates a virtualenv at ~/.dsh/dsh-pet-tts/venv and installs edge-tts into it — roughly 30 MB, one time, nothing global. Progress appears in the host log as [dsh-pet-tts] creating virtualenv … / installing edge-tts ….
Presets
| id | voice | rate | pitch | volume | feel |
|---|---|---|---|---|---|
anime-girl (default) |
zh-CN-XiaoyiNeural | +35% | +38Hz | +10% | bright, fast, anime-girl |
anime-girl-hi |
zh-CN-XiaoyiNeural | +35% | +50Hz | +10% | higher, childlike |
anime-girl-soft |
zh-CN-XiaoyiNeural | +20% | +38Hz | +10% | same pitch, calmer pace |
anime-boy |
zh-CN-YunxiNeural | +20% | +15Hz | +5% | young male |
netstar |
zh-CN-XiaoxiaoNeural | +25% | +25Hz | +10% | short-video narrator |
xiaoyi-raw |
zh-CN-XiaoyiNeural | +0% | +0Hz | +0% | natural |
xiaoxiao-raw |
zh-CN-XiaoxiaoNeural | +0% | +0Hz | +0% | natural, general purpose |
The pitch/rate values mirror the ones shipped by dsh-pet-dfeiyu-mo, so the same voices sound familiar.
Console API
dshPetTTS.setPreset('anime-girl-hi') // switch preset, persisted in localStorage
dshPetTTS.say('主人,我回来了') // speak one line immediately
dshPetTTS.say('你好', { voice: 'en-US-AriaNeural', rate: '+10%' })
dshPetTTS.mute(true) // silence; mute(false) to resume
await dshPetTTS.voices() // all Microsoft voices known to the host
await dshPetTTS.health() // { ready, python, edgeTts, dataRoot }
Routes
The host exposes a prefix route, useful for scripting or a custom frontend:
GET /dsh-pet-tts/ping → { ok, defaultPreset, presets }
GET /dsh-pet-tts/health → { ready, python, edgeTts, dataRoot, venv }
GET /dsh-pet-tts/presets → full preset table
GET /dsh-pet-tts/voices → every voice Microsoft currently returns
GET /dsh-pet-tts/say?text=…&preset=… → audio/mpeg
extras: voice=, rate=, pitch=, volume=
Synthesized audio is cached under ~/.dsh/dsh-pet-tts/cache keyed by text + voice + parameters, so repeated lines cost nothing.
Configuration
| env var | meaning |
|---|---|
DSH_PET_TTS_ROOT |
data directory (default $DSH_HOME/dsh-pet-tts) |
DSH_PET_TTS_PYTHON |
use this interpreter as-is, skip the virtualenv entirely |
DSH_PET_TTS_SYSTEM_PYTHON |
base interpreter used to create the virtualenv |
If pip install cannot reach PyPI, the plugin retries the Tsinghua mirror first, then upstream PyPI; set DSH_PET_TTS_PYTHON to a pre-provisioned interpreter to skip installation altogether.
Limitations
- Voice text is capped at 300 characters per bubble; longer lines are truncated, because a pet bubble is not a paragraph.
- Only DOM nodes with the
dsh-pet-bubbleclass are spoken. - The first sound waits for a click/keypress — browser autoplay policy, not a plugin bug.
- Synthesis needs the network; there is no offline model.
- Built for macOS/Linux. Windows code paths exist (
Scripts/python.exe) but are untested. - Uses Microsoft's public Edge read-aloud endpoint. It is undocumented, unaffiliated with this project, and can change or throttle without notice; check Microsoft's terms before commercial use.
Uninstall
dsh plugin --profile <your-profile> remove dsh-pet-tts
Optionally delete ~/.dsh/dsh-pet-tts (virtualenv + cache, ~30 MB).
License
MIT.
中文
把 dsh-pet 桌宠的气泡台词念出来,声音走微软 Edge 的在线神经音色。前端监听 .dsh-pet-bubble 节点,宿主侧用私有 Python 虚拟环境里的开源客户端 edge-tts 合成 mp3。
它只念桌宠气泡,不念助手正文——所以桌宠不说话时它是安静的。想把助手回复念出来,请装市场里那类"朗读回复"插件。
依赖
- 带 Web UI 的 DeepSeek Harness(dsh web 或桌面版的网页视图),在 0.2.1-rc.5 上验证。
dsh-pet(用于产生气泡;不装也能用控制台 API)。- Python 3.9+,或者用
DSH_PET_TTS_SYSTEM_PYTHON指定解释器。 - 能访问
speech.platform.bing.com,以及一次性访问 PyPI(或镜像)装edge-tts。 - Node.js 20+。
安装
dsh plugin --profile <你的档名> add github:jimmyfenwick/dsh-pet-tts
或用 release 里的 tarball:
dsh plugin --profile <你的档名> add https://github.com/jimmyfenwick/dsh-pet-tts/releases/latest/download/dsh-pet-tts.tgz
装完重启或刷新,先在页面里点一下(浏览器禁止用户手势前自动播音频),再让桌宠说话。首次合成时会在 ~/.dsh/dsh-pet-tts/venv 建虚拟环境并装 edge-tts——约 30MB,一次性,不装全局。宿主机日志里会看到 [dsh-pet-tts] creating virtualenv … / installing edge-tts …。
预设
见上表(anime-girl 默认)。参数与 dsh-pet-dfeiyu-mo 同源。
dshPetTTS.setPreset('anime-girl-hi')
dshPetTTS.say('主人,我回来了')
dshPetTTS.mute(true)
await dshPetTTS.voices()
await dshPetTTS.health()
配置与限制
同英文节:DSH_PET_TTS_ROOT、DSH_PET_TTS_PYTHON、DSH_PET_TTS_SYSTEM_PYTHON;每条气泡最多念 300 字;首次发声要等一次点击;合成需要联网;macOS/Linux 验证过,Windows 路径支持未实测;用的是微软公开朗读接口,未与之关联,接口可能随时变动,商业使用前请核对微软条款。
卸载
dsh plugin --profile <你的档名> remove dsh-pet-tts
如需要,再删 ~/.dsh/dsh-pet-tts(虚拟环境 + 缓存)。MIT 许可。
No comments yet. Be the first to write one.