dsh-voice 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.en.md +22 -15
- package/README.md +22 -15
- package/docs/USAGE.en.md +46 -37
- package/docs/USAGE.md +46 -37
- package/lib/config.d.ts +29 -3
- package/lib/config.js +68 -9
- package/lib/edge-tts.d.ts +29 -0
- package/lib/edge-tts.js +172 -37
- package/lib/host-config.d.ts +1 -1
- package/lib/host-config.js +36 -20
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/openai-tts.d.ts +22 -0
- package/lib/openai-tts.js +129 -0
- package/lib/paths.d.ts +4 -0
- package/lib/paths.js +21 -11
- package/lib/proxy-fetch.d.ts +6 -0
- package/lib/proxy-fetch.js +344 -4
- package/lib/stt.d.ts +43 -9
- package/lib/stt.js +164 -14
- package/lib/tools.d.ts +6 -2
- package/lib/tools.js +541 -71
- package/lib/tts-text.d.ts +48 -0
- package/lib/tts-text.js +308 -0
- package/lib/update-client.js +145 -53
- package/lib/voices.d.ts +9 -2
- package/lib/voices.js +53 -25
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +5 -4
- package/skills/voice-workflow/SKILL.md +78 -0
package/lib/voices.js
CHANGED
|
@@ -1,36 +1,64 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 常用音色清单(edge-tts 全量约 500
|
|
2
|
+
* 常用音色清单(edge-tts 全量约 500 个,这里收录常用中/英/日/韩/法/德/俄/西与旗舰多语/方言音色)。
|
|
3
3
|
*
|
|
4
4
|
* @module dsh-voice/voices
|
|
5
5
|
*/
|
|
6
6
|
/** 常用音色。 */
|
|
7
7
|
export const VOICES = [
|
|
8
|
-
{ id: 'zh-CN-XiaoxiaoNeural', gender: 'Female', locale: '普通话(晓晓,温柔女声)' },
|
|
9
|
-
{ id: 'zh-CN-XiaoyiNeural', gender: 'Female', locale: '普通话(晓伊,活泼女声)' },
|
|
10
|
-
{ id: 'zh-CN-YunxiNeural', gender: 'Male', locale: '普通话(云希,青年男声)' },
|
|
11
|
-
{ id: 'zh-CN-YunyangNeural', gender: 'Male', locale: '普通话(云扬,新闻男声)' },
|
|
12
|
-
{ id: 'zh-CN-YunjianNeural', gender: 'Male', locale: '普通话(云健,浑厚男声)' },
|
|
13
|
-
{ id: 'zh-CN-
|
|
14
|
-
{ id: 'zh-CN-
|
|
15
|
-
{ id: 'zh-
|
|
16
|
-
{ id: 'zh-
|
|
17
|
-
{ id: '
|
|
18
|
-
{ id: '
|
|
19
|
-
{ id: '
|
|
20
|
-
{ id: '
|
|
21
|
-
{ id: 'en-
|
|
22
|
-
{ id: 'en-
|
|
23
|
-
{ id: '
|
|
24
|
-
{ id: '
|
|
25
|
-
{ id: '
|
|
26
|
-
{ id: '
|
|
27
|
-
{ id: '
|
|
28
|
-
{ id: '
|
|
29
|
-
{ id: '
|
|
8
|
+
{ id: 'zh-CN-XiaoxiaoNeural', gender: 'Female', locale: '普通话(晓晓,温柔女声)', tags: ['warm', 'podcast'] },
|
|
9
|
+
{ id: 'zh-CN-XiaoyiNeural', gender: 'Female', locale: '普通话(晓伊,活泼女声)', tags: ['lively', 'assistant'] },
|
|
10
|
+
{ id: 'zh-CN-YunxiNeural', gender: 'Male', locale: '普通话(云希,青年男声)', tags: ['youth', 'audiobook'] },
|
|
11
|
+
{ id: 'zh-CN-YunyangNeural', gender: 'Male', locale: '普通话(云扬,新闻男声)', tags: ['news'] },
|
|
12
|
+
{ id: 'zh-CN-YunjianNeural', gender: 'Male', locale: '普通话(云健,浑厚男声)', tags: ['audiobook', 'sports'] },
|
|
13
|
+
{ id: 'zh-CN-XiaoxiaoMultilingualNeural', gender: 'Female', locale: '普通话(晓晓多语,自然中英混读)', tags: ['multilingual', 'podcast', 'warm'] },
|
|
14
|
+
{ id: 'zh-CN-YunyiMultilingualNeural', gender: 'Male', locale: '普通话(云逸多语,自然中英混读)', tags: ['multilingual', 'podcast'] },
|
|
15
|
+
{ id: 'zh-CN-YunfanMultilingualNeural', gender: 'Male', locale: '普通话(云帆多语,播客男声)', tags: ['multilingual', 'podcast'] },
|
|
16
|
+
{ id: 'zh-CN-liaoning-XiaobeiNeural', gender: 'Female', locale: '东北话(晓北)', tags: ['dialect'] },
|
|
17
|
+
{ id: 'zh-CN-shaanxi-XiaoniNeural', gender: 'Female', locale: '陕西话(晓妮)', tags: ['dialect'] },
|
|
18
|
+
{ id: 'zh-CN-sichuan-YunxiNeural', gender: 'Male', locale: '四川话(云希)', tags: ['dialect'] },
|
|
19
|
+
{ id: 'zh-TW-HsiaoChenNeural', gender: 'Female', locale: '台湾腔(晓臻)', tags: ['dialect', 'warm'] },
|
|
20
|
+
{ id: 'zh-HK-HiuMaanNeural', gender: 'Female', locale: '粤语(曉曼)', tags: ['dialect'] },
|
|
21
|
+
{ id: 'en-US-AriaNeural', gender: 'Female', locale: '美式英语(Aria,女声)', tags: ['podcast', 'news'] },
|
|
22
|
+
{ id: 'en-US-JennyNeural', gender: 'Female', locale: '美式英语(Jenny,女声)', tags: ['warm', 'assistant'] },
|
|
23
|
+
{ id: 'en-US-GuyNeural', gender: 'Male', locale: '美式英语(Guy,男声)', tags: ['news'] },
|
|
24
|
+
{ id: 'en-US-DavisNeural', gender: 'Male', locale: '美式英语(Davis,男声)', tags: ['podcast', 'warm'] },
|
|
25
|
+
{ id: 'en-US-AndrewMultilingualNeural', gender: 'Male', locale: '美式英语(Andrew 多语,温暖播客)', tags: ['multilingual', 'podcast', 'warm'] },
|
|
26
|
+
{ id: 'en-US-AvaMultilingualNeural', gender: 'Female', locale: '美式英语(Ava 多语,自然清晰)', tags: ['multilingual', 'podcast'] },
|
|
27
|
+
{ id: 'en-US-EmmaMultilingualNeural', gender: 'Female', locale: '美式英语(Emma 多语,亲和解说)', tags: ['multilingual', 'warm'] },
|
|
28
|
+
{ id: 'en-GB-SoniaNeural', gender: 'Female', locale: '英式英语(Sonia)', tags: ['news'] },
|
|
29
|
+
{ id: 'en-GB-RyanNeural', gender: 'Male', locale: '英式英语(Ryan)', tags: ['podcast'] },
|
|
30
|
+
{ id: 'ja-JP-NanamiNeural', gender: 'Female', locale: '日语(Nanami,女声)', tags: ['assistant'] },
|
|
31
|
+
{ id: 'ja-JP-KeitaNeural', gender: 'Male', locale: '日语(Keita,男声)', tags: ['podcast'] },
|
|
32
|
+
{ id: 'ko-KR-SunHiNeural', gender: 'Female', locale: '韩语(SunHi)', tags: ['assistant'] },
|
|
33
|
+
{ id: 'fr-FR-DeniseNeural', gender: 'Female', locale: '法语(Denise)', tags: ['podcast'] },
|
|
34
|
+
{ id: 'de-DE-KatjaNeural', gender: 'Female', locale: '德语(Katja)', tags: ['assistant'] },
|
|
35
|
+
{ id: 'ru-RU-SvetlanaNeural', gender: 'Female', locale: '俄语(Svetlana)', tags: ['assistant'] },
|
|
36
|
+
{ id: 'es-ES-ElviraNeural', gender: 'Female', locale: '西班牙语(Elvira)', tags: ['assistant'] },
|
|
30
37
|
];
|
|
31
|
-
|
|
38
|
+
const EDGE_VOICE_ID_PATTERN = /^[a-z]{2,3}(?:-[A-Za-z]{2,12}){1,2}-[A-Z][A-Za-z0-9]+(?:-[A-Za-z0-9]+)?(?::[A-Za-z0-9]+)?Neural$/;
|
|
39
|
+
/** 校验音色 id:常用清单内或符合 edge-tts 命名规则(含方言/文字子标签/多语/HD 变体)。 */
|
|
32
40
|
export function isValidVoiceId(id) {
|
|
33
41
|
if (VOICES.some((voice) => voice.id === id))
|
|
34
42
|
return true;
|
|
35
|
-
return
|
|
43
|
+
return EDGE_VOICE_ID_PATTERN.test(id);
|
|
44
|
+
}
|
|
45
|
+
/** 按地区/语言、性别或标签筛选内置常用音色。 */
|
|
46
|
+
export function filterVoices(filter) {
|
|
47
|
+
const locale = filter?.locale?.trim().toLowerCase() ?? '';
|
|
48
|
+
const gender = filter?.gender?.trim().toLowerCase() ?? '';
|
|
49
|
+
const tag = filter?.tag?.trim().toLowerCase() ?? '';
|
|
50
|
+
if (locale === '' && gender === '' && tag === '')
|
|
51
|
+
return VOICES;
|
|
52
|
+
return VOICES.filter((voice) => {
|
|
53
|
+
if (locale !== '' && !voice.id.toLowerCase().includes(locale) && !voice.locale.toLowerCase().includes(locale)) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
if (gender !== '' && voice.gender.toLowerCase() !== gender) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
if (tag !== '' && !(voice.tags?.some((item) => item.toLowerCase() === tag) ?? false)) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
});
|
|
36
64
|
}
|
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Voice",
|
|
4
|
-
"description": "Keyless Edge
|
|
4
|
+
"description": "Keyless Edge & OpenAI-compatible text-to-speech (TTS) with long-text/Markdown cleanup, multi-speaker podcasts, SRT/VTT subtitle export, interactive voice previews, and Groq/OpenAI/SiliconFlow/local Whisper speech-to-text (STT) inside the workspace."
|
|
5
5
|
}
|
|
6
6
|
}
|
package/locale/zh.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-voice",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "DeepSeek Harness 语音插件:零密钥 Edge TTS
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "DeepSeek Harness 语音插件:零密钥 Edge TTS 朗读、多角色播客与字幕导出、音色试听、兼容 ASR 转写与工作区输出保护。欢迎提交 issues 和 PR。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"LICENSES",
|
|
28
28
|
"THIRD_PARTY_NOTICES.md",
|
|
29
29
|
"assets/plugin-icon.webp",
|
|
30
|
-
"locale"
|
|
30
|
+
"locale",
|
|
31
|
+
"skills"
|
|
31
32
|
],
|
|
32
33
|
"scripts": {
|
|
33
34
|
"build": "tsc -p tsconfig.json && node scripts/build-updates.mjs",
|
|
@@ -69,7 +70,7 @@
|
|
|
69
70
|
"https-proxy-agent": "^9.1.0",
|
|
70
71
|
"undici": "^8.10.0",
|
|
71
72
|
"ws": "^8.21.3",
|
|
72
|
-
"@stardustlc/dsh-updates": "0.2.
|
|
73
|
+
"@stardustlc/dsh-updates": "0.2.3"
|
|
73
74
|
},
|
|
74
75
|
"devDependencies": {
|
|
75
76
|
"@types/node": "^24.0.0",
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: voice-workflow
|
|
3
|
+
description: Best-practice workflows for dsh-voice: direct file TTS with Markdown cleanup, oral script adaptation, multi-speaker podcast segments, SRT/VTT subtitle export, interactive voice auditions, and large-recording transcription. Load when turning documents/notes into speech, producing podcasts/subtitles, or transcribing audio.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Voice Workflow (`dsh-voice`)
|
|
7
|
+
|
|
8
|
+
Use this guide when converting articles, notes, or briefings into audio/subtitles, auditioning voices, or transcribing recordings inside the active session workspace.
|
|
9
|
+
|
|
10
|
+
## 1. Pick Voices & Audition Before Long Renders
|
|
11
|
+
|
|
12
|
+
- Discover voices with `voice_list({ locale, gender, tag })` instead of guessing IDs. Useful tags include `podcast`, `multilingual`, `warm`, `news`, `dialect`.
|
|
13
|
+
- Flagship multilingual options:
|
|
14
|
+
- Chinese + English bilingual: `zh-CN-XiaoxiaoMultilingualNeural`, `zh-CN-YunyiMultilingualNeural`, `zh-CN-YunfanMultilingualNeural`
|
|
15
|
+
- English multilingual: `en-US-AvaMultilingualNeural`, `en-US-AndrewMultilingualNeural`, `en-US-EmmaMultilingualNeural`
|
|
16
|
+
- When the user wants to compare voices, call `voice_preview({ voices: [...], text })`. It writes MP3 samples and an interactive `voice_previews/index.html` browser audition page (with playback speed toggles and one-click voice ID copy).
|
|
17
|
+
|
|
18
|
+
## 2. Direct File Synthesis & Markdown Cleanup (`inputFile`)
|
|
19
|
+
|
|
20
|
+
- **Do not copy large `.md` or `.txt` files into `text` arguments.** Pass `inputFile` directly to `voice_tts`:
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"inputFile": "docs/article.md",
|
|
24
|
+
"output": "article.mp3"
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
- `cleanMarkdown` defaults to `true` when `inputFile` ends with `.md` or `.markdown` (pass `cleanMarkdown: true` explicitly for inline Markdown in `text`). It strips fenced code blocks, URLs, Markdown links/images, headings, emphasis markers, and HTML tags while preserving punctuation and paragraph breaks.
|
|
28
|
+
- Texts longer than `5,000` characters (up to `100,000` characters) are automatically split on sentence/clause boundaries and merged into a single seamless MP3 in one `voice_tts` call.
|
|
29
|
+
|
|
30
|
+
## 3. Oral Script Adaptation for Briefings
|
|
31
|
+
|
|
32
|
+
When the user asks to summarize notes, changelogs, or reports into a spoken briefing rather than reading a file verbatim:
|
|
33
|
+
|
|
34
|
+
- Rewrite bullet lists, Markdown tables, code identifiers, and bare URLs into natural spoken sentences before calling `voice_tts`.
|
|
35
|
+
- Spell out or paraphrase abbreviations and symbols (e.g., turn `->`, `>=`, or file paths into natural transitions) so the narration sounds like a human host.
|
|
36
|
+
- Keep target duration in mind (roughly 220–260 Chinese characters or 130–160 English words per minute at `+0%` rate).
|
|
37
|
+
|
|
38
|
+
## 4. Multi-Speaker Podcasts (`segments`)
|
|
39
|
+
|
|
40
|
+
Produce two-host or multi-role dialogues in a single MP3 using `voice_tts` `segments` (up to 50 segments per call):
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"segments": [
|
|
45
|
+
{
|
|
46
|
+
"voice": "zh-CN-XiaoxiaoMultilingualNeural",
|
|
47
|
+
"text": "欢迎收听本期技术早报,今天我们来聊聊最新的语音工作流。",
|
|
48
|
+
"pauseMs": 350
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"voice": "zh-CN-YunyiMultilingualNeural",
|
|
52
|
+
"text": "没错,现在长文稿和双人播客都可以一次合成,还能同步导出字幕。",
|
|
53
|
+
"rate": "+5%",
|
|
54
|
+
"pauseMs": 300
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"output": "podcast.mp3",
|
|
58
|
+
"subtitleOutput": "podcast.srt"
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
- Each segment supports optional `voice`, `rate`, `pitch`, and `pauseMs` (default inter-segment silence `300` ms).
|
|
63
|
+
- Pair contrasting voices (for example `zh-CN-XiaoxiaoMultilingualNeural` + `zh-CN-YunyiMultilingualNeural`, or `en-US-AvaMultilingualNeural` + `en-US-AndrewMultilingualNeural`) for natural turn-taking.
|
|
64
|
+
|
|
65
|
+
## 5. Synchronized Subtitles for Video Pipelines (`subtitleOutput`)
|
|
66
|
+
|
|
67
|
+
- Pass `subtitleOutput: "out.srt"` or `"out.vtt"` to `voice_tts` (single-speaker or `segments`) to export synchronized sentence-boundary subtitles alongside the MP3 at zero extra API cost.
|
|
68
|
+
- Pass `subtitleOutput: "transcript.srt"` (or `.vtt`) to `voice_stt` to automatically request word/segment timestamps and write subtitles alongside the transcript.
|
|
69
|
+
- Hand the resulting `.mp3` and `.srt`/`.vtt` files directly to `dsh-ffmpeg` for subtitle burn-in or `dsh-remotion` for timeline composition.
|
|
70
|
+
|
|
71
|
+
## 6. Meeting Transcription & Health Checks
|
|
72
|
+
|
|
73
|
+
- **Domain accuracy**: Pass project names, acronyms, and speaker terms in `voice_stt({ audio, prompt: "DeepSeek Harness, Cordis, ...", output: "meeting.txt" })`.
|
|
74
|
+
- **Large recordings (>25 MB)**: Pass `autoCompress: true` to `voice_stt`. When local `ffmpeg` is available, `dsh-voice` automatically transcodes (16kHz mono) and splits recordings longer/larger than 24 MB into segments, merges the transcript, and shifts subtitle timestamps accurately.
|
|
75
|
+
- **Local / keyless Whisper**: If `asrEngine` is `custom` pointing to a loopback URL (e.g. `http://127.0.0.1:8000/v1`), no `asrApiKey` is required.
|
|
76
|
+
- **Scoped diagnostics**:
|
|
77
|
+
- Run `voice_health({ scope: "tts" })` before TTS-only tasks so an unconfigured ASR key does not trigger false alarms.
|
|
78
|
+
- Run `voice_health({ scope: "stt" })` before transcription, or `voice_health()` (default `all`) for full engine, voice/prosody, proxy (`http://`, `https://`, `socks5://`, `socks5h://`), and key diagnostics.
|