{"id":24370108,"url":"https://github.com/xnmeet/voi","last_synced_at":"2026-06-15T21:32:02.438Z","repository":{"id":273096436,"uuid":"918687558","full_name":"xnmeet/voi","owner":"xnmeet","description":"一个基于 [Bob](https://bobtranslate.com/) 的文本转语音插件，使用 Kokoro 本地部署模型作为语音合成服务。","archived":false,"fork":false,"pushed_at":"2025-05-28T15:23:43.000Z","size":897,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-03T17:57:29.252Z","etag":null,"topics":["bobplugin","kokoro","kokoro-onnx","kokoro-tts","tts","tts-api"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xnmeet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-01-18T15:44:07.000Z","updated_at":"2025-08-16T02:13:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"a4429fb5-3a9d-4d07-b2bd-cc7db72aac58","html_url":"https://github.com/xnmeet/voi","commit_stats":null,"previous_names":["xnmeet/voi"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/xnmeet/voi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnmeet%2Fvoi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnmeet%2Fvoi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnmeet%2Fvoi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnmeet%2Fvoi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xnmeet","download_url":"https://codeload.github.com/xnmeet/voi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnmeet%2Fvoi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34381759,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-15T02:00:07.085Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bobplugin","kokoro","kokoro-onnx","kokoro-tts","tts","tts-api"],"created_at":"2025-01-19T04:12:38.825Z","updated_at":"2026-06-15T21:32:02.431Z","avatar_url":"https://github.com/xnmeet.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bob Kokoro TTS Plugin\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"bob-plugin/src/icon.png\" width=\"200\" height=\"200\" alt=\"Plugin Icon\"\u003e\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n  一个基于 \u003ca href=\"https://bobtranslate.com/\"\u003eBob\u003c/a\u003e 的文本转语音插件，使用 Kokoro 本地部署模型作为语音合成服务。\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/xnmeet/voi/releases/latest\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/v/release/xnmeet/voi?include_prereleases\u0026style=flat-square\" alt=\"Version\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/xnmeet/voi?style=flat-square\" alt=\"MIT License\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## 📦 项目结构\n\n本项目包含两个主要部分：\n\n1. **Bob 插件** (`bob-plugin/`): Bob 的文本转语音插件\n2. **TTS 服务器** (`server/`): Kokoro TTS 本地服务器\n\n## 🚀 快速开始\n\n### 1️⃣ 部署 TTS 服务器\n\n首先下载必需的模型文件：\n\n```bash\ncd server\n# 下载 ONNX 模型文件 (v1.0)\nwget https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.0/kokoro-v1.0.onnx\n# 下载声音配置文件 (v1.0)\nwget https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.0/voices-v1.0.bin\n```\n\n然后选择以下任一方式部署服务器：\n\n```bash\n# 方式一：直接运行\npip install -r requirements.txt\npython server.py\n\n# 方式二：Docker（推荐）\ndocker build -f Dockerfile.conda -t kokoro-tts-conda .\ndocker run -p 8000:8000 kokoro-tts-conda\n```\n\n详细说明请参考 [服务器文档](server/README.md)\n\n### 2️⃣ 安装 Bob 插件\n\n1. 下载最新版本的插件（[Releases](https://github.com/xnmeet/voi/releases/latest)）\n2. 安装 `.bobplugin` 文件到 Bob 中\n3. 在 Bob 的偏好设置中配置服务器地址（例如：`http://localhost:8000/text-to-speech`）\n\n详细说明请参考 [插件文档](bob-plugin/README.md)\n\n## 📡 API 调用示例\n\n### 基本调用\n\nTTS 服务器提供了简单易用的 REST API，以下是各种调用方式的示例：\n\n#### 配置在 Bob 插件\n\n自定义接口完整地址：http://localhost:55000/text-to-speech\n\n\u003e 前面的域名和端口替换为你实际起的服务对应域名和端口\n\n#### curl 命令行调用\n\n```bash\n# 基本调用（使用默认声音）\ncurl -X POST http://localhost:8000/text-to-speech \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"text\": \"Hello, this is a test message\"}' \\\n  --output audio.mp3\n\n# 指定声音和语速\ncurl -X POST http://localhost:8000/text-to-speech \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"text\": \"Hello, this is a test with custom voice\",\n    \"voice\": \"af_bella\",\n    \"speed\": 1.2,\n    \"format\": \"wav\"\n  }' \\\n  --output audio.wav\n\n# 获取 Base64 编码的音频数据\ncurl -X POST http://localhost:8000/text-to-speech \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"text\": \"Hello world\",\n    \"voice\": \"af_heart\",\n    \"format\": \"base64\"\n  }' | jq -r '.audio_data' | base64 -d \u003e audio.mp3\n```\n\n#### Python 调用示例\n\n```python\nimport requests\nimport base64\n\n# 基本调用\ndef text_to_speech_basic():\n    url = \"http://localhost:8000/text-to-speech\"\n    data = {\n        \"text\": \"你好，这是一个测试消息\",\n        \"voice\": \"af_heart\",\n        \"speed\": 1.0,\n        \"format\": \"mp3\"\n    }\n\n    response = requests.post(url, json=data)\n\n    if response.status_code == 200:\n        with open(\"output.mp3\", \"wb\") as f:\n            f.write(response.content)\n        print(\"音频文件已保存为 output.mp3\")\n    else:\n        print(f\"请求失败: {response.status_code}\")\n\n# 获取 Base64 编码的音频\ndef text_to_speech_base64():\n    url = \"http://localhost:8000/text-to-speech\"\n    data = {\n        \"text\": \"这是 Base64 编码示例\",\n        \"voice\": \"af_bella\",\n        \"format\": \"base64\"\n    }\n\n    response = requests.post(url, json=data)\n\n    if response.status_code == 200:\n        result = response.json()\n        audio_data = base64.b64decode(result[\"audio_data\"])\n\n        with open(\"output_base64.mp3\", \"wb\") as f:\n            f.write(audio_data)\n        print(\"Base64 音频文件已保存\")\n    else:\n        print(f\"请求失败: {response.status_code}\")\n\n# 调用函数\ntext_to_speech_basic()\ntext_to_speech_base64()\n```\n\n#### JavaScript 调用示例\n\n```javascript\n// 基本调用\nasync function textToSpeech() {\n  const response = await fetch('http://localhost:8000/text-to-speech', {\n    method: 'POST',\n    headers: {\n      'Content-Type': 'application/json'\n    },\n    body: JSON.stringify({\n      text: 'Hello from JavaScript!',\n      voice: 'af_heart',\n      speed: 1.0,\n      format: 'mp3'\n    })\n  });\n\n  if (response.ok) {\n    const audioBlob = await response.blob();\n    const audioUrl = URL.createObjectURL(audioBlob);\n\n    // 创建音频元素并播放\n    const audio = new Audio(audioUrl);\n    audio.play();\n  } else {\n    console.error('TTS 请求失败:', response.status);\n  }\n}\n\n// Base64 格式调用\nasync function textToSpeechBase64() {\n  const response = await fetch('http://localhost:8000/text-to-speech', {\n    method: 'POST',\n    headers: {\n      'Content-Type': 'application/json'\n    },\n    body: JSON.stringify({\n      text: 'Base64 格式示例',\n      voice: 'af_bella',\n      format: 'base64'\n    })\n  });\n\n  if (response.ok) {\n    const result = await response.json();\n    const audioData = 'data:audio/mp3;base64,' + result.audio_data;\n\n    // 创建音频元素并播放\n    const audio = new Audio(audioData);\n    audio.play();\n  }\n}\n```\n\n### 可用参数说明\n\n| 参数     | 类型    | 默认值     | 说明                         |\n| -------- | ------- | ---------- | ---------------------------- |\n| `text`   | string  | -          | 要转换的文本内容（必需）     |\n| `voice`  | string  | \"af_heart\" | 声音选择，详见服务器文档     |\n| `speed`  | float   | 1.0        | 语速调节（0.5-2.0）          |\n| `format` | string  | \"mp3\"      | 音频格式：wav/mp3/ogg/base64 |\n| `stream` | boolean | true       | 是否使用流式响应             |\n\n### 健康检查\n\n```bash\n# 检查服务器状态\ncurl http://localhost:8000/health\n\n# 返回结果\n{\"status\": \"healthy\"}\n```\n\n## 🙏 致谢\n\n本项目使用了以下开源项目：\n\n- [kokoro-onnx](https://github.com/thewh1teagle/kokoro-onnx) - Kokoro TTS 的 ONNX 运行时实现\n- [Kokoro-82M](https://huggingface.co/hexgrad/Kokoro-82M) - Kokoro TTS 模型\n\n## ❓ 问题反馈\n\n如果您在使用过程中遇到任何问题，请通过以下方式反馈：\n\n1. 在 GitHub 上提交 Issue\n2. 发送邮件至 xxnmeet@gmail.com\n\n## 📄 许可证\n\n[MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxnmeet%2Fvoi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxnmeet%2Fvoi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxnmeet%2Fvoi/lists"}