Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

语音播放读取的内容 #31

Open
Silence-dream opened this issue Jan 27, 2023 · 0 comments
Open

语音播放读取的内容 #31

Silence-dream opened this issue Jan 27, 2023 · 0 comments

Comments

@Silence-dream
Copy link
Owner

<!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>Document</title>
  </head>
  <body>
    <button onclick="press()">点击我</button>
    <script>
      function press() {
        const text = "你好";
        const utterance = new SpeechSynthesisUtterance(text);
        utterance.lang = "en"; // 语言
        utterance.rate = 1;
        utterance.pitch = 1;

        window.speechSynthesis.speak(utterance);
      }
    </script>
  </body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant