Microsoft Edge TTS for Home Assistant

This component is based on the TTS service of Microsoft Edge browser, no need to apply for app_key.

Install

Download and copy custom_components/edge_tts folder to custom_components folder in your HomeAssistant config folder

# Auto install via terminal shell
wget -q -O - https://cdn.jsdelivr.net/gh/al-one/hass-xiaomi-miot/install.sh | DOMAIN=edge_tts REPO_PATH=hasscc/hass-edge-tts ARCHIVE_TAG=main bash -

Config

# configuration.yaml
tts:
  - platform: edge_tts
    language: zh-CN # Default language or voice (Optional)

Configure default options:

tts:
  - platform: edge_tts
    service_name: xiaomo_say
    language: zh-CN-XiaomoNeural
    style: cheerful
    styledegree: 2
    role: Girl
    volume: 100.0

Supported languages

Using

Options

  • voice
  • style
  • styledegree: 0.01 – 2, only for zh-CN
  • role: only for zh-CN-XiaomoNeural / zh-CN-XiaoxuanNeural
    • Girl
    • Boy
    • YoungAdultFemale
    • YoungAdultMale
    • OlderAdultFemale
    • OlderAdultMale
    • SeniorFemale
    • SeniorMale
  • pitch / rate / volume / contour

Basic example

service: tts.edge_tts_say
data:
  entity_id: media_player.your_player_entity_id
  message: Hello
  language: zh-CN-XiaoxiaoNeural # Language or voice (Optional)

Full example

service: tts.edge_tts_say
data:
  entity_id: media_player.your_player_entity_id
  message: 吃葡萄不吐葡萄皮,不吃葡萄倒吐葡萄皮
  language: zh-CN
  cache: true
  options:
    voice: zh-CN-XiaomoNeural
    style: cheerful
    styledegree: 2
    role: Girl
    pitch: +0Hz
    rate: +0%
    volume: +10%
    contour: (60%,-60%) (100%,+80%)
    

Curl example

curl -X POST -H "Authorization: Bearer <ACCESS TOKEN>" \
     -H "Content-Type: application/json" \
     -d '{"platform": "edge_tts", "message": "欢迎回家", "language": "zh-CN-XiaoxuanNeural", "cache": false, "options": {"style": "cheerful", "role": "Boy"}}' \
     http://home-assistant.local:8123/api/tts_get_url

Thanks

GitHub

https://github.com/hasscc/hass-edge-tts