# edge-tts
`edge-tts` is a Python module that allows you to use Microsoft Edge's online text-to-speech service from within your Python code or using the provided `edge-tts` or `edge-playback` command.
## Installation
To install it, run the following command:
$ pip install edge-tts
If you only want to use the `edge-tts` and `edge-playback` commands, it would be better to use pipx:
$ pipx install edge-tts
## Usage
### Basic usage
If you want to use the `edge-tts` command, you can simply run it with the following command:
$ edge-tts --text "Hello, world!" --write-media hello.mp3 --write-subtitles hello.vtt
If you wish to play it back immediately with subtitles, you could use the `edge-playback` command:
$ edge-playback --text "Hello, world!"
Note the above requires the installation of the `mpv` command line player.
All `edge-tts` commands work in `edge-playback` as well.
### Changing the voice
If you want to change the language of the speech or more generally, the voice.
You must first check the available voices with the `--list-voices` option:
$ edge-tts --list-voices
Name: Microsoft Server Speech Text to Speech Voice (af-ZA, AdriNeural)
ShortName: af-ZA-AdriNeural
Gender: Female
Locale: af-ZA
Name: Microsoft Server Speech Text to Speech Voice (am-ET, MekdesNeural)
ShortName: am-ET-MekdesNeural
Gender: Female
Locale: am-ET
Name: Microsoft Server Speech Text to Speech Voice (ar-EG, SalmaNeural)
ShortName: ar-EG-SalmaNeural
Gender: Female
Locale: ar-EG
Name: Microsoft Server Speech Text to Speech Voice (ar-SA, ZariyahNeural)
ShortName: ar-SA-ZariyahNeural
Gender: Female
Locale: ar-SA
...
$ edge-tts --voice ar-EG-SalmaNeural --text "مرحبا كيف حالك؟" --write-media hello_in_arabic.mp3 --write-subtitles hello_in_arabic.vtt
### Custom SSML
Support for custom SSML has been removed since 5.0.0 because Microsoft has taken the initiative to prevent it from working. You cannot use custom SSML anymore.
### Changing rate, volume and pitch
It is possible to make minor changes to the generated speech.
$ edge-tts --rate=-50% --text "Hello, world!" --write-media hello_with_rate_halved.mp3 --write-subtitles hello_with_rate_halved.vtt
$ edge-tts --volume=-50% --text "Hello, world!" --write-media hello_with_volume_halved.mp3 --write-subtitles hello_with_volume_halved.vtt
$ edge-tts --pitch=-50Hz --text "Hello, world!" --write-media hello_with_pitch_halved.mp3 --write-subtitles hello_with_pitch_halved.vtt
In addition, it is required to use `--rate=-50%` instead of `--rate -50%` (note the lack of an equal sign) otherwise the `-50%` would be interpreted as just another argument.
### Note on the `edge-playback` command
`edge-playback` is just a wrapper around `edge-tts` that plays back the generated speech. It takes the same arguments as the `edge-tts` option.
## Python module
It is possible to use the `edge-tts` module directly from Python. For a list of example applications:
* https://github.com/rany2/edge-tts/tree/master/examples
* https://github.com/rany2/edge-tts/blob/master/src/edge_tts/util.py
* https://github.com/hasscc/hass-edge-tts/blob/main/custom_components/edge_tts/tts.py
Raw data
{
"_id": null,
"home_page": "https://github.com/rany2/edge-tts",
"name": "edge-tts",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "rany",
"author_email": "ranygh@riseup.net",
"download_url": "https://files.pythonhosted.org/packages/f0/9e/c41177598e2cc6a9a7913d577098bcf3d4ab71d4b797b89b7343d1789e12/edge-tts-6.1.12.tar.gz",
"platform": null,
"description": "# edge-tts\n\n`edge-tts` is a Python module that allows you to use Microsoft Edge's online text-to-speech service from within your Python code or using the provided `edge-tts` or `edge-playback` command.\n\n## Installation\n\nTo install it, run the following command:\n\n $ pip install edge-tts\n\nIf you only want to use the `edge-tts` and `edge-playback` commands, it would be better to use pipx:\n\n $ pipx install edge-tts\n\n## Usage\n\n### Basic usage\n\nIf you want to use the `edge-tts` command, you can simply run it with the following command:\n\n $ edge-tts --text \"Hello, world!\" --write-media hello.mp3 --write-subtitles hello.vtt\n\nIf you wish to play it back immediately with subtitles, you could use the `edge-playback` command:\n\n $ edge-playback --text \"Hello, world!\"\n\nNote the above requires the installation of the `mpv` command line player.\n\nAll `edge-tts` commands work in `edge-playback` as well.\n\n### Changing the voice\n\nIf you want to change the language of the speech or more generally, the voice. \n\nYou must first check the available voices with the `--list-voices` option:\n\n $ edge-tts --list-voices\n Name: Microsoft Server Speech Text to Speech Voice (af-ZA, AdriNeural)\n ShortName: af-ZA-AdriNeural\n Gender: Female\n Locale: af-ZA\n\n Name: Microsoft Server Speech Text to Speech Voice (am-ET, MekdesNeural)\n ShortName: am-ET-MekdesNeural\n Gender: Female\n Locale: am-ET\n\n Name: Microsoft Server Speech Text to Speech Voice (ar-EG, SalmaNeural)\n ShortName: ar-EG-SalmaNeural\n Gender: Female\n Locale: ar-EG\n\n Name: Microsoft Server Speech Text to Speech Voice (ar-SA, ZariyahNeural)\n ShortName: ar-SA-ZariyahNeural\n Gender: Female\n Locale: ar-SA\n\n ...\n\n $ edge-tts --voice ar-EG-SalmaNeural --text \"\u0645\u0631\u062d\u0628\u0627 \u0643\u064a\u0641 \u062d\u0627\u0644\u0643\u061f\" --write-media hello_in_arabic.mp3 --write-subtitles hello_in_arabic.vtt\n\n### Custom SSML\n\nSupport for custom SSML has been removed since 5.0.0 because Microsoft has taken the initiative to prevent it from working. You cannot use custom SSML anymore.\n\n### Changing rate, volume and pitch\n\nIt is possible to make minor changes to the generated speech.\n\n $ edge-tts --rate=-50% --text \"Hello, world!\" --write-media hello_with_rate_halved.mp3 --write-subtitles hello_with_rate_halved.vtt\n $ edge-tts --volume=-50% --text \"Hello, world!\" --write-media hello_with_volume_halved.mp3 --write-subtitles hello_with_volume_halved.vtt\n $ edge-tts --pitch=-50Hz --text \"Hello, world!\" --write-media hello_with_pitch_halved.mp3 --write-subtitles hello_with_pitch_halved.vtt\n\nIn addition, it is required to use `--rate=-50%` instead of `--rate -50%` (note the lack of an equal sign) otherwise the `-50%` would be interpreted as just another argument.\n\n### Note on the `edge-playback` command\n\n`edge-playback` is just a wrapper around `edge-tts` that plays back the generated speech. It takes the same arguments as the `edge-tts` option.\n\n## Python module\n\nIt is possible to use the `edge-tts` module directly from Python. For a list of example applications:\n\n* https://github.com/rany2/edge-tts/tree/master/examples\n* https://github.com/rany2/edge-tts/blob/master/src/edge_tts/util.py\n* https://github.com/hasscc/hass-edge-tts/blob/main/custom_components/edge_tts/tts.py\n",
"bugtrack_url": null,
"license": null,
"summary": "Microsoft Edge's TTS",
"version": "6.1.12",
"project_urls": {
"Bug Tracker": "https://github.com/rany2/edge-tts/issues",
"Homepage": "https://github.com/rany2/edge-tts"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d5f07cc168858b3b500cc93d274713dcf0d92967f491618d8b44889e21878389",
"md5": "11bb6d89f02a15694de59da2d4f153d1",
"sha256": "01e251c9f14e303367f35b33ad04704e08031dceffaabdd9e11c3e4f74445752"
},
"downloads": -1,
"filename": "edge_tts-6.1.12-py3-none-any.whl",
"has_sig": false,
"md5_digest": "11bb6d89f02a15694de59da2d4f153d1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 29504,
"upload_time": "2024-05-22T21:51:14",
"upload_time_iso_8601": "2024-05-22T21:51:14.140607Z",
"url": "https://files.pythonhosted.org/packages/d5/f0/7cc168858b3b500cc93d274713dcf0d92967f491618d8b44889e21878389/edge_tts-6.1.12-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f09ec41177598e2cc6a9a7913d577098bcf3d4ab71d4b797b89b7343d1789e12",
"md5": "bb1c421d746dce58dc7a81cb806c70e3",
"sha256": "cfb71806f829eebd579aa5f61c3426126a2c84e60ac7da4cf014c678894ac1fd"
},
"downloads": -1,
"filename": "edge-tts-6.1.12.tar.gz",
"has_sig": false,
"md5_digest": "bb1c421d746dce58dc7a81cb806c70e3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 27837,
"upload_time": "2024-05-22T21:51:15",
"upload_time_iso_8601": "2024-05-22T21:51:15.909055Z",
"url": "https://files.pythonhosted.org/packages/f0/9e/c41177598e2cc6a9a7913d577098bcf3d4ab71d4b797b89b7343d1789e12/edge-tts-6.1.12.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-22 21:51:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "rany2",
"github_project": "edge-tts",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "edge-tts"
}