arretx
(Jon Griffith)
1
So I have a node that calls the TTS service and passes a {"message":"{{payload}}"}
to my media player.
The payload in this instance is the friendly_name
of any device_tracker.*
that changes from home
to not_home
and vice-versa.
If there is an apostrophe in the friendly_name
, text to speech only speaks the word(s) up to the apostrophe.
“Jon’s iPhone” is heard as “Jon”
How do I escape the apostrophe using a change node…or should I just change the friendly name?
petro
(Petro)
4
Personally, I’d just replace apostrophes with emtpyness. Who cares if it looks correct as long as it’s said correctly.
{{ playload.replace("'","") }}
arretx
(Jon Griffith)
5
Hey, that’s a simple solution.
IT looks like you escape the apostrophe with a backslash. So it would be Jon\'s iPhone
curl -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) -H "Content-Type: application/json; charset=utf-8" --data "{
'input':{
'text':'I\'ve added the event to your calendar.'
},
'voice':{
'languageCode':'en-gb',
'name':'en-GB-Standard-A',
'ssmlGender':'FEMALE'
},
'audioConfig':{
'audioEncoding':'MP3'
}
}" "https://texttospeech.googleapis.com/v1/text:synthesize"
From https://cloud.google.com/text-to-speech/docs/basics