{"id":18087117,"url":"https://github.com/redhog/tts-wrapper","last_synced_at":"2025-04-06T01:41:16.189Z","repository":{"id":258245921,"uuid":"873641684","full_name":"redhog/tts-wrapper","owner":"redhog","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-21T16:31:55.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-12T07:53:58.760Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/redhog.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}},"created_at":"2024-10-16T14:01:09.000Z","updated_at":"2024-10-21T16:31:59.000Z","dependencies_parsed_at":"2024-10-21T21:18:46.412Z","dependency_job_id":null,"html_url":"https://github.com/redhog/tts-wrapper","commit_stats":null,"previous_names":["redhog/tts-wrapper"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhog%2Ftts-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhog%2Ftts-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhog%2Ftts-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhog%2Ftts-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redhog","download_url":"https://codeload.github.com/redhog/tts-wrapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247423492,"owners_count":20936622,"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","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":[],"created_at":"2024-10-31T16:59:54.901Z","updated_at":"2025-04-06T01:41:16.156Z","avatar_url":"https://github.com/redhog.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Text-to-speech Wrapper\n\n`tts-wrapper` is a wrapper around multiple text-to-speech libraries, models and services, giving them a common, simple API. From the users perspective, the different back-ends appear as just different voices.\nAll generated sound is converted to a [pydub AudioSegment](https://pydub.com/), no matter what the speech-to-text library natively returns, which makes appending sound generated with different back-ends easy.\n\nUsage example:\n\n```python\n\u003e\u003e\u003e import tts_wrapper\n\n\u003e\u003e tts_wrapper.get_voices()\n{'melotts:EN-US': {'title': 'English with EN-US accent',\n  'properties': {'speed': {'type': 'number', 'default': 1.0}}},\n 'melotts:EN-BR': {'title': 'English with EN-BR accent',\n  'properties': {'speed': {'type': 'number', 'default': 1.0}}},\n 'melotts:EN_INDIA': {'title': 'English with EN_INDIA accent',\n  'properties': {'speed': {'type': 'number', 'default': 1.0}}},\n 'melotts:EN-AU': {'title': 'English with EN-AU accent',\n  'properties': {'speed': {'type': 'number', 'default': 1.0}}},\n 'melotts:EN-Default': {'title': 'English with EN-Default accent',\n  'properties': {'speed': {'type': 'number', 'default': 1.0}}},\n 'openai:alloy': {'title': 'alloy', 'properties': {}},\n 'openai:echo': {'title': 'echo', 'properties': {}},\n 'openai:fable': {'title': 'fable', 'properties': {}},\n 'openai:onyx': {'title': 'onyx', 'properties': {}},\n 'openai:nova': {'title': 'nova', 'properties': {}},\n 'openai:shimmer': {'title': 'shimmer', 'properties': {}}}\n\n\u003e\u003e\u003e s = tts_wrapper.render(\"Hello big beautiful world!\", 'melotts:EN-AU')\n\n\u003e\u003e\u003e s.export(\"test.mp3\")\n\n\u003e\u003e\u003e type(s)\npydub.audio_segment.AudioSegment\n```\n\n## Adding back-ends\n\nTo add a new back-end, make a python package that registers a new entrypoint that points to a python module:\n\n```python\n    entry_points = {\n        \"tts_wrapper.engine\": [\n            \"mybackend = mypackage.mybackend\"\n        ]\n    }\n```\nThe module should provide two functions: `get_voices()` and `render(text, voice, **kw)`.\n\n`get_voices` should return a dictionary with keys that are voice names, suitable as values for the `voice` parameter of `render()`, and values that are dictionaries.\nThese dictionaries can contain the keys `title` and `properties`, the latter being a json-schema of the optional parameters to `render()`.\n\n`render()` should return a single `pydub.audio_segment.AudioSegment` object.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredhog%2Ftts-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredhog%2Ftts-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredhog%2Ftts-wrapper/lists"}