edge-tts


Nameedge-tts JSON
Version 7.0.0 PyPI version JSON
download
home_pagehttps://github.com/rany2/edge-tts
SummaryMicrosoft Edge's TTS
upload_time2024-12-07 20:45:50
maintainerNone
docs_urlNone
authorrany
requires_python>=3.7
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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.srt

If you wish to play it back immediately with subtitles, you could use the `edge-playback` command:

    $ edge-playback --text "Hello, world!"

Note that `edge-playback` requires the installation of the [`mpv` command line player](https://mpv.io/).

All `edge-tts` commands work with `edge-playback` with the exception of the `--write-media`, `--write-subtitles` and `--list-voices` options.

### Changing the voice

You can change the voice used by the text-to-speech service by using the `--voice` option. The `--list-voices` option can be used to list all available voices.

    $ edge-tts --list-voices
    Name                               Gender    ContentCategories      VoicePersonalities
    ---------------------------------  --------  ---------------------  --------------------------------------
    af-ZA-AdriNeural                   Female    General                Friendly, Positive
    af-ZA-WillemNeural                 Male      General                Friendly, Positive
    am-ET-AmehaNeural                  Male      General                Friendly, Positive
    am-ET-MekdesNeural                 Female    General                Friendly, Positive
    ar-AE-FatimaNeural                 Female    General                Friendly, Positive
    ar-AE-HamdanNeural                 Male      General                Friendly, Positive
    ar-BH-AliNeural                    Male      General                Friendly, Positive
    ar-BH-LailaNeural                  Female    General                Friendly, Positive
    ar-DZ-AminaNeural                  Female    General                Friendly, Positive
    ar-DZ-IsmaelNeural                 Male      General                Friendly, Positive
    ar-EG-SalmaNeural                  Female    General                Friendly, Positive
    ...

    $ edge-tts --voice ar-EG-SalmaNeural --text "مرحبا كيف حالك؟" --write-media hello_in_arabic.mp3 --write-subtitles hello_in_arabic.srt

### Custom SSML

Support for custom SSML was removed because Microsoft prevents the use of any SSML that could not be generated by Microsoft Edge itself. This means that all the cases where custom SSML would be useful cannot be supported as the service only permits a single `<voice>` tag with a single `<prosody>` tag inside it. Any available customization options that could be used in the `<prosody>` tag are already available from the library or the command line itself.

### Changing rate, volume and pitch

You can change the rate, volume and pitch of the generated speech by using the `--rate`, `--volume` and `--pitch` options. When using a negative value, you will need to use `--[option]=-50%` instead of `--[option] -50%` to avoid the option being interpreted as a command line option.

    $ edge-tts --rate=-50% --text "Hello, world!" --write-media hello_with_rate_lowered.mp3 --write-subtitles hello_with_rate_lowered.srt
    $ edge-tts --volume=-50% --text "Hello, world!" --write-media hello_with_volume_lowered.mp3 --write-subtitles hello_with_volume_lowered.srt
    $ edge-tts --pitch=-50Hz --text "Hello, world!" --write-media hello_with_pitch_lowered.mp3 --write-subtitles hello_with_pitch_lowered.srt

## Python module

It is possible to use the `edge-tts` module directly from Python. Examples from the project itself include:

* [/examples/](/examples/)
* [/src/edge_tts/util.py](/src/edge_tts/util.py)

Other projects that use the `edge-tts` module include:

* [hass-edge-tts](https://github.com/hasscc/hass-edge-tts/blob/main/custom_components/edge_tts/tts.py)
* [Podcastfy](https://github.com/souzatharsis/podcastfy/blob/main/podcastfy/tts/providers/edge.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/40/4c/887ec101638f89d4f5e4c9c437d1411bcd61070df6a177cd37a93af90c7c/edge_tts-7.0.0.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.srt\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 that `edge-playback` requires the installation of the [`mpv` command line player](https://mpv.io/).\n\nAll `edge-tts` commands work with `edge-playback` with the exception of the `--write-media`, `--write-subtitles` and `--list-voices` options.\n\n### Changing the voice\n\nYou can change the voice used by the text-to-speech service by using the `--voice` option. The `--list-voices` option can be used to list all available voices.\n\n    $ edge-tts --list-voices\n    Name                               Gender    ContentCategories      VoicePersonalities\n    ---------------------------------  --------  ---------------------  --------------------------------------\n    af-ZA-AdriNeural                   Female    General                Friendly, Positive\n    af-ZA-WillemNeural                 Male      General                Friendly, Positive\n    am-ET-AmehaNeural                  Male      General                Friendly, Positive\n    am-ET-MekdesNeural                 Female    General                Friendly, Positive\n    ar-AE-FatimaNeural                 Female    General                Friendly, Positive\n    ar-AE-HamdanNeural                 Male      General                Friendly, Positive\n    ar-BH-AliNeural                    Male      General                Friendly, Positive\n    ar-BH-LailaNeural                  Female    General                Friendly, Positive\n    ar-DZ-AminaNeural                  Female    General                Friendly, Positive\n    ar-DZ-IsmaelNeural                 Male      General                Friendly, Positive\n    ar-EG-SalmaNeural                  Female    General                Friendly, Positive\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.srt\n\n### Custom SSML\n\nSupport for custom SSML was removed because Microsoft prevents the use of any SSML that could not be generated by Microsoft Edge itself. This means that all the cases where custom SSML would be useful cannot be supported as the service only permits a single `<voice>` tag with a single `<prosody>` tag inside it. Any available customization options that could be used in the `<prosody>` tag are already available from the library or the command line itself.\n\n### Changing rate, volume and pitch\n\nYou can change the rate, volume and pitch of the generated speech by using the `--rate`, `--volume` and `--pitch` options. When using a negative value, you will need to use `--[option]=-50%` instead of `--[option] -50%` to avoid the option being interpreted as a command line option.\n\n    $ edge-tts --rate=-50% --text \"Hello, world!\" --write-media hello_with_rate_lowered.mp3 --write-subtitles hello_with_rate_lowered.srt\n    $ edge-tts --volume=-50% --text \"Hello, world!\" --write-media hello_with_volume_lowered.mp3 --write-subtitles hello_with_volume_lowered.srt\n    $ edge-tts --pitch=-50Hz --text \"Hello, world!\" --write-media hello_with_pitch_lowered.mp3 --write-subtitles hello_with_pitch_lowered.srt\n\n## Python module\n\nIt is possible to use the `edge-tts` module directly from Python. Examples from the project itself include:\n\n* [/examples/](/examples/)\n* [/src/edge_tts/util.py](/src/edge_tts/util.py)\n\nOther projects that use the `edge-tts` module include:\n\n* [hass-edge-tts](https://github.com/hasscc/hass-edge-tts/blob/main/custom_components/edge_tts/tts.py)\n* [Podcastfy](https://github.com/souzatharsis/podcastfy/blob/main/podcastfy/tts/providers/edge.py)\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Microsoft Edge's TTS",
    "version": "7.0.0",
    "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": "f83700c211f1021f9b04dde72dcbee72ce66248519c3899a47b06f8940a67c08",
                "md5": "dc01e6b5383ef6de735ee9f9a3abfd07",
                "sha256": "c99e91caba83c28e6f1fff1098a8188f541ba9615944c7a6f8f5625e02848044"
            },
            "downloads": -1,
            "filename": "edge_tts-7.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dc01e6b5383ef6de735ee9f9a3abfd07",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 23337,
            "upload_time": "2024-12-07T20:45:48",
            "upload_time_iso_8601": "2024-12-07T20:45:48.323848Z",
            "url": "https://files.pythonhosted.org/packages/f8/37/00c211f1021f9b04dde72dcbee72ce66248519c3899a47b06f8940a67c08/edge_tts-7.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "404c887ec101638f89d4f5e4c9c437d1411bcd61070df6a177cd37a93af90c7c",
                "md5": "4b0c15d6ef3cd55a38ebb9f835895e7b",
                "sha256": "bd5db0c05bb7fd973397922f70fc8371c7be2bb4911f9c38bd38c14ed7b52a2d"
            },
            "downloads": -1,
            "filename": "edge_tts-7.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4b0c15d6ef3cd55a38ebb9f835895e7b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 21061,
            "upload_time": "2024-12-07T20:45:50",
            "upload_time_iso_8601": "2024-12-07T20:45:50.463904Z",
            "url": "https://files.pythonhosted.org/packages/40/4c/887ec101638f89d4f5e4c9c437d1411bcd61070df6a177cd37a93af90c7c/edge_tts-7.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-07 20:45:50",
    "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"
}
        
Elapsed time: 0.38222s