Modify Spoken Strings for Emphasis

Posted on
Wed Jan 13, 2021 1:10 pm
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Modify Spoken Strings for Emphasis

In playing with a diversion (around here, we call it "seeing a squirrel"), I've been sending strings to the OS 'say' command from a Python script,

Code: Select all
say "Hello world."
I'm not always satisfied with the inflection and tone of the spoken strings, and wanted to modify them. There are some more obvious examples--like inserting a comma, or using phony phonetics ("oonum" vs "unum") --but it turns out there are many others. I stumbled across this reference in Apple's Developer library which proved to be really interesting and helpful. For example, consider:

Code: Select all
Please call me at 5551990.
which results in, "Please call me at five million, five hundred and fifty one thousand, nine hundred ninety", versus:

Code: Select all
Please call me at [[nmbr LTRL]] 5551990 [[nmbr NORM]].
which results in, "Please call me at five five five one nine nine zero."

These commands work in terminal and with indigo.server.speak() (which I believe is a wrapper around the OS say command). I'm not sure that they'll necessarily work with Alexa.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Thu Jan 14, 2021 3:28 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Modify Spoken Strings for Emphasis

DaveL17 wrote:
These commands work in terminal and with indigo.server.speak() (which I believe is a wrapper around the OS say command). I'm not sure that they'll necessarily work with Alexa.


We use the standard macOS Speech APIs (which I assume the /usr/bin/say command uses as well, but we don't call that), so whatever kind of string markup they support would be supported.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Jan 14, 2021 3:47 pm
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Modify Spoken Strings for Emphasis

jay (support) wrote:
DaveL17 wrote:
These commands work in terminal and with indigo.server.speak() (which I believe is a wrapper around the OS say command). I'm not sure that they'll necessarily work with Alexa.


We use the standard macOS Speech APIs (which I assume the /usr/bin/say command uses as well, but we don't call that), so whatever kind of string markup they support would be supported.

Thanks for the clarification, Jay. Hope the move is going well!

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests