Does Chrome have built-in speech recognition for “

2019-01-16 20:22发布

I'm wondering how

<input type="text" x-webkit-speech speech />

Is there a speech recognition enging built into Chrome or is it accessing an underlying speech recognition facility in the operating system?

10条回答
女痞
2楼-- · 2019-01-16 21:10

There is an experimental fork of speexenc that can encode x-speex-with-header-byte MIME binary format, its referenced on the QXIP Wiki and is available on GitHub. Does the job fine by placing the size of the frame as the first byte of packets.

查看更多
别忘想泡老子
3楼-- · 2019-01-16 21:15

According to the code it sends the audio data as a POST request to:

https://www.google.com/speech-api/v1/recognize?client=chromium&lang=??&lm=??&xhw=??&maxresults=3

lm is grammar in the code, xhw is hardware_info which is optional according to a comment. The audio appears to be speex, x-speex-with-header-byte:

// Encode the frame and place the size of the frame as the first byte. This
// is the packet format for MIME type x-speex-with-header-byte.

It looks like it would be pretty trivial to modify the chrome code to use in your own app.

Update:

You also need to get a speech recognition API key and they are limited to 50 requests per day. There is no way to increase that limit - not even by paying.

查看更多
对你真心纯属浪费
4楼-- · 2019-01-16 21:16

Yup, Chrome does speech recognition via Google's servers. But there's no reason that other browsers couldn't choose to implement it differently (for example using some speech recognition facility in the OS).

Balu, your link is actually a bit out of date. The latest Google proposal can be found here: http://www.w3.org/2005/Incubator/htmlspeech/2010/10/google-api-draft.html

Although speech recognition has been available in the Chrome dev channel for some time, it has not shipped yet and we're not yet sure when it will ship. We definitely want people to play with the API and offer feedback on it, but we don't think it's quite ready for prime time yet.

查看更多
▲ chillily
5楼-- · 2019-01-16 21:16

Yes, Chrome does have built-in speech support through WebKit; just look at the Google homepage (which now has a microphone to the right of the search box). I wonder, however, if the Chrome team is working on Omnibox speech support. After all, Chrome is a WebKit-based browser!

查看更多
登录 后发表回答