JavaScript Speech Recognition

แชร์
ฝัง

ความคิดเห็น • 92

  • @ufotofu9
    @ufotofu9 5 ปีที่แล้ว +2

    So cool that you can do this with just a text editor and a browser! Love your videos. I've built six amazing projects today by watching this series. All of them are things that I would have considered way out of my ability level, but here they are, working. Thank you!

  • @msjogren
    @msjogren 6 ปีที่แล้ว +1

    Great stuff! People are very slow to adapt to innovation. This video is a perfect example. It was done over a year ago and there is not much out there.

  • @joaopargana8983
    @joaopargana8983 6 ปีที่แล้ว +2

    Man, this one was really nice!! Amazing! Thank you so much for these guides

  • @SoulCalMusic
    @SoulCalMusic 4 ปีที่แล้ว +1

    As you mention towards the end, how would you make it only run the recognised function once, so it doesn't keep repeating?

  • @lonnybulldozer8426
    @lonnybulldozer8426 5 ปีที่แล้ว +3

    You could use this to learn how to say ternary.

  • @badarikrishna3169
    @badarikrishna3169 ปีที่แล้ว

    While it's cool, in MDN docs it's clearly mentions that Chrome sends your speech data to servers for processing and it won't work without internet.
    So unfortunately I have to use tensorflowjs for inbox recognition.

  • @missgreendayfan
    @missgreendayfan 6 ปีที่แล้ว +1

    Dammit I can't get it to work, but it seems to recognise the sound... so the problem isn't the microphone. I tried the finished one just to check if it was related to my code but nope :(

  • @uzair004
    @uzair004 4 ปีที่แล้ว +1

    let transcript = e.results[0][0].transcript;
    this line seems to be working as well, instead of converting to array and then mapping through that array.

  • @NeelanshMathur
    @NeelanshMathur 5 ปีที่แล้ว +2

    Wow! It’s new to me and seems fascinating already!
    It was a good video 😊

  • @martinjaskulla2363
    @martinjaskulla2363 6 ปีที่แล้ว +3

    const transcript = e.results[0][0].transcript
    instead of
    const transcript = Array.from(e.results)
    .map(result => result[0])
    .map(result => result.transcript)
    .join("")
    seems also possible

    • @AndrewTSq
      @AndrewTSq 4 ปีที่แล้ว

      That works great :)

  • @olamide333
    @olamide333 7 ปีที่แล้ว +1

    I'm having trouble with getting any text to show in the console on Windows. The innerHTML is not updating, so to print e.result is not even working. My mic is being picked up in the browser and I've run the npm commands, apache on xampp is running, not sure what I'm doing wrong. Any ideas?

    • @danbuild977
      @danbuild977 6 ปีที่แล้ว

      Could you Codepen it? I and the rest of the comment section can have a look at the code for you

  • @thymarques
    @thymarques 4 ปีที่แล้ว

    It deliveries tons of new features for out apps!

  • @jazimabbas8168
    @jazimabbas8168 4 ปีที่แล้ว

    all this browsers support this or not ? or should we go for some external apis like google or microsoft ??

  • @jilanbasha201
    @jilanbasha201 7 ปีที่แล้ว

    Great tutorial, subscribed right after watching this one. Thanks a lot.

  • @arletpaz8010
    @arletpaz8010 4 ปีที่แล้ว

    im sorry but is this for off-line ? or do i need to be in a network

  • @marimuimoto3061
    @marimuimoto3061 7 ปีที่แล้ว

    Hey there, I am quite new to js and I just started learning node/server-side js, so I was wondering if you actually needed to create a separate js file for your local host server. For example:
    // Dependencies
    var http = require("http");
    var fs = require("fs");
    // Set port to 8080
    var PORT = 8080;
    // Create server
    var server = http.createServer(handleRequest);
    // Create a function for handling requests and responses coming into server
    function handleRequest(req, res) {
    // Here we use the fs package to read our index.html file
    fs.readFile(__dirname + "/index.html", function(err, data) {
    // We then respond to the client with the HTML page by specifically telling the browser that we are delivering
    // an html file.
    res.writeHead(200, { "Content-Type": "text/html" });
    res.end(data);
    });
    }
    (add some other stuff)
    // Starts server
    server.listen(PORT, function() {
    console.log("Server is listening on PORT: " + PORT);
    });
    and of course all of the node modules and npm packages. Any help regarding running the app with a server would be greatly appreciated. Thanks so much!!

  • @alex123bob
    @alex123bob 6 ปีที่แล้ว

    Does Safari support this feature, and what about others like MicroSoft's Edge?

  • @LePhenixGD
    @LePhenixGD 10 หลายเดือนก่อน

    You're an amazing tutor bruv!

  • @hkj4714
    @hkj4714 7 ปีที่แล้ว

    Im new to programming and I was wondering what I have to watch/do or if I even need that outher stuff that is there from the beginning.

    • @danbuild977
      @danbuild977 6 ปีที่แล้ว

      HI Gurgamel,
      I hope that I can answer this. The code that is in the index-Start.html file from that beginning of the lesson is necessary to this lesson also.
      Wes, is simply reviewing the key final pieces of the puzzle. To cut down on lesson length and repetition of information.
      Does that all make sense?

  • @subokuleen
    @subokuleen 5 ปีที่แล้ว

    For the transcript, the below code works well:
    const transcript = e.results[0][0]['transcript'];
    I don't know why we should turn transcript into array then join?

    • @GMPGIRI
      @GMPGIRI 5 ปีที่แล้ว +1

      each of the possible translations from speech to text is stored as an index in a 2d array.

  • @khandelwalsahaj36
    @khandelwalsahaj36 5 ปีที่แล้ว

    How do we change paragraph? What do we need to speak?

  • @ihor1337
    @ihor1337 7 ปีที่แล้ว +1

    Hi Wes,
    Thanks a lot for your time and effort you put into creating another great video for us. I have a few questions regarding the speech recognition.
    1). How many languages does it support?
    2). How does it decide which language to choose by default? Does it look at your system's locale settings, or browser settings, or maybe your Google account settings?
    3). Is it possible to set manually the language you'd like to use even if the system's locale is different? (ex. system locale settings are set to US but I want to use let's say a French language)
    4. Is it supported in any other browsers apart from Chrome?
    It would be highly appreciated if you could answer any of the questions above.
    Thanks again for your content.

    • @andreaamorosi231
      @andreaamorosi231 7 ปีที่แล้ว +2

      Hey, maybe I can help
      1) It should support any of the ISO language codes you can use in the HTML lang attribute.
      2) It defaults to the HTML lang attribute value, or the user agent's language setting if that isn't set either.
      3) Yes, by using recognition.lang = 'fr'.
      4) It looks like it's currently supported only by Chrome.
      Check out MDN docs developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition for more info about the api and caniuse.com/#search=speechrecognition for detailed info about browser support.

    • @ihor1337
      @ihor1337 7 ปีที่แล้ว

      Hey Andrea,
      Thanks a lot for answering and proving the useful links.

  • @macyyash5083
    @macyyash5083 4 ปีที่แล้ว +1

    I need source code of this tutorial. could anyone who made it ,send me please...

  • @webguys7051
    @webguys7051 5 ปีที่แล้ว

    I got is to work.
    One small problem.. If the browser is in another language, it will only recognize the words that are in the same language as the broweser.
    For example, my phone's chrome is in Hebrew so it does not understand the English words.
    Same page on my pc - Chrome is in English - it understands only English...
    Is there a fix for this?

    • @pablowbk
      @pablowbk 5 ปีที่แล้ว

      you can set the language, as Wes does with interimResults. here's my code as a reference:
      // initial set up
      const recognition = new SpeechRecognition();
      recognition.interimResults = true;
      recognition.lang = 'en-US';
      recognition.maxAlternatives = 1;
      you'lll need to find in the docs, how's hebrew described so you can assign it to recognition.lang = 'hb-HW' somehting like that

    • @edwardnortmann2489
      @edwardnortmann2489 2 ปีที่แล้ว +1

      @@pablowbk thanks a lot.. I've been looking for this

  • @MrCwatchMan
    @MrCwatchMan 2 ปีที่แล้ว

    why didn't it work? Did something change?

  • @misakikoonce1551
    @misakikoonce1551 5 ปีที่แล้ว

    I keep receiving an error 'SpeechRecognition' is not defined no-undef. I use chrome and I'm using webpack to access a server. This error might be because of webpack but can anyone help me? Here is my main.js looks like (following Wes Bos's code):
    (function() {
    window.SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
    const recognition = new SpeechRecognition();
    recognition.interimResults = true;
    let p = document.createElement('p');
    const words = document.querySelector('.words');
    words.appendChild(p);
    recognition.addEventListener('result', event => {
    const transcript = Array.from(event.results)
    .map(result => result[0])
    .map(result => result.transcript).join('');
    // Create a new container if you make a pause.
    if (event.results[0].isFinal) {
    p = document.createElement('p');
    words.appendChild(p);
    }
    p.textContent = transcript;
    });
    recognition.start();
    // Start recognition after each pause
    recognition.addEventListener('end', recognition.start);
    }());

  • @sivakumark5374
    @sivakumark5374 5 ปีที่แล้ว

    is this one works for codova - hybrid app? any other solution plz. tahnx

  • @smitmirani5245
    @smitmirani5245 5 ปีที่แล้ว +1

    your video is great
    but I have a doubt ,
    how can I export this text in another js file.
    THANK YOU

    • @eccdaba
      @eccdaba 5 ปีที่แล้ว

      fs -- FileSystem the node module.

  • @trophydevice7624
    @trophydevice7624 3 ปีที่แล้ว

    I mainly use Brave Browser, and unfortunately it doesn't have speech recognition... Chrome worked fine for me.
    If anyone found a work around for Brave, please let me know!

  • @anwerammar6021
    @anwerammar6021 4 ปีที่แล้ว

    please , i need to know is that free ? , if i use that in video call app ? because i found on google cloud website , i have to pay if i use it for more than 60 mins but it didn't ask for a keyy

  • @TheChosenSonOfGod
    @TheChosenSonOfGod 7 ปีที่แล้ว

    If you use WebStorm, you don't need to have a server running; WebStorm creates its own for you.

  • @09487abc
    @09487abc 4 ปีที่แล้ว

    i didn't see the source code, does anyone saw where could find this project's source code?

    • @zainnm86
      @zainnm86 4 ปีที่แล้ว

      you can sign up for his course (which includes this lesson with source code) for free. Just search for Javascript30 wes bos course

  • @2ksportsclutch216
    @2ksportsclutch216 5 ปีที่แล้ว

    I am a developer which develop without an internet and speechrecognition seems dont work without internet...
    In recognition.onerror it return network error

    • @erikramirez7210
      @erikramirez7210 5 ปีที่แล้ว

      In chrome, the API uses google cloud, so yeah it needs internet access. You can try pocketsphinx.js for an offline soluction.

    • @moshoodadedolapoadegbolu611
      @moshoodadedolapoadegbolu611 5 ปีที่แล้ว

      I tried downloading the pocketsphinx.js zip but don't know how to go about it, can you please explain more with a link or an example tutorial?

  • @andresmontoya7852
    @andresmontoya7852 7 ปีที่แล้ว

    Hi! Great application, but how can I add Speech recognition Depending of the country, for example, "Es_Co", "En_Us" and like this...

  • @LePhenixGD
    @LePhenixGD 9 หลายเดือนก่อน

    Just beware of that this Web API doesn't work on browsers other than Edge, Chrome, and Safari (it's a paid API provided by Google)

  • @daoudaseye3018
    @daoudaseye3018 6 ปีที่แล้ว

    Seems not working on Android chrome. Any ideas???

  • @moetechsauce
    @moetechsauce 4 ปีที่แล้ว

    does this work on all browsers ?

  • @mirage4731
    @mirage4731 3 ปีที่แล้ว

    why it keeps on asking me permission to use mic

  • @AbsarNaeem1
    @AbsarNaeem1 5 ปีที่แล้ว

    This is only supported by Chrome. I'm using Opera for all the projects. Guess I'll have to skip this one out. But this is great stuff if it goes ahead from Experimental.

  • @glenmoreilagan6317
    @glenmoreilagan6317 6 ปีที่แล้ว

    Sir how to create search engine using voice recognition?

  • @mobcomparison6360
    @mobcomparison6360 ปีที่แล้ว

    How stop recognition

  • @ayushkumarverma6895
    @ayushkumarverma6895 6 ปีที่แล้ว

    What font do you use in ur IDE?

  • @hzg1364
    @hzg1364 3 ปีที่แล้ว

    how can stop that !??

  • @spytuber7765
    @spytuber7765 3 ปีที่แล้ว

    wow bless you dev😉

  • @Mougenenot211
    @Mougenenot211 6 ปีที่แล้ว

    hey, I couln't find the server, how can I do it?

  • @jaronkunkel
    @jaronkunkel 4 ปีที่แล้ว

    I can't get my app to accurately recognize Spanish speech. I don't want all the code here, but does anyone know if maybe the Spanish is just not that accurate? If so I'll stop banging my head against that wall and just use English.

  • @navidshahed9120
    @navidshahed9120 4 ปีที่แล้ว

    Hello. First of all, Im sorry because my english not very good ;) then:
    I wirte this codes in my pc with xampp program and I have 2 problems:
    1. In local host, this codes run correctly, but, when I upload this codes in my site, dont run!
    2. If I open my site in Samsung internet browser, this codes run, but 1000 times request access for alow to use from microphon and I can afew talk then write.

  • @shreyjainhere
    @shreyjainhere 6 ปีที่แล้ว

    Mine is not working .. please find the below code .. Could any one please help me where i was wrong??
    Speech Detection
    window.SpeechRecognition = window.SpeechRecognition || Window.webkitSpeechRecognition;
    const recognition = new SpeechRecognition();
    recognition.interimResults= true;
    recognition.lang = 'en-US';
    let p = document.createElement('p');
    const words = document.querySelector('.words');
    words.appendChild(p);
    recognition.addEventListner('result', e =>{
    const transcript = Array.from(e.results)
    .map(result => result[0])
    .map(result => result.transcript)
    .join('');
    p.textContent = transcript;
    if (e.results[0].isFinal) {
    p=document.createElement('p');
    words.appendChild(p);
    }
    console.log(transcript);
    });
    recognition.addEventListner('end', recognition.start);
    recognition.start();
    html
    {
    font-size: 10px;
    }
    body
    {
    background:#ffc600;
    font-family: 'helvwtica neue';
    font-weight: 200;
    font-size: 20px;
    }
    .words{
    max-width:500px;
    margin:50px auto;
    background:white;
    border-radius:5px;
    box-shadow:10px 10px 0 rgba(0,0,0,0.1);
    padding:1rem 2rem 1rem 5rem;
    background: -webkit-gradient(linear, 0 0, 0 100%, from(#d9eaf3), color-stop(4%, #fff)) 0 4px;
    background-size: 100% 3rem;
    position: relative;
    line-height:3rem;
    }
    p {
    margin: 0 0 3rem;
    }
    .words:before {
    content: '';
    position: absolute;
    width: 4px;
    top: 0;
    left: 30px;
    bottom: 0;
    border: 1px solid;
    border-color: transparent #efe4e4;
    }

    • @teranceedmonds9026
      @teranceedmonds9026 5 ปีที่แล้ว

      hey there here i uploaded the correct code...u have done a little grammar mistakes

      Speech Detection
      window.SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
      const recognition = new SpeechRecognition();
      recognition.interimResults= true;
      recognition.lang = 'en-US';
      let p = document.createElement('p');
      const words = document.querySelector('.words');
      words.appendChild(p);
      recognition.addEventListener('result', e =>{
      const transcript = Array.from(e.results)
      .map(result => result[0])
      .map(result => result.transcript)
      .join('');
      p.textContent = transcript;
      if (e.results[0].isFinal) {
      p=document.createElement('p');
      words.appendChild(p);
      }
      console.log(transcript);
      });

      recognition.addEventListener('end', recognition.start);
      recognition.start();
      html
      {
      font-size: 10px;

      }
      body
      {
      background:#ffc600;
      font-family: 'helvwtica neue';
      font-weight: 200;
      font-size: 20px;
      }
      .words{
      max-width:500px;
      margin:50px auto;
      background:white;
      border-radius:5px;
      box-shadow:10px 10px 0 rgba(0,0,0,0.1);
      padding:1rem 2rem 1rem 5rem;
      background: -webkit-gradient(linear, 0 0, 0 100%, from(#d9eaf3), color-stop(4%, #fff)) 0 4px;
      background-size: 100% 3rem;
      position: relative;
      line-height:3rem;
      }
      p {
      margin: 0 0 3rem;
      }
      .words:before {
      content: '';
      position: absolute;
      width: 4px;
      top: 0;
      left: 30px;
      bottom: 0;
      border: 1px solid;
      border-color: transparent #efe4e4;
      }

  • @faisalimtiaz4390
    @faisalimtiaz4390 5 ปีที่แล้ว

    When i try to run it with cordova app. It always gives me Network error.
    Can you solve this please

    • @erikramirez7210
      @erikramirez7210 5 ปีที่แล้ว

      Make sure to use whitelist plugin and add an entry for any origin *

    • @faisalimtiaz4390
      @faisalimtiaz4390 5 ปีที่แล้ว

      @@erikramirez7210 Got it. Trying

  • @tristancharie8711
    @tristancharie8711 7 ปีที่แล้ว

    Why SpeechRecognition doesn't work for mobile ?
    Also it work only on localhost :(
    Thanks for help

    • @subokuleen
      @subokuleen 5 ปีที่แล้ว

      It only support on chrome or android: developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition#Browser_compatibility

  • @GamingBirdBD
    @GamingBirdBD 6 ปีที่แล้ว

    Thanks u a lot.....it's simply great!!!!

  • @laxmikantyadav3988
    @laxmikantyadav3988 5 ปีที่แล้ว

    Hi,
    Does it work on chromium browser ?

    • @erikramirez7210
      @erikramirez7210 5 ปีที่แล้ว +1

      Yes, but you have to generate some free keys

  • @mustafaanas5991
    @mustafaanas5991 5 ปีที่แล้ว +1

    this is still not supported in Firefox. Annoying
    But thnx man, this is amazing

    • @DAROM-TK
      @DAROM-TK 3 ปีที่แล้ว

      I have error in Firefox, network error. May be you know, how fix this bug?

  • @taihatranduc8613
    @taihatranduc8613 4 ปีที่แล้ว

    thank you a lot. you are so awsome

  • @dimitarvel1441
    @dimitarvel1441 6 ปีที่แล้ว

    Well it's time to put voice control to my website. I am not sure how smart it is but hey, it's a competition. If face Id didn't win it last year, this doesn't have much chance but this combined with image recognition I think will be enough. We will see.

    • @dimitarvel1441
      @dimitarvel1441 5 ปีที่แล้ว

      @@tika5635 last year I made an entire API in python with openCV and tensorflow for face identification.... I am a highschool student btw. I got beat by a girl which had a combustor which probably took her 2 weeks to make. Reasons:
      1 she was a girl
      2 she is wealthy and goes to a private school
      3 they thought I downloaded the software (even though I shared the entire code and documented the progress of every day on my chsngelog)
      4 I had won the year before that with my smart house prototype project using Arduino
      So this year I am making a web app for online learning that will use voice control for interface interaction. It won't be really that complex. I will give it a trigger word of "smart assistant" and it takes the words after that in a command string, which I will explode into every individual word and work out some AI solution which will compare those individual strings and try to find out which command out of an array of commands the user has given.

    • @dimitarvel1441
      @dimitarvel1441 5 ปีที่แล้ว

      @@tika5635 also are you Bulgarian or otherwise Eastern European?

  • @Startoucharavos
    @Startoucharavos 6 ปีที่แล้ว

    gives error on angular component

    • @webguys7051
      @webguys7051 5 ปีที่แล้ว

      Because angular and jQuery do not work together...

  • @ufotofu9
    @ufotofu9 5 ปีที่แล้ว

    Here's what you can use for the 🦄 unicorn!

  • @Oumassabio
    @Oumassabio 3 ปีที่แล้ว

    Give mi simple site code

  • @peterchen1774
    @peterchen1774 7 ปีที่แล้ว

    That's really cool~!!!!

  • @satyensingh1881
    @satyensingh1881 5 ปีที่แล้ว

    Wow awesome code can you shared code

  • @feelingeverfine
    @feelingeverfine 7 ปีที่แล้ว

    Hey Wes,
    I've taken the two speech tutorials and used them to make a "hal9000" that will speak back to you but I'm having an issue.
    If I say hello, it says hey back which then kicks off another hey, and another...
    I've tried to combat this by adding a start, and stop event to the speechsynthesisutterance which stops and starts the recognition.
    The only problem is, when there is no response (msg.text = "") the start never fires which means the recognition never stops and starts back up.
    Now the problem is, since Chrome shuts recognition off after a while I have to add another event to fire on recognition end to restart it.
    This screws up everything by trying to restart started recognition...
    I have been messing with this all day and can't figure it out.
    Can you provide any help?
    Thank you!!!
    github.com/davidhenley/hal9000

    • @jaapdebouw7410
      @jaapdebouw7410 6 ปีที่แล้ว

      David Henley your project looks cool! Did you allready fix your problem?

    • @danbuild977
      @danbuild977 6 ปีที่แล้ว

      Have you got this line in your code?
      recognition.addEventListener('end', recognition.start);
      Sorry if that is a really dumb questions, you are fields ahead of me.

  • @expukpuk
    @expukpuk 5 ปีที่แล้ว

    Thanks mate.

  • @Elduque40
    @Elduque40 7 ปีที่แล้ว

    that was awesome

  • @syediqbalahmed3176
    @syediqbalahmed3176 4 ปีที่แล้ว

    see later

  • @Oumassabio
    @Oumassabio 3 ปีที่แล้ว

    ♥️♥️♥️♥️♥️

  • @Webeli
    @Webeli 6 ปีที่แล้ว

    Love it!

  • @jimmydanger5749
    @jimmydanger5749 7 ปีที่แล้ว

    WDF