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.
3
+
## Prerequisites
5
4
6
-
## Install
7
-
To install [npm package](https://www.npmjs.com/package/microsoft-speech-browser-SDK) run
5
+
### Subscribe to the Speech Recognition API, and get a free trial subscription key
6
+
7
+
The Speech API is part of Cognitive Services. You can get free trial subscription keys from the [Cognitive Services subscription](https://azure.microsoft.com/try/cognitive-services/) page. After you select the Speech API, select **Get API Key** to get the key. It returns a primary and secondary key. Both keys are tied to the same quota, so you can use either key.
8
+
9
+
**Note:** Before you can use Speech client libraries, you must have a [subscription key](https://azure.microsoft.com/try/cognitive-services/).
10
+
11
+
## Get started
12
+
13
+
In this section we will walk you through the necessary steps to load a sample HTML page. The sample is located in our [github repository](https://github.com/Azure-Samples/SpeechToText-WebSockets-Javascript). You can **open the sample directly** from the repository, or **open the sample from a local copy** of the repository.
14
+
15
+
**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.
16
+
17
+
### Open the sample directly
18
+
19
+
Acquire a subscription key as described above. Then open the [link to the sample](https://htmlpreview.github.io/?https://github.com/Azure-Samples/SpeechToText-WebSockets-Javascript/blob/preview/samples/browser/Sample.html). This will load the page into your default browser (Rendered using [htmlPreview](https://github.com/htmlpreview/htmlpreview.github.com)).
compile the TypeScript sources and bundle/browserfy them into a single JavaScript file ([npm](https://www.npmjs.com/) needs to be installed on your machine). Change into the root of the cloned repository and run the commands:
30
+
10
31
```
32
+
cd SpeechToText-WebSockets-Javascript && npm run bundle
33
+
```
34
+
35
+
Open `samples\browser\Sample.html` in your favorite browser.
36
+
37
+
## Next steps
11
38
12
-
## JavaScript SDK - Sample Usage
39
+
### Installation of npm package
40
+
41
+
An npm package of the Microsoft Speech Javascript Websocket SDK is available. To install the [npm package](https://www.npmjs.com/package/microsoft-speech-browser-sdk) run
42
+
```
43
+
npm install microsoft-speech-browser-sdk
44
+
```
13
45
14
46
### As a Node module
15
47
16
48
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:
17
49
18
50
```javascript
19
-
import*asSDKfrom'microsoft-speech-browser-SDK';
51
+
import*asSDKfrom'microsoft-speech-browser-sdk';
20
52
```
21
53
22
54
<aname="reco_setup"></a>and setup the recognizer:
@@ -98,11 +130,6 @@ function RecognizerStop(SDK, recognizer) {
98
130
}
99
131
```
100
132
101
-
102
-
### In a Browser, as a native ES6 module
103
-
104
-
...in progress, check back a little later.
105
-
106
133
### In a Browser, using Webpack
107
134
108
135
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:
@@ -123,28 +150,14 @@ Currently, the TypeScript code in this SDK is compiled using the default module
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.
128
-
129
-
Here is a handy link to our [Sample](https://htmlpreview.github.io/?https://github.com/Azure-Samples/SpeechToText-WebSockets-Javascript/blob/preview/samples/browser/Sample.html) that you can try out. (Rendered using [htmlPreview](https://github.com/htmlpreview/htmlpreview.github.com))
130
-
131
-
To try the sample locally, please clone this repository:
compile the TypeScript sources and bundle/browserfy them into a single JavaScript file:
155
+
...in progress, will be available soon
137
156
138
-
```
139
-
cd SpeechToText-WebSockets-Javascript && npm run bundle
140
-
```
141
-
142
-
open `samples\browser\Sample.html`in your favorite browser.
157
+
### Token-based authentication
143
158
144
159
To use token-based authentication, please launch a local node server, as described [here](https://github.com/Azure-Samples/SpeechToText-WebSockets-Javascript/blob/master/samples/browser/README.md)
145
160
146
-
**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.
147
-
148
161
## Docs
149
162
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.
0 commit comments