Skip to content

Commit 8052251

Browse files
committed
Add SSML example
1 parent 5fa33df commit 8052251

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

assets/html/ssml.html

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!DOCTYPE HTML>
2+
<html>
3+
<head>
4+
</head>
5+
<body>
6+
7+
<button id="press-to-speak">Press to speak</button>
8+
9+
<script>
10+
var a = `
11+
<speak>
12+
What does the Spanish word
13+
<break time="1s"/><prosody rate="slow"><lang xml:lang="es-ES">casa</lang></prosody><break time="1s"/>
14+
mean in English?
15+
</speak>
16+
`;
17+
18+
var b = `
19+
<speak>
20+
<p>
21+
<s>You have 4 new messages.</s>
22+
<s>The first is from Stephanie Williams and arrived at <break/> 3:45pm.
23+
</s>
24+
<s>
25+
The subject is <prosody rate="-20%">ski trip</prosody>
26+
</s>
27+
</p>
28+
</speak>
29+
`
30+
31+
var utterThis = new SpeechSynthesisUtterance(a);
32+
// utterThis.voice = window.speechSynthesis.getVoices()[0];
33+
document.getElementById("press-to-speak").addEventListener("click", () => {
34+
window.speechSynthesis.speak(utterThis);
35+
});
36+
37+
</script>
38+
</body>
39+
</html>
40+

0 commit comments

Comments
 (0)