edge-tts-ext


Nameedge-tts-ext JSON
Version 6.1.8 PyPI version JSON
download
home_pagehttps://github.com/rany2/edge-tts
SummaryMicrosoft Edge's TTS
upload_time2023-07-19 09:25:40
maintainer
docs_urlNone
authorrany
requires_python>=3.7
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # say it first

The project was modified from https://pypi.org/project/edge-tts/, but the original project was a CLI and was not easy to call externally, so it was tweaked briefly and may be integrated with Azure TTS capabilities later

# build

参考文档:
https://zhuanlan.zhihu.com/p/128020789

pip install --upgrade setuptools

如果构建出错:
pip uninstall setuptools wheel -y
pip install setuptools wheel
rm -rf build dist
python setup.py sdist bdist_wheel


# 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 and volume

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

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**: `--pitch` was removed in 6.0.3 as it no longer appears to have any effect.

### 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/blob/master/examples/basic_generation.py
* https://github.com/rany2/edge-tts/blob/master/examples/dynamic_voice_selection.py
* https://github.com/rany2/edge-tts/blob/master/examples/basic_audio_streaming.py
* https://github.com/rany2/edge-tts/blob/master/examples/streaming_with_subtitles.py
* 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-ext",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "rany",
    "author_email": "ranygh@riseup.net",
    "download_url": "https://files.pythonhosted.org/packages/a9/65/ea63dfead310a0a9f9e2942a4a9bc2b08bd0b45393a6a71544594df788dd/edge-tts-ext-6.1.8.tar.gz",
    "platform": null,
    "description": "# say it first\r\n\r\nThe project was modified from https://pypi.org/project/edge-tts/, but the original project was a CLI and was not easy to call externally, so it was tweaked briefly and may be integrated with Azure TTS capabilities later\r\n\r\n# build\r\n\r\n\u53c2\u8003\u6587\u6863:\r\nhttps://zhuanlan.zhihu.com/p/128020789\r\n\r\npip install --upgrade setuptools\r\n\r\n\u5982\u679c\u6784\u5efa\u51fa\u9519:\r\npip uninstall setuptools wheel -y\r\npip install setuptools wheel\r\nrm -rf build dist\r\npython setup.py sdist bdist_wheel\r\n\r\n\r\n# edge-tts\r\n\r\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.\r\n\r\n## Installation\r\n\r\nTo install it, run the following command:\r\n\r\n    $ pip install edge-tts\r\n\r\nIf you only want to use the `edge-tts` and `edge-playback` commands, it would be better to use pipx:\r\n\r\n    $ pipx install edge-tts\r\n\r\n## Usage\r\n\r\n### Basic usage\r\n\r\nIf you want to use the `edge-tts` command, you can simply run it with the following command:\r\n\r\n    $ edge-tts --text \"Hello, world!\" --write-media hello.mp3 --write-subtitles hello.vtt\r\n\r\nIf you wish to play it back immediately with subtitles, you could use the `edge-playback` command:\r\n\r\n    $ edge-playback --text \"Hello, world!\"\r\n\r\nNote the above requires the installation of the `mpv` command line player.\r\n\r\nAll `edge-tts` commands work in `edge-playback` as well.\r\n\r\n### Changing the voice\r\n\r\nIf you want to change the language of the speech or more generally, the voice. \r\n\r\nYou must first check the available voices with the `--list-voices` option:\r\n\r\n    $ edge-tts --list-voices\r\n    Name: Microsoft Server Speech Text to Speech Voice (af-ZA, AdriNeural)\r\n    ShortName: af-ZA-AdriNeural\r\n    Gender: Female\r\n    Locale: af-ZA\r\n\r\n    Name: Microsoft Server Speech Text to Speech Voice (am-ET, MekdesNeural)\r\n    ShortName: am-ET-MekdesNeural\r\n    Gender: Female\r\n    Locale: am-ET\r\n\r\n    Name: Microsoft Server Speech Text to Speech Voice (ar-EG, SalmaNeural)\r\n    ShortName: ar-EG-SalmaNeural\r\n    Gender: Female\r\n    Locale: ar-EG\r\n\r\n    Name: Microsoft Server Speech Text to Speech Voice (ar-SA, ZariyahNeural)\r\n    ShortName: ar-SA-ZariyahNeural\r\n    Gender: Female\r\n    Locale: ar-SA\r\n\r\n    ...\r\n\r\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\r\n\r\n### Custom SSML\r\n\r\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.\r\n\r\n### Changing rate and volume\r\n\r\nIt is possible to make minor changes to the generated speech.\r\n\r\n    $ edge-tts --rate=-50% --text \"Hello, world!\" --write-media hello_with_rate_halved.mp3 --write-subtitles hello_with_rate_halved.vtt\r\n    $ edge-tts --volume=-50% --text \"Hello, world!\" --write-media hello_with_volume_halved.mp3 --write-subtitles hello_with_volume_halved.vtt\r\n\r\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.\r\n\r\n**NOTE**: `--pitch` was removed in 6.0.3 as it no longer appears to have any effect.\r\n\r\n### Note on the `edge-playback` command\r\n\r\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.\r\n\r\n## Python module\r\n\r\nIt is possible to use the `edge-tts` module directly from Python. For a list of example applications:\r\n\r\n* https://github.com/rany2/edge-tts/blob/master/examples/basic_generation.py\r\n* https://github.com/rany2/edge-tts/blob/master/examples/dynamic_voice_selection.py\r\n* https://github.com/rany2/edge-tts/blob/master/examples/basic_audio_streaming.py\r\n* https://github.com/rany2/edge-tts/blob/master/examples/streaming_with_subtitles.py\r\n* https://github.com/rany2/edge-tts/blob/master/src/edge_tts/util.py\r\n* https://github.com/hasscc/hass-edge-tts/blob/main/custom_components/edge_tts/tts.py\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Microsoft Edge's TTS",
    "version": "6.1.8",
    "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": "d4c8973248cdad489a724f3c16046bfbc79c416a3c91bc6652efe7c3fa953d63",
                "md5": "07decfcbf2c1f7fa8a4da717aacbe923",
                "sha256": "b1f153ac43e7e7237c33167dd8cd38f331db055fc9636b6ab934be50f99cf664"
            },
            "downloads": -1,
            "filename": "edge_tts_ext-6.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "07decfcbf2c1f7fa8a4da717aacbe923",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 28195,
            "upload_time": "2023-07-19T09:25:39",
            "upload_time_iso_8601": "2023-07-19T09:25:39.033413Z",
            "url": "https://files.pythonhosted.org/packages/d4/c8/973248cdad489a724f3c16046bfbc79c416a3c91bc6652efe7c3fa953d63/edge_tts_ext-6.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a965ea63dfead310a0a9f9e2942a4a9bc2b08bd0b45393a6a71544594df788dd",
                "md5": "4c5e0fcd0b5b1f660cd1465691317534",
                "sha256": "20831a69d93812c152e761a1ce160b3a9d6bb982b38fa2b01662692eba6b30ab"
            },
            "downloads": -1,
            "filename": "edge-tts-ext-6.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "4c5e0fcd0b5b1f660cd1465691317534",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 26922,
            "upload_time": "2023-07-19T09:25:40",
            "upload_time_iso_8601": "2023-07-19T09:25:40.702343Z",
            "url": "https://files.pythonhosted.org/packages/a9/65/ea63dfead310a0a9f9e2942a4a9bc2b08bd0b45393a6a71544594df788dd/edge-tts-ext-6.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-19 09:25:40",
    "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-ext"
}
        
Elapsed time: 0.19861s