Web Speech API
Web Speech API позволÑÐµÑ Ð²Ð·Ð°Ð¸Ð¼Ð¾Ð´ÐµÐ¹ÑÑвоваÑÑ Ñ Ð³Ð¾Ð»Ð¾ÑовÑми инÑеÑÑейÑами в ваÑÐ¸Ñ Ð²ÐµÐ± пÑиложениÑÑ . Web Speech API ÑоÑÑÐ¾Ð¸Ñ Ð¸Ð· двÑÑ ÑаÑÑей: SpeechSynthesis (ТекÑÑ-в-РеÑÑ), и SpeechRecognition (ÐÑÐ¸Ð½Ñ Ñонное ÑаÑпознавание ÑеÑи)
ÐонÑепÑии и иÑполÑзование Web Speech
Web Speech API позволÑÐµÑ Ð²ÐµÐ± пÑиложениÑм ÑпÑавлÑÑÑ Ð³Ð¾Ð»Ð¾ÑовÑми даннÑми. СÑÑеÑÑвÑÐµÑ Ð´Ð²Ð° компоненÑа к ÑÑÐ¾Ð¼Ñ API:
- РаÑпознавание голоÑа. ÐоÑÑÑп обеÑпеÑиваеÑÑÑ ÑеÑез
SpeechRecognitionинÑеÑÑейÑ, коÑоÑÑй в ÑÐ²Ð¾Ñ Ð¾ÑеÑÐµÐ´Ñ Ð¾Ð±ÐµÑпеÑÐ¸Ð²Ð°ÐµÑ Ð²Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð¾ÑÑÑ ÑаÑпознаваÑÑ ÑекÑÑ Ð¸Ð· Ð²Ñ Ð¾Ð´ÑÑего аÑдио поÑока (обÑÑно ÑеÑез ÑÑÑÑойÑÑво ÑаÑÐ¿Ð¾Ð·Ð½Ð°Ð²Ð°Ð½Ð¸Ñ ÑеÑи в ÑÑÑÑойÑÑве по ÑмолÑаниÑ) и оÑвеÑаÑÑ ÑооÑвеÑÑÑвенно. ÐоÑполÑзовавÑиÑÑ ÐºÐ¾Ð½ÑÑÑÑкÑоÑом инÑеÑÑейÑа Ð²Ñ Ð¼Ð¾Ð¶ÐµÑе ÑоздаÑÑ Ð½Ð¾Ð²ÑйSpeechRecognitionобÑекÑ, Ñ ÐºÐ¾ÑоÑого еÑÑÑ ÑÑд ÑобÑÑий Ð´Ð»Ñ Ð¾Ð±Ð½Ð°ÑÑÐ¶ÐµÐ½Ð¸Ñ Ð½Ð°Ñала ÑеÑи ÑеÑез микÑоÑон ÑÑÑÑойÑÑва.SpeechGrammarинÑеÑÑÐµÐ¹Ñ Ð¿ÑедоÑÑавлÑÐµÑ ÐºÐ¾Ð½ÑÐµÐ¹Ð½ÐµÑ Ð´Ð»Ñ Ð¾Ð¿ÑеделÑнного набоÑа гÑаммаÑики, коÑоÑое ваÑе пÑиложение должно иÑполÑзоваÑÑ. ÐÑаммаÑика опÑеделÑеÑÑÑ Ñ Ð¿Ð¾Ð¼Ð¾ÑÑÑ JSpeech Grammar Format (JSGF.) - ÐоÑÑÑп к ÑинÑÐµÐ·Ñ ÑеÑи оÑÑÑеÑÑвлÑеÑÑÑ Ñ Ð¿Ð¾Ð¼Ð¾ÑÑÑ
SpeechSynthesisинÑеÑÑейÑа, ÐºÐ¾Ð¼Ð¿Ð¾Ð½ÐµÐ½Ñ text-to-speech позволÑÐµÑ Ð¿ÑиложениÑм пÑоÑеÑÑÑ Ñвой ÑекÑÑовÑй конÑÐµÐ½Ñ (обÑÑно ÑеÑез деÑолÑнÑй ÑинÑезаÑÐ¾Ñ ÑеÑи ÑÑÑÑойÑÑва). ÐSpeechSynthesisVoiceобÑекÑÐ°Ñ ÐµÑÑÑ ÑазлиÑнÑе ÑÐ¸Ð¿Ñ Ð³Ð¾Ð»Ð¾Ñа, и ÑазлиÑнÑм ÑаÑÑÑм ÑекÑÑа можно назнаÑаÑÑSpeechSynthesisUtteranceобÑекÑÑ. Ðожно наÑаÑÑ Ð²Ð¾ÑпÑоизведение пеÑедав Ð¸Ñ Ð¼ÐµÑодÑSpeechSynthesis.speak().
ÐÐ»Ñ Ð±Ð¾Ð»ÑÑей инÑоÑмаÑии по иÑполÑÐ·Ð¾Ð²Ð°Ð½Ð¸Ñ ÑÑÐ¸Ñ ÑиÑ, ÑмоÑÑиÑе Using the Web Speech API.
ÐнÑеÑÑейÑÑ Web Speech API
>РаÑпознавание ÑеÑи
SpeechRecognition-
The controller interface for the recognition service; this also handles the
SpeechRecognitionEventsent from the recognition service. SpeechRecognitionAlternative-
ÐÑедÑÑавлÑÐµÑ Ð¾Ð´Ð½Ð¾ Ñлово коÑоÑое бÑло ÑаÑпознано ÑлÑжбой ÑаÑÐ¿Ð¾Ð·Ð½Ð°Ð²Ð°Ð½Ð¸Ñ Ð³Ð¾Ð»Ð¾Ñа.
SpeechRecognitionError-
ÐÑедÑÑавлÑÐµÑ ÑообÑÐµÐ½Ð¸Ñ Ð¾Ð± оÑÐ¸Ð±ÐºÐ°Ñ Ð¸Ð· ÑлÑÐ¶Ð±Ñ ÑаÑпознаваниÑ.
SpeechRecognitionEvent-
The event object for the
resultandnomatchevents, and contains all the data associated with an interim or final speech recognition result. SpeechGrammar-
Слова или ÑÐ°Ð±Ð»Ð¾Ð½Ñ Ñлов коÑоÑÑе Ð¼Ñ Ñ Ð¾Ñим ÑÑÐ¾Ð±Ñ ÑлÑжба ÑаÑÐ¿Ð¾Ð·Ð½Ð°Ð²Ð°Ð½Ð¸Ñ ÑаÑпознала.
SpeechGrammarList-
ÐÑедÑÑавлÑÐµÑ ÑпиÑок обÑекÑов
SpeechGrammar. SpeechRecognitionResult-
ÐÑедÑÑавлÑÐµÑ Ð¾Ð´Ð½Ð¾ ÑаÑпознанное Ñовпадение, коÑоÑое Ð¼Ð¾Ð¶ÐµÑ ÑодеÑжаÑÑ Ð½ÐµÑколÑко обÑекÑов
SpeechRecognitionAlternative. SpeechRecognitionResultList-
Represents a list of
SpeechRecognitionResultobjects, or a single one if results are being captured incontinuousmode.
СинÑезиÑование ÑеÑи
SpeechSynthesis-
The controller interface for the speech service; this can be used to retrieve information about the synthesis voices available on the device, start and pause speech, and other commands besides.
SpeechSynthesisErrorEvent-
Contains information about any errors that occur while processing
SpeechSynthesisUtteranceobjects in the speech service. SpeechSynthesisEvent-
Contains information about the current state of
SpeechSynthesisUtteranceobjects that have been processed in the speech service. SpeechSynthesisUtterance-
Represents a speech request. It contains the content the speech service should read and information about how to read it (e.g. language, pitch and volume.)
SpeechSynthesisVoice-
Represents a voice that the system supports. Every
SpeechSynthesisVoicehas its own relative speech service including information about language, name and URI. Window.speechSynthesis-
Specced out as part of a
[NoInterfaceObject]interface calledSpeechSynthesisGetter, and Implemented by theWindowobject, thespeechSynthesisproperty provides access to theSpeechSynthesiscontroller, and therefore the entry point to speech synthesis functionality.
ÐÑимеÑÑ
Web Speech API ÑепозиÑоÑий на GitHub ÑодеÑÐ¶Ð¸Ñ Ð¿ÑимеÑÑ, показÑваÑÑие ÑаÑпознавание и ÑинÑез ÑеÑи.
СпеÑиÑикаÑии
| Specification |
|---|
| Web Speech API |
СовмеÑÑимоÑÑÑ Ñ Ð±ÑаÑзеÑами
>api.SpeechRecognition
api.SpeechSynthesis
СмоÑÑиÑе Ñакже
- Using the Web Speech API
- SitePoint article
- HTML5Rocks article
- Demo [aurelio.audero.it]