Skip to content

Commit d9fb768

Browse files
authored
Native text to speech JS
1 parent aab98f5 commit d9fb768

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
|39 | [Numeric separators allow us to improve our code readability](#Numeric-separators-allow-us-to-improve-our-code-readability)|
4646
|40 | [pay attention when using every](#pay-attention-when-using-every)|
4747
|41 | [How to convert an array of key-value tuples into an object](#How-to-convert-an-array-of-key-value-tuples-into-an-object)|
48-
48+
|42 | [Native text to speech JS](#Native-text-to-speech-JS)|
4949

5050

5151

@@ -903,4 +903,25 @@ const obj = Object.fromEntries(JSarr);
903903
//}
904904
```
905905
906+
**[⬆ Back to Top](#table-of-contents)**
907+
### Native text to speech JS
908+
909+
910+
```javascript
911+
912+
const startSpeaking=()=>{
906913
914+
let msg = document.getElementById("text-to-speech").value;
915+
let speech = new SpeechSynthesisUtterance();
916+
917+
speech.lang = "en-US";
918+
speech.text = msg;
919+
speech.volume = 1;
920+
speech.rate = 1;
921+
speech.pitch = 1;
922+
923+
window.speechSynthesis.speak(speech);
924+
}
925+
926+
927+
```

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy