You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 16, 2023. It is now read-only.
Microsoft's Speech Service is a cloud-based platform that features the most advanced algorithms available for converting spoken audio to text. The Universal Speech Protocol allows you to integrate speech recognition into your application using the Microsoft Speech Service.
5
5
6
6
## Install
7
-
To install [npm package](https://www.npmjs.com/package/microsoft-speech-browser-sdk) run
7
+
To install [npm package](https://www.npmjs.com/package/microsoft-speech-browser-SDK) run
8
8
```
9
-
npm install microsoft-speech-browser-sdk
9
+
npm install microsoft-speech-browser-SDK
10
10
```
11
11
12
12
## JavaScript SDK - Sample Usage
13
-
[RequireJs](http://requirejs.org/) is a dependency. Make sure to reference it in your page before using the SDK.
13
+
14
+
### As a Node module
15
+
16
+
If you're building a node app and want to use the Speech SDK, all you need to do is add the following import statement:
14
17
15
18
```javascript
16
-
// Resolve the SDK dependecy using RequireJs
17
-
require(["Speech.Browser.Sdk"], function(SDK) {
18
-
// Now start using the SDK
19
-
});
19
+
import*asSDKfrom'microsoft-speech-browser-SDK';
20
+
```
20
21
21
-
// Setup the recongizer
22
+
<aname="reco_setup"></a>and setup the recognizer:
23
+
24
+
```javascript
22
25
functionRecognizerSetup(SDK, recognitionMode, language, format, subscriptionKey) {
// Alternatively use SDK.CognitiveTokenAuthentication(fetchCallback, fetchOnExpiryCallback) for token auth
@@ -95,10 +98,30 @@ function RecognizerStop(SDK, recognizer) {
95
98
}
96
99
```
97
100
98
-
## ES6 Module Usage
99
-
```javascript
100
-
import*asSDKfrom'microsoft-speech-browser-sdk';
101
-
```
101
+
102
+
### In a Browser, as a native ES6 module
103
+
104
+
...in progress, check back a little later.
105
+
106
+
### In a Browser, using Webpack
107
+
108
+
Currently, the TypeScript code in this SDK is compiled using the default module system (CommonJS), which means that the compilation produces a number of distinct JS source files. To make the SDK usable in a browser, it first needs to be "browserified" (all the javascript sources need to be glued together). Towards this end, this is what you need to do:
109
+
110
+
1. Add `require` statement to you web app source file, for instance (take a look at [sample_app.js](samples/browser/sample_app.js)):
What to try the sample ? All you need is a subscription key. [Sign up](https://www.microsoft.com/cognitive-services/en-us/sign-up) to get one.
@@ -108,12 +131,12 @@ Here is a handy link to our [Sample](https://htmlpreview.github.io/?https://gith
108
131
**Note:** Some browsers block microphone access on un-secure origin. So, it is recommended to host the 'sample'/'your app' on https to get it working on all supported browsers.
109
132
110
133
## Docs
111
-
The sdk is a reference implementation for the speech websocket protocol. Check the [API reference](https://docs.microsoft.com/en-us/azure/cognitive-services/speech/api-reference-rest/bingvoicerecognition#websocket) and [Websocket protocol reference](https://docs.microsoft.com/en-us/azure/cognitive-services/speech/api-reference-rest/websocketprotocol) for more details.
134
+
The SDK is a reference implementation for the speech websocket protocol. Check the [API reference](https://docs.microsoft.com/en-us/azure/cognitive-services/speech/API-reference-rest/bingvoicerecognition#websocket) and [Websocket protocol reference](https://docs.microsoft.com/en-us/azure/cognitive-services/speech/API-reference-rest/websocketprotocol) for more details.
112
135
113
136
## Browser support
114
-
The SDK depends on WebRTC apis to get access to the microphone and read the audio stream. Most of todays browsers(Edge/Chrome/Firefox) support this. For more details about supported browsers refer to [navigator.getUserMedia#BrowserCompatibility](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/getUserMedia#Browser_compatibility)
137
+
The SDK depends on WebRTC APIs to get access to the microphone and read the audio stream. Mostof todays browsers(Edge/Chrome/Firefox) support this. For more details about supported browsers refer to [navigator.getUserMedia#BrowserCompatibility](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/getUserMedia#Browser_compatibility)
115
138
116
-
**Note:** The sdk currently depends on [navigator.getUserMedia](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/getUserMedia#Browser_compatibility)api. However this api is in process of being dropped as browsers are moving towards newer [MediaDevices.getUserMedia](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia) instead. The sdk will add support to the newer api soon.
139
+
**Note:** The SDK currently depends on [navigator.getUserMedia](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/getUserMedia#Browser_compatibility) API. However this API is in process of being dropped as browsers are moving towards newer [MediaDevices.getUserMedia](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia) instead. The SDK will add support to the newer API soon.
117
140
118
141
## Contributing
119
142
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
0 commit comments