Léonie Watson, TetraLogical
Frontend North, Sheffield February 2020
Léonie Watson, TetraLogical
VXML is parsed in voice browsers to create voice interfaces
<prompt>
element
<menu>
element
Recognises human speech and converts it into text
Takes text and converts it into structured data
Takes structured data, processes it, and returns structured data
Takes structured data and converts it into text
Takes text and converts it into synthetic speech
{
"interactionModel": {
"languageModel": {
"invocationName": "conference info",
"intents": [],
"types": []
}
}
}
25 available, including:
{
"interactionModel": {
"languageModel": {
"invocationName": "conference info",
"intents": [
{
"name": "AMAZON.HelpIntent",
"samples": []
}
]
}
}
}
{
"interactionModel": {
"languageModel": {
"invocationName": "conference info",
"intents": [
{
"name": "AboutConferenceIntent",
"samples": [ "about Front End North" ]
}
],
"types": []
}
}
}
{
"intents": [
{
"name": "AboutConferenceIntent",
"slots": [
{
"name": "conference",
"type": "conference"
}
],
"samples": [ "about {conference}" ]
}
],
...
...
"types": [
{
"name": "conference",
"values": [
{
"name": { "value": "Joy of Coding" }
},
{
"name": { "value": "Beyond Tellerand" }
},
{
"name": { "value": "Front End North" }
}
]
}
const Alexa = require("ask-sdk-core");
"version": "1.0",
"session": {
"new": true,
"sessionId": "amzn1.echo-api.session.b65841a9-f6cf-406d-aa6b-5c89097f4de2",
"application": {},
"device": {},
"request": {
"type": "LaunchRequest",
"requestId": "amzn1.echo-api.request.8a52f508-67b6-445b-a0ac-74273ed5ab13",
"timestamp": "2020-02-05T15:50:25Z",
"locale": "en-GB",
"shouldLinkResultBeReturned": false
}
}
const LaunchRequestHandler = {
canHandle(handlerInput) {
return Alexa.getRequestType(handlerInput.requestEnvelope) === "LaunchRequest";
},
handle(handlerInput) {
let welcomePrompt = "Hello Which conference do you want to know about?";
let welcomeReprompt = "Let me know which conference you're interested in?";
return handlerInput.responseBuilder
.speak(welcomePrompt)
.reprompt(welcomeReprompt)
.getResponse();
}
};
"body": {
"version": "1.0",
"response": {
"outputSpeech": {
"type": "SSML",
"ssml": "Hello. Which conference do you want to know about? "
},
"reprompt": {
"outputSpeech": {
"type": "SSML",
"ssml": "Let me know which conference you're interested in? "
}
},
"shouldEndSession": false,
"type": "_DEFAULT_RESPONSE"
},
"sessionAttributes": {},
"userAgent": "ask-node/2.7.0 Node/v10.17.0"
}
"Hello, I'm Alexa and this is how I sound in India.
This is how I sound in America, and this is me in Canada.
Here I am in Australia, and this is me in the United Kingdom."
<p>
elementlet responsePrompt = `The terror, which would not end
for another 28 years – if it ever did end – began,
so far as I know or can tell, with a boat made from
a sheet of newspaper floating down a gutter swollen
with rain.
`;
<voice>
elementlet responsePrompt = `
The terror, which would not end
for another 28 years – if it ever did end – began,
so far as I know or can tell, with a boat made from
a sheet of newspaper floating down a gutter swollen
with rain.
`;
<emphasis>
elementlet responsePrompt =
`
The terror , which would not end
for another 28 years – if it ever did end – began,
so far as I know or can tell , with a boat made from
a sheet of newspaper floating down a gutter swollen
with rain .
`;
<voice>
element againlet responsePrompt = `
The Terror, which would not end
for another 28 years...
`;
<lang>
elementlet responsePrompt = `
The Terror, which would not end
for another 28 years...
`;
<p>
element againlet responsePrompt = `Hello, my name is Inigo Montoya.
You killed my father. Prepare to die!
`;
<break>
elementlet responsePrompt = `
Hello, my name is Inigo Montoya.
You killed my father.
Prepare to die!
`;
<s>
elementlet responsePrompt = `Piglet sidled up to Pooh from behind.
'Pooh!' he whispered.
'Yes, Piglet?'
'Nothing', said Piglet, taking Pooh's paw.
'I just wanted to be sure of you'.`;
<prosody>
elementlet responsePrompt =
`
Piglet sidled up to Pooh from behind.
'Pooh' he whispered.
'Yes, Piglet?''Nothing',
said Piglet, taking Pooh's paw.
'I just wanted to be sure of you'.
`;
<amazon-effect>
elementlet responsePrompt = `
Shhh. Be very, very quiet.
`;
<p>
element againlet responsePrompt = `I'm so excited (and I just can't hide it)!
`;
<amazon:emotion name="excited">
elementlet responsePrompt = `
I'm so excited (and I just can't hide it)!
`;
<amazon:emotion name="disappointed">
elementlet responsePrompt = `
I'm so excited (and I just can't hide it)!
`;
<amazon:domain name="news>"
elementlet responsePrompt = `Now it's me, with the news.
Today absolutely nothing happened. Everybody went
and had a nice cup of tea instead.
`;
<say-as interpret-as="expletive">
elementlet responsePrompt = `
Frankly my dear, I don't give-a
damn !
`;
<say-as interpret-as="interjection">
element UKlet responsePrompt = `
Ace. As if. Bah humbug. Blimey. Cha ching. Crikey.
Eek. Good Grief. Hiss. Moo. Nom nom. Oof. Oy. Simples.
Tick tick tick. Uh huh. Whee.
`;
<say-as interpret-as="interjection">
element Australialet responsePrompt = `
aaaarrrr. As if. aussie aussie aussie. aw man. blimey.
bummer. checkmate. fair dinkum. fair go. g'day.
good onya. no worries. strewth. you beauty.
`;
SpeechSynthesisUtterance
objectvar utterance = new SpeechSynthesisUtterance();
.text
attributeutterance.text = "Tequila!";
.speak()
methodwindow.speechSynthesis.speak(utterance);
.getVoices()
methodvar tts = speechSynthesis.getVoices();
.voice
attributeutterance.voice = "Microsoft Hazel desktop - English (Great Britain)";
Describe the characteristics of content when spoken by synthetic speech
speak:;
property.content {
speak: auto;
}
voice-volume:;
property.content {
voice-volume: loud;
}
voice-rate:;
property.content {
voice-rate: x-fast;
}
voice-pitch:;
property.content {
voice-pitch: x-low;
}
News headline: Nothing happened!
Reported on 1 April
Nothing happened today.
Everybody went and had a nice cup of tea instead.
.headline {
speak: auto;
voice-volume: x-loud;
voice-rate: fast;
voice-pitch: high;
}
.date {
speak: auto;
voice-volume: soft;
voice-rate: x-fast;
voice-pitch: low;
}