article
README
🚀 MS-Lucidia-Voice-Gateway-MCP
MS-Lucidia-Voice-Gateway-MCP 是一个模型上下文协议(MCP)服务器,它借助 Windows 内置语音服务,提供文字转语音(TTS)和语音转文字(STT)功能。该服务器通过 PowerShell 命令调用本地 Windows 语音 API(SAPI),无需依赖外部 API 或服务,使用起来更加便捷和安全。
🚀 快速开始
先决条件
- Windows 10/11,启⽤语⾳识别
- Node.js 16+
- PowerShell
安装步骤
- 克隆仓库:
git clone https://github.com/ExpressionsBot/MS-Lucidia-Voice-Gateway-MCP.git
cd MS-Lucidia-Voice-Gateway-MCP
- 安装依赖项:
npm install
- 构建项目:
npm run build
使用说明
测试界⾯
- 启动测试服务器:
npm run test
- 打开
http://localhost:3000在浏览器中 - 使用网页界⾯测试 TTS 和 STT 功能
可⽤⼯具
text_to_speech
⽤ Windows SAPI 语⾳将⽂字转为语⾔。
参数:
text(必需):要转换的⽂字voice(可选):要使⽤的语⾳(例如,“Microsoft David Desktop”)speed(可选):语⾔速度,范围 0.5 到 2.0(默认:1.0)
例:
fetch('http://localhost:3000/tts', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
text: "Hello, this is a test",
voice: "Microsoft David Desktop",
speed: 1.0
})
});
speech_to_text
记录⾳频并将其转换为⽂字,使⽤ Windows 语⾔识别。
参数:
duration(可选):录制时⻓(秒,默认:5,最⼤:60)
例:
fetch('http://localhost:3000/stt', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
duration: 5
})
}).then(response => response.json())
.then(data => console.log(data.text));
✨ 主要特性
- 使用 Windows SAPI 语⾳的⽂字转语⾔(TTS)
- 使用 Windows 语⾔识别(SR)的语⾔转⽂字(STT)
- 简单的网页界面⽤于测试
- 无外部 API 依赖
- 利⽤本地 Windows 功能
🔧 故障排除
-
确保 Windows 语⾔识别已启⽤:
- 打开 Windows 设置
- 进⼊时间和语言 > 语⾳
- 启⽤语⾔识别
-
检查可⽤的语⾳:
- 打开 PowerShell 并运⾏:
Add-Type -AssemblyName System.Speech (New-Object System.Speech.Synthesis.SpeechSynthesizer).GetInstalledVoices().VoiceInfo.Name -
测试语⾔识别:
- 在 Windows 设置中打开语⾔识别
- 如果尚未完成,请完成安装向导
- 测试 Windows 是否能识别您的语⾳
🤝 贡献
- 叉克隆仓库
- 创建功能分支
- 提交更改
- 推送到分支
- 创建新的 Pull Request
📄 许可证
MIT
微信扫一扫