Here is a short video of the keyword spotting demo.
And here is a short video of the video interaction demo.
What is It?
At the moment, JsSpeechRecognizer does not include any data model, so you will have to train new words before using it.
How Does it Work?
JsSpeechRecognizer uses browser WebRTC functionality to get access to the microphone and Fast Fourier Transform (fft) data. Therefore, it will only work in browsers with WebRTC support.
This file contains all of the specific speech recognizer logic.
Detailed Write Up
For a more detailed write up on how the JsSpeechRecognizer was built click here.
Play with the Live Demo here. It has only been tested in Firefox and Chrome.
Tips for the Live Demo
- Try training the word "yes", and then training the word "no".
- It is recommended that you train and test in a quiet room.
- You can (and should) train a word multiple times. This is especially important if you are trying to recognize words that sound very similar such as "no" and "go".
- Use the "play" button to hear the audio data that was recorded. You should verify that a recording in the training set is of good quality and is of the correct word.
- If a recording is incorrect, of bad quality, or contains too much noise get rid of it with the "delete" button.
- Try training phrases like "find sushi" or "show me coffee in San Francisco"
- Train and detect laughing or screaming.
- Use emoticons like
🐔, instead of words.
- Train the recognizer with one person, and test with another person.
Find information about more demos here.
I would love to hear more ideas!
Running the Demos on Your Own Machine
The demo speechrec.html lets you train new words and then recognize them.
Running in Firefox
Simply open the file speechrec.html. You should get a popup from the browser asking you if you would like to grant the site permission to use the microphone.
Running in Chrome
If the speechrec.html file is opened as a local file (with a file:/// prefix) the demo will not work by default due to security settings. You can either disable the security (temporarily) or set up a local server to test the file.
I recommend using a Python SimpleHTTPServer. Open up a terminal, cd to the proper folder you want to host, and run the following command:
python -m SimpleHTTPServer 8000
python -m http.server 8000
Open up "localhost:8000" in your browser to see the list of files in the folder being shared. For more details see the python documentation. https://docs.python.org/2/library/simplehttpserver.html
Other alternatives include browser-sync or webpack-dev-server.
For more details about Chrome and webrtc locally, see the following stack overflow question: http://stackoverflow.com/questions/14318319/webrtc-browser-doesnt-ask-for-mic-access-permission-for-local-html-file
I have not tested other browsers.