Created
October 16, 2021 08:29
-
-
Save evilprince2009/291dca7c75a61661b5feb69c59f99dd3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>slang.js</title> | |
</head> | |
<body> | |
<button>Speak</button> | |
</body> | |
<script src="sctipt.js"></script> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let voice = new SpeechSynthesisUtterance(); | |
voice.text = "Hello World"; | |
voice.volume = 1; | |
voice.pitch = 1; | |
const button = document.querySelector("button"); | |
button.addEventListener("click", () => { | |
window.speechSynthesis.speak(voice); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment