Skip to main content

chime_tts.say Examples

The following YAML examples cover additional features provided by the chime_tts.say action:

Basic TTS Audio

All action calls to chime_tts.say action must include one or more media_player entity targets, and a data object with the TTS message and tts_platform values.

Basic example

action: chime_tts.say
target:
entity_id:
- media_player.living_room
data:
tts_platform: google_translate
message: Hello world!

chime_path

Use chime_path to play a chime before the TTS audio (using a 'Chime TTS' chime):

action: chime_tts.say
target:
entity_id:
- media_player.living_room
data:
tts_platform: google_translate
message: Hello world!
chime_path: tada

end_chime_path

Use end_chime_path to play a chime after the TTS audio (from your media folder)

action: chime_tts.say
target:
entity_id:
- media_player.living_room
data:
tts_platform: google_translate
message: Hello world!
end_chime_path: /media/sounds/doorbell.mp3

chime_path and end_chime_path

Include both chime_path and end_chime_path to play a chime before and after TTS audio

action: chime_tts.say
target:
entity_id:
- media_player.living_room
data:
tts_platform: google_translate
message: Hello world!
chime_path: drumroll
end_chime_path: /media/sounds/doorbell.mp3

More complex examples

tts_speed

Use the tts_speed parameter to increase/decrease the TTS audio speed

Increase speed

action: chime_tts.say
target:
entity_id:
- media_player.kitchen
- media_player.dining_room
data:
chime_path: bells_2
message: The washing's done!
tts_platform: amazon_polly
tts_speed: 150

Decrease speed

action: chime_tts.say
target:
entity_id:
- media_player.kitchen
- media_player.dining_room
data:
chime_path: bells_2
message: The washing's done!
tts_platform: amazon_polly
tts_speed: 75

tts_pitch

Use the tts_pitch parameter to raise/lower the pitch of the TTS audio

Raise pitch

action: chime_tts.say
target:
entity_id:
- media_player.kitchen
- media_player.dining_room
data:
chime_path: chord
message: The washing's done!
tts_platform: amazon_polly
tts_pitch: 5

Lower pitch

action: chime_tts.say
target:
entity_id:
- media_player.kitchen
- media_player.dining_room
data:
chime_path: chord
message: The washing's done!
tts_platform: amazon_polly
tts_pitch: -7

Musical Fun

action: chime_tts.say
target:
entity_id:
- media_player.kitchen
- media_player.dining_room
data:
tts_platform: google_translate
message:
- tts: Laah
pitch: -12
speed: 90
- tts: Laah
pitch: 0
speed: 125
offset: -400
- tts: Laah
pitch: 4
speed: 90
offset: -400
- tts: Laah
pitch: 7
speed: 125
offset: -400
- tts: Laah
pitch: -15
speed: 90
offset: -400
- tts: Laah
pitch: -3
speed: 125
offset: -400
- tts: Laah
pitch: 1
speed: 90
offset: -400
- tts: Laah
pitch: 4
speed: 125
offset: -400
- tts: Laah
pitch: -19
speed: 90
offset: -400
- tts: Laah
pitch: -7
speed: 125
offset: -400
- tts: Laah
pitch: -3
speed: 90
offset: -400
- tts: Laah
pitch: 0
speed: 125
offset: -400
- tts: Laah
pitch: -17
speed: 90
offset: -400
- tts: Laah
pitch: -5
speed: 125
offset: -400
- tts: Laah
pitch: -1
speed: 90
offset: -400
- tts: Laah
pitch: 2
speed: 125
offset: -400
- tts: Laah
pitch: 12
speed: 70
offset: -4916
- tts: Laah
pitch: 12
speed: 70
offset: -4340
- tts: Laah
pitch: 12
speed: 39.05
offset: -3950
- tts: Laah
pitch: 12
speed: 125
offset: -2300
- tts: Laah
pitch: 11
speed: 90
offset: -2150
- tts: Laah
pitch: 9
speed: 125
offset: -1800
- tts: Laah
pitch: 11
speed: 90
offset: -1600
- tts: Laah
pitch: 12
speed: 125
offset: -1200
- tts: Laah
pitch: 15
speed: 90
offset: -1000

offset

Use the offset parameter to shift the start of chime/TTS audio backward (to overlap) or forward (to add a delay)

Positive Offset (delay audio)

Using a positive offset value adds a delay between chimes and TTS audio.

action: chime_tts.say
target:
entity_id:
- media_player.kitchen
- media_player.dining_room
data:
chime_path: drumroll
end_chime_path: tada
message: The suspense is killing me
tts_platform: google_translate
offset: 2000

Negative Offset (overlay audio)

Using a negative offset value overlays chimes and TTS audio on top of each other.

action: chime_tts.say
target:
entity_id:
- media_player.kitchen
- media_player.dining_room
data:
chime_path: soft
message: It's time to go to work
tts_platform: google_translate
offset: -2100

language and tld

You can use language and tld to play TTS audio with a different language and/or accent on the Google Translate TTS platform

action: chime_tts.say
target:
entity_id:
- media_player.kitchen
- media_player.dining_room
data:
chime_path: tada
message: le lavage est fait!
tts_platform: google_translate
language: fr
tld: fr

join_players

Use the join_players parameter to hear the announcement across multiple speakers at the same time (only on supported speakers).

action: chime_tts.say
target:
entity_id:
- media_player.kitchen
- media_player.dining_room
- media_player.bedroom
data:
chime_path: tada
message: The washing's done!
tts_platform: amazon_polly
join_players: true
unjoin_players: true

audio_conversion

Use the audio_conversion parameter to specify FFmpeg arguments/presets to process the generated audio.

action: chime_tts.say
target:
entity_id:
- media_player.kitchen
data:
chime_path: bells
message: Audio at 50% volume
tts_platform: google_translate
tld: com.au
audio_conversion: Volume 50%

Message Segments

The message parameter can be used to specify multiple message segments which can be used to construct complicated notifications of muliple chimes & TTS audio segments.

tts Segment Type

Review the tts segment type documentation to learn more.

action: chime_tts.say
target:
entity_id: media_player.kitchen_speaker
data:
chime_path: classical
end_chime_path: marimba
tts_platform: google_translate
cache: false
language: en
message:
- tts: May I please have your attention?
cache: true
- tts: It is officially time to move the washing to the dryer
offset: 3000
options:
tld: co.uk
- tts: Vámonos!
language: es
options:
tld: es
tts_speed: 115
- type: tts
message: Let's go!
tts_platform: amazon_polly

In the above example:

  • The 1st segment overrides the cache parameter, setting it to true for the segment.
  • The 2nd segment adds a 3 second delay before the TTS message and overrides the domain, setting it to the UK.
  • The 3rd segment overrides the language, setting it to Spanish with the domain accent of Spain, and sets the speech rate to 115%.
  • The 4th segment overrides the TTS platform, setting it to Amazon Polly.

chime Segment Type

Review the chime segment type documentation to learn more.

action: chime_tts.say
target:
entity_id: media_player.kitchen_speaker
data:
chime_path: toast
end_chime_path: tada
tts_platform: google_translate
message:
- tts: And the winner is, drumroll please
- chime: drumroll
offset: 500
- tts: You!
offset: 0
- chime: /config/media/sounds/my_chimes/hooray.mp3
- tts: You get to move the washing to the dryer!
- chime: dun_dun_dun
- tts: Sorry. You're the only one with arms.

delay Segment Type

Review the delay segment type documentation to learn more.

action: chime_tts.say
target:
entity_id: media_player.kitchen_speaker
data:
tts_platform: google_translate
message:
- tts: Hey, do you hear that? Just listen.
- delay: 1000
- tts: Yep, sounds like clothes waiting to be moved to the dryer

repeat

All message segment types can include a repeat parameter to specify the number of times to repeat the segment.

action: chime_tts.say
target:
entity_id: media_player.macbook_air
data:
tts_platform: google_translate
message:
- chime: https://www.zapsplat.com/wp-content/uploads/2015/sound-effects-three/household_clock_cuckoo_strike_001.mp3
repeat: 3
offset: -800
- tts: It's 3 o'clock