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

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.


<!DOCTYPE html>
    <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>


    // You can also require other files to run in this process


function setup() {
  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() {
    if (speechRec.resultValue) {

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

I’ve never coded in Electron. I’ve just looked up for its “Quick Start” tutorial:

1 Like