Skip to content

Instantly share code, notes, and snippets.

@evilprince2009
Created October 16, 2021 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evilprince2009/291dca7c75a61661b5feb69c59f99dd3 to your computer and use it in GitHub Desktop.
Save evilprince2009/291dca7c75a61661b5feb69c59f99dd3 to your computer and use it in GitHub Desktop.
<!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>
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