- Wes Bos Youtube Javascript30 tutorial: JavaScript Speech Recognition #JavaScript30 20/30.
- Note: to open web links in a new window use: ctrl+click on link
- Tutorial Code for speach recognition using Javascript, part of Javascript30 Youtube series by Wes Bos.
- To install 'browser-sync' dependencies, type 'npm i'.
- To run app type 'npm run start' then click on HTML file manager that appears -
http://localhost:3000/index.html
.
- speach recognition function to convert speach to paragraphs.
recognition.addEventListener('result', e => {
const transcript = Array.from(e.results) // convert to array.
.map(result => result[0])
.map(result => result.transcript)
.join(''); // join strings
// create paragraph for each body of speach.
p.textContent = transcript;
if (e.results[0].isFinal) {
p = document.createElement('p');
words.appendChild(p);
}
if(transcript.includes('say the date' || 'the date')) {
console.log(Date.now())
}
if(transcript.includes('unicorn')) {
console.log('🦄🦄🦄🦄🦄🦄🦄🦄🦄🦄🦄🦄🦄🦄🦄🦄🦄🦄')
}
console.log(transcript);
});
- Functions can be added that are triggered by certain words or phrases, such as 'get the weather'.
- Status: Working.
- To-Do: Nothing.
- Wes Bos Youtube Javascript30 tutorial: JavaScript Speech Recognition #JavaScript30 20/30
- N/A
- Repo created by ABateman, email: gomezbateman@yahoo.com