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

How to make p5.speech work in electron application for speech to text? #34

Open
alokmahor opened this issue Jun 27, 2022 · 0 comments
Open

Comments

@alokmahor
Copy link

I have created a smaple electron application to try p5.speech. But that is not working and I am not seeing any error in console.

Index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Hello p5.js!</title>
    <script language="javascript" type="text/javascript" src="libraries/p5.js"></script>
    <script language="javascript" src="libraries/p5.dom.js"></script>
    <script language="javascript" src="libraries/p5.sound.js"></script>
    <script language="javascript" src="libraries/p5.speech.js"></script>
    <script language="javascript" type="text/javascript" src="my_speech.js"></script>
    <!-- this line removes any default padding and style. you might only need one of these values set. -->
    <style> body {padding: 0; margin: 0; background: #000000; overflow-x:hidden; overflow-y: hidden} </style>
  </head>
  <body>

  </body>

  <script>
    // You can also require other files to run in this process
    require('../renderer.js')
  </script>
</html>

my_speech.js

function setup() {
  noCanvas();
  let lang = navigator.language || 'en-US';
  let speechRec = new p5.SpeechRec(lang, gotSpeech);

  let continuous = true;
  let interim = false;
  speechRec.start(continuous, interim);
  function gotSpeech() {
      console.log(speechRec);
    if (speechRec.resultValue) {
      createP(speechRec.resultString);
    }
  }
}

This setup is working fine in browser. How can I make it work in electron application?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant