{"id":13596804,"url":"https://github.com/lobehub/lobe-tts","last_synced_at":"2025-12-27T11:35:52.142Z","repository":{"id":205130640,"uuid":"713462676","full_name":"lobehub/lobe-tts","owner":"lobehub","description":"🎤 Lobe TTS - A high-quality \u0026 reliable TTS/STT library for Server and Browser","archived":false,"fork":false,"pushed_at":"2025-12-22T15:56:20.000Z","size":428,"stargazers_count":692,"open_issues_count":11,"forks_count":90,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-12-23T16:00:24.338Z","etag":null,"topics":["auzre","bun","edge","lobehub","microsoft-speech-api","nodejs","opeanai","react","speech-recognition","speech-to-text","stt","text-to-speech","tts"],"latest_commit_sha":null,"homepage":"https://tts.lobehub.com","language":"TypeScript","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/lobehub.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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},"funding":{"github":"lobehub","open_collective":"lobehub"}},"created_at":"2023-11-02T15:12:27.000Z","updated_at":"2025-12-22T15:56:23.000Z","dependencies_parsed_at":"2023-11-13T14:32:54.745Z","dependency_job_id":"28a25ad8-37f8-4bb8-80b6-f293eacd587c","html_url":"https://github.com/lobehub/lobe-tts","commit_stats":{"total_commits":188,"total_committers":9,"mean_commits":20.88888888888889,"dds":0.5212765957446808,"last_synced_commit":"ad9e283a3350e57f4afcf874f962c3cd8e49d16c"},"previous_names":["lobehub/lobe-tts"],"tags_count":95,"template":false,"template_full_name":null,"purl":"pkg:github/lobehub/lobe-tts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lobehub%2Flobe-tts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lobehub%2Flobe-tts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lobehub%2Flobe-tts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lobehub%2Flobe-tts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lobehub","download_url":"https://codeload.github.com/lobehub/lobe-tts/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lobehub%2Flobe-tts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28020587,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-25T02:00:05.988Z","response_time":58,"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":["auzre","bun","edge","lobehub","microsoft-speech-api","nodejs","opeanai","react","speech-recognition","speech-to-text","stt","text-to-speech","tts"],"created_at":"2024-08-01T16:02:48.730Z","updated_at":"2025-12-25T05:25:21.496Z","avatar_url":"https://github.com/lobehub.png","language":"TypeScript","funding_links":["https://github.com/sponsors/lobehub","https://opencollective.com/lobehub"],"categories":["TypeScript","tts"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\u003ca name=\"readme-top\"\u003e\u003c/a\u003e\n\n\u003cimg height=\"120\" src=\"https://registry.npmmirror.com/@lobehub/assets-logo/1.0.0/files/assets/logo-3d.webp\"\u003e\n\u003cimg height=\"120\" src=\"https://gw.alipayobjects.com/zos/kitchen/qJ3l3EPsdW/split.svg\"\u003e\n\u003cimg height=\"120\" src=\"https://registry.npmmirror.com/@lobehub/assets-emoji/1.3.0/files/assets/microphone.webp\"\u003e\n\n\u003ch1\u003eLobe TTS\u003c/h1\u003e\n\nA high-quality \u0026 reliable TTS/STT library for Server and Browser\n\n[![][npm-release-shield]][npm-release-link]\n[![][github-releasedate-shield]][github-releasedate-link]\n[![][github-action-test-shield]][github-action-test-link]\n[![][github-action-release-shield]][github-action-release-link]\u003cbr/\u003e\n[![][github-contributors-shield]][github-contributors-link]\n[![][github-forks-shield]][github-forks-link]\n[![][github-stars-shield]][github-stars-link]\n[![][github-issues-shield]][github-issues-link]\n[![][github-license-shield]][github-license-link]\u003cbr/\u003e\n[![][sponsor-shield]][sponsor-link]\n\n[Documents](https://tts.lobehub.com) · [Changelog](./CHANGELOG.md) · [Report Bug][github-issues-link] · [Request Feature][github-issues-link]\n\n![](https://github-production-user-asset-6210df.s3.amazonaws.com/17870709/284077909-854cc09a-b3c7-4fc4-9ea7-f7137abba351.png)\n\n\u003c/div\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ckbd\u003eTable of contents\u003c/kbd\u003e\u003c/summary\u003e\n\n#### TOC\n\n- [📖 Introduction](#-introduction)\n- [📦 Usage](#-usage)\n  - [Generate Speech on server](#generate-speech-on-server)\n  - [Use the React Component](#use-the-react-component)\n- [📦 Installation](#-installation)\n  - [Compile with Next.js](#compile-with-nextjs)\n- [⌨️ Local Development](#️-local-development)\n- [🤝 Contributing](#-contributing)\n- [🩷 Sponsor](#-sponsor)\n- [🔗 Links](#-links)\n  - [More Products](#more-products)\n  - [Design Resources](#design-resources)\n  - [Development Resources](#development-resources)\n\n####\n\n\u003c/details\u003e\n\n## 📖 Introduction\n\n[🤖 Lobe Chat](https://github.com/lobehub/lobe-chat) supports Text-to-Speech (TTS) and Speech-to-Text (STT) technologies, enabling our application to convert text messages into clear voice outputs,\nallowing users to interact with our conversational agent as if they were talking to a real person. Users can choose from a variety of voices to pair with the agent.\n\nIn the process of implementing this feature, we found that there was no satisfactory TTS (Text-to-Speech) frontend library available on the market.\nAs a result, we invested a lot of effort, including data conversion, audio progress management, and speech visualization, among other tasks.\n\n\u003e \\[!NOTE]\n\u003e\n\u003e Therefore, we decided to refine our implementation and make it open source, hoping to assist developers who wish to implement TTS.\n\u003e [@lobehub/tts][npm-release-link] is a high-quality TTS toolkit developed in TypeScript, which supports usage both on the server-side and in the browser.\n\u003e\n\u003e - **Server-side:** With just 15 lines of code, you can achieve high-quality voice generation capabilities comparable to OpenAI's TTS service. It currently supports EdgeSpeechTTS, MicrosoftTTS, OpenAITTS, and OpenAISTT.\n\u003e - **Browser-side:** It provides high-quality React Hooks and visual audio components, supporting common functions such as loading, playing, pausing, and dragging the timeline. Additionally, it offers a very rich set of capabilities for adjusting the audio track styles.\n\n## 📦 Usage\n\n### Generate Speech on server\n\nrun the script below use Bun: `bun index.js`\n\n```js\n// index.js\nimport { EdgeSpeechTTS } from '@lobehub/tts';\nimport { Buffer } from 'buffer';\nimport fs from 'fs';\nimport path from 'path';\n\n// Instantiate EdgeSpeechTTS\nconst tts = new EdgeSpeechTTS({ locale: 'en-US' });\n\n// Create speech synthesis request payload\nconst payload = {\n  input: 'This is a speech demonstration',\n  options: {\n    voice: 'en-US-GuyNeural',\n  },\n};\n\n// Call create method to synthesize speech\nconst response = await tts.create(payload);\n\n// generate speech file\nconst mp3Buffer = Buffer.from(await response.arrayBuffer());\nconst speechFile = path.resolve('./speech.mp3');\n\nfs.writeFileSync(speechFile, mp3Buffer);\n```\n\n\u003chttps://github.com/lobehub/lobe-tts/assets/28616219/3ab68c5a-2745-442e-8d66-ca410192ace1\u003e\n\n\u003e \\[!IMPORTANT]\\\n\u003e **Run on Node.js**\n\u003e\n\u003e As the Node.js environment lacks the `WebSocket` instance, we need to polyfill WebSocket. This can be done by importing the ws package.\n\n```js\n// import at the top of the file\nimport WebSocket from 'ws';\n\nglobal.WebSocket = WebSocket;\n```\n\n### Use the React Component\n\n```tsx\nimport { AudioPlayer, AudioVisualizer, useAudioPlayer } from '@lobehub/tts/react';\n\nexport default () =\u003e {\n  const { ref, isLoading, ...audio } = useAudioPlayer(url);\n\n  return (\n    \u003cFlexbox align={'center'} gap={8}\u003e\n      \u003cAudioPlayer audio={audio} isLoading={isLoading} style={{ width: '100%' }} /\u003e\n      \u003cAudioVisualizer audioRef={ref} isLoading={isLoading} /\u003e\n    \u003c/Flexbox\u003e\n  );\n};\n```\n\n\u003chttps://github.com/lobehub/lobe-tts/assets/28616219/c2638383-314f-44c3-b358-8fbbd3028d61\u003e\n\n## 📦 Installation\n\n\u003e \\[!IMPORTANT]\\\n\u003e This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).\n\nTo install `@lobehub/tts`, run the following command:\n\n```bash\n$ pnpm i @lobehub/tts\n```\n\n[![][bun-shield]][bun-link]\n\n```bash\n$ bun add @lobehub/tts\n```\n\n### Compile with Next.js\n\n\u003e \\[!NOTE]\\\n\u003e By work correct with Next.js SSR, add `transpilePackages: ['@lobehub/tts']` to `next.config.js`. For example:\n\n```js\nconst nextConfig = {\n  transpilePackages: ['@lobehub/tts'],\n};\n```\n\n\u003cdiv align=\"right\"\u003e\n\n[![][back-to-top]](#readme-top)\n\n\u003c/div\u003e\n\n## ⌨️ Local Development\n\nYou can use Github Codespaces for online development:\n\n[![][github-codespace-shield]][github-codespace-link]\n\nOr clone it for local development:\n\n```bash\n$ git clone https://github.com/lobehub/lobe-tts.git\n$ cd lobe-tts\n$ bun install\n$ bun dev\n```\n\n\u003cdiv align=\"right\"\u003e\n\n[![][back-to-top]](#readme-top)\n\n\u003c/div\u003e\n\n## 🤝 Contributing\n\nContributions of all types are more than welcome, if you are interested in contributing code, feel free to check out our GitHub [Issues][github-issues-link] to get stuck in to show us what you’re made of.\n\n[![][pr-welcome-shield]][pr-welcome-link]\n\n[![][github-contrib-shield]][github-contrib-link]\n\n\u003cdiv align=\"right\"\u003e\n\n[![][back-to-top]](#readme-top)\n\n\u003c/div\u003e\n\n## 🩷 Sponsor\n\nEvery bit counts and your one-time donation sparkles in our galaxy of support! You're a shooting star, making a swift and bright impact on our journey. Thank you for believing in us – your generosity guides us toward our mission, one brilliant flash at a time.\n\n\u003ca href=\"https://opencollective.com/lobehub\" target=\"_blank\"\u003e\n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/lobehub/.github/blob/main/static/sponsor-dark.png?raw=true\"\u003e\n    \u003cimg  src=\"https://github.com/lobehub/.github/blob/main/static/sponsor-light.png?raw=true\"\u003e\n  \u003c/picture\u003e\n\u003c/a\u003e\n\n\u003cdiv align=\"right\"\u003e\n\n[![][back-to-top]](#readme-top)\n\n\u003c/div\u003e\n\n## 🔗 Links\n\n### More Products\n\n- **[🤯 LobeHub](https://github.com/lobehub/lobe-chat)** - An open-source, extensible (Function Calling), high-performance chatbot framework. It supports one-click free deployment of your private ChatGPT/LLM web application.\n- **[🅰️ Lobe Theme](https://github.com/lobehub/sd-webui-lobe-theme)** - The modern theme for stable diffusion webui, exquisite interface design, highly customizable UI, and efficiency boosting features.\n- **[🧸 Lobe Vidol](https://github.com/lobehub/lobe-vidol)** - Experience the magic of virtual idol creation with Lobe Vidol, enjoy the elegance of our Exquisite UI Design, dance along using MMD Dance Support, and engage in Smooth Conversations.\n\n### Design Resources\n\n- **[🍭 Lobe UI](https://ui.lobehub.com)** - An open-source UI component library for building AIGC web apps.\n- **[🥨 Lobe Icons](https://lobehub.com/icons)** - Popular AI / LLM Model Brand SVG Logo and Icon Collection.\n- **[📊 Lobe Charts](https://charts.lobehub.com)** - React modern charts components built on recharts\n\n### Development Resources\n\n- **[🎤 Lobe TTS](https://tts.lobehub.com)** - A high-quality \u0026 reliable TTS/STT library for Server and Browser\n- **[🌏 Lobe i18n](https://github.com/lobehub/lobe-cli-toolbox/blob/master/packages/lobe-i18n)** - Automation ai tool for the i18n (internationalization) translation process.\n\n[More Resources](https://lobehub.com/resources)\n\n\u003cdiv align=\"right\"\u003e\n\n[![][back-to-top]](#readme-top)\n\n\u003c/div\u003e\n\n---\n\n#### 📝 License\n\nCopyright © 2023 [LobeHub][profile-link]. \u003cbr /\u003e\nThis project is [MIT](./LICENSE) licensed.\n\n[back-to-top]: https://img.shields.io/badge/-BACK_TO_TOP-black?style=flat-square\n[bun-link]: https://bun.sh\n[bun-shield]: https://img.shields.io/badge/-speedup%20with%20bun-black?logo=bun\u0026style=for-the-badge\n[github-action-release-link]: https://github.com/lobehub/lobe-tts/actions/workflows/release.yml\n[github-action-release-shield]: https://img.shields.io/github/actions/workflow/status/lobehub/lobe-tts/release.yml?label=release\u0026labelColor=black\u0026logo=githubactions\u0026logoColor=white\u0026style=flat-square\n[github-action-test-link]: https://github.com/lobehub/lobe-tts/actions/workflows/test.yml\n[github-action-test-shield]: https://img.shields.io/github/actions/workflow/status/lobehub/lobe-tts/test.yml?label=test\u0026labelColor=black\u0026logo=githubactions\u0026logoColor=white\u0026style=flat-square\n[github-codespace-link]: https://codespaces.new/lobehub/lobe-tts\n[github-codespace-shield]: https://github.com/codespaces/badge.svg\n[github-contrib-link]: https://github.com/lobehub/lobe-tts/graphs/contributors\n[github-contrib-shield]: https://contrib.rocks/image?repo=lobehub%2Flobe-tts\n[github-contributors-link]: https://github.com/lobehub/lobe-tts/graphs/contributors\n[github-contributors-shield]: https://img.shields.io/github/contributors/lobehub/lobe-tts?color=c4f042\u0026labelColor=black\u0026style=flat-square\n[github-forks-link]: https://github.com/lobehub/lobe-tts/network/members\n[github-forks-shield]: https://img.shields.io/github/forks/lobehub/lobe-tts?color=8ae8ff\u0026labelColor=black\u0026style=flat-square\n[github-issues-link]: https://github.com/lobehub/lobe-tts/issues\n[github-issues-shield]: https://img.shields.io/github/issues/lobehub/lobe-tts?color=ff80eb\u0026labelColor=black\u0026style=flat-square\n[github-license-link]: https://github.com/lobehub/lobe-tts/blob/main/LICENSE\n[github-license-shield]: https://img.shields.io/github/license/lobehub/lobe-tts?color=white\u0026labelColor=black\u0026style=flat-square\n[github-releasedate-link]: https://github.com/lobehub/lobe-tts/releases\n[github-releasedate-shield]: https://img.shields.io/github/release-date/lobehub/lobe-tts?labelColor=black\u0026style=flat-square\n[github-stars-link]: https://github.com/lobehub/lobe-tts/network/stargazers\n[github-stars-shield]: https://img.shields.io/github/stars/lobehub/lobe-tts?color=ffcb47\u0026labelColor=black\u0026style=flat-square\n[npm-release-link]: https://www.npmjs.com/package/@lobehub/tts\n[npm-release-shield]: https://img.shields.io/npm/v/@lobehub/tts?color=369eff\u0026labelColor=black\u0026logo=npm\u0026logoColor=white\u0026style=flat-square\n[pr-welcome-link]: https://github.com/lobehub/lobe-tts/pulls\n[pr-welcome-shield]: https://img.shields.io/badge/%F0%9F%A4%AF%20PR%20WELCOME-%E2%86%92-ffcb47?labelColor=black\u0026style=for-the-badge\n[profile-link]: https://github.com/lobehub\n[sponsor-link]: https://opencollective.com/lobehub 'Become 🩷 LobeHub Sponsor'\n[sponsor-shield]: https://img.shields.io/badge/-Sponsor%20LobeHub-f04f88?logo=opencollective\u0026logoColor=white\u0026style=flat-square\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flobehub%2Flobe-tts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flobehub%2Flobe-tts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flobehub%2Flobe-tts/lists"}