Text To Speech (Windows)

Text To Speech (Windows)

🚀 MS-Lucidia-Voice-Gateway-MCP

MS-Lucidia-Voice-Gateway-MCP 是一个借助 Windows 内置语音服务的模型上下文协议 (MCP) 服务器,它提供了文本到语音 (TTS) 和语音到文本 (STT) 功能。该服务器通过 PowerShell 命令调用 Windows 的本机语音 API (SAPI),无需依赖外部 API 或服务,使用起来更加便捷。

✨ 主要特性

  • 🗣️ 使用 Windows SAPI 音色的文本到语音 (TTS)
  • 👂 使用 Windows 语音识别的语音到文本 (STT)
  • 💻 简单的网络界面用于测试
  • 🚫 无外部 API 依赖
  • 🖥️ 调用本机 Windows 功能

📦 安装指南

先决条件

  • 已启用语音识别功能的 Windows 10/11 操作系统
  • Node.js 16+
  • PowerShell

安装步骤

  1. 克隆仓库:
git clone https://github.com/ExpressionsBot/MS-Lucidia-Voice-Gateway-MCP.git
cd MS-Lucidia-Voice-Gateway-MCP
  1. 安装依赖项:
npm install
  1. 构建项目:
npm run build

💻 使用示例

测试界面

  1. 启动测试服务器:
npm run test
  1. 打开浏览器访问 http://localhost:3000
  2. 使用网络界面测试 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));

📚 详细文档

故障排除

  1. 确保 Windows 语音识别功能已启用:

    • 打开 Windows 设置
    • 进入时间和语言 > 语音
    • 启用语音识别
  2. 检查可用音色:

    • 打开 PowerShell 并运行:
    Add-Type -AssemblyName System.Speech
    (New-Object System.Speech.Synthesis.SpeechSynthesizer).GetInstalledVoices().VoiceInfo.Name
    
  3. 测试语音识别:

    • 打开 Windows 设置中的语音识别
    • 如果尚未完成,运行安装向导进行设置
    • 测试 Windows 是否能识别您的语音

贡献

  1. 叉克隆仓库
  2. 创建功能分支
  3. 提交更改
  4. 推送到远程仓库
  5. 提交拉取请求

📄 许可证

[在此处添加许可证信息]

  • 0 关注
  • 0 收藏,32 浏览
  • system 提出于 2025-10-07 09:09

相似服务问题

相关AI产品