@creativeorange/azure-text-to-speech 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
package/index.html ADDED
@@ -0,0 +1,578 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>Microsoft Cognitive Services Speech SDK JavaScript Sample for Speech Synthesis</title>
5
+ <meta charset="utf-8" />
6
+ <script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.6.0.min.js"></script>
7
+ <style>
8
+ body {
9
+ font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif;
10
+ font-size: 14px;
11
+ }
12
+
13
+ table, th, td {
14
+ border: 1px solid #f1f1f1;
15
+ border-collapse: collapse;
16
+ }
17
+
18
+ th, td {
19
+ padding: 10px;
20
+ }
21
+
22
+ textarea {
23
+ font-family: Arial,sans-serif;
24
+ }
25
+
26
+ .mode {
27
+ font-size: 18px;
28
+ }
29
+
30
+ .highlight{
31
+ background-color: yellow;
32
+ }
33
+
34
+ input:not(disabled) {
35
+ font-weight: bold;
36
+ color: black;
37
+ }
38
+
39
+ button {
40
+ padding: 4px 8px;
41
+ background: #0078d4;
42
+ color: #ffffff;
43
+ }
44
+
45
+ button:disabled {
46
+ padding: 4px 8px;
47
+ background: #ccc;
48
+ color: #666;
49
+ }
50
+
51
+ input[type=radio] {
52
+ position: relative;
53
+ z-index: 1;
54
+ }
55
+
56
+ input[type=radio] + label {
57
+ padding: 8px 4px 8px 30px;
58
+ margin-left: -30px;
59
+ }
60
+
61
+ input[type=radio]:checked + label {
62
+ background: #0078d4;
63
+ color: #ffffff;
64
+ }
65
+ </style>
66
+ </head>
67
+ <body>
68
+ <div id="warning">
69
+ <h1 style="font-weight:500;">Speech Speech SDK not found
70
+ (microsoft.cognitiveservices.speech.sdk.bundle.js missing).</h1>
71
+ </div>
72
+
73
+ <div id="content" style="display:none">
74
+ <table>
75
+ <tr>
76
+ <td></td>
77
+ <td><h1 style="font-weight:500;">Microsoft Cognitive Services Speech SDK JavaScript Sample for Speech Synthesis</h1></td>
78
+ </tr>
79
+ <tr>
80
+ <td align="right">
81
+ <label for="subscriptionKey">
82
+ <a href="https://docs.microsoft.com/azure/cognitive-services/speech-service/get-started"
83
+ rel="noreferrer noopener"
84
+ target="_blank">Subscription Key</a>
85
+ </label>
86
+ </td>
87
+ <td><input id="subscriptionKey" type="text" size="40" placeholder="YourSubscriptionKey"></td>
88
+ </tr>
89
+ <tr>
90
+ <td align="right"><label for="regionOptions">Region</label></td>
91
+ <td>
92
+ <!-- see https://aka.ms/csspeech/region for more details-->
93
+ <select id="regionOptions">
94
+ <option value="westus" selected="selected">West US</option>
95
+ <option value="westus2">West US2</option>
96
+ <option value="eastus">East US</option>
97
+ <option value="eastus2">East US2</option>
98
+ <option value="centralus">Central US</option>
99
+ <option value="northcentralus">North Central US</option>
100
+ <option value="southcentralus">South Central US</option>
101
+ <option value="westcentralus">West Central US</option>
102
+ <option value="canadacentral">Canada Central</option>
103
+ <option value="brazilsouth">Brazil South</option>
104
+ <option value="eastasia">East Asia</option>
105
+ <option value="southeastasia">South East Asia</option>
106
+ <option value="australiaeast">Australia East</option>
107
+ <option value="centralindia">Central India</option>
108
+ <option value="japaneast">Japan East</option>
109
+ <option value="japanwest">Japan West</option>
110
+ <option value="koreacentral">Korea Central</option>
111
+ <option value="northeurope">North Europe</option>
112
+ <option value="westeurope">West Europe</option>
113
+ <option value="francecentral">France Central</option>
114
+ <option value="switzerlandnorth">Switzerland North</option>
115
+ <option value="uksouth">UK South</option>
116
+ <option value="chinaeast2">China East2 (azure.cn)</option>
117
+ <option value="chinanorth2">China North2 (azure.cn)</option>
118
+ </select>
119
+ </td>
120
+ </tr>
121
+ <tr>
122
+ <td align="right"><label for="voiceOptions">Voice</label></td>
123
+ <td>
124
+ <button id="updateVoiceListButton">Update Voice List</button>
125
+ <select id="voiceOptions" disabled>
126
+ <option>Please update voice list first.</option>
127
+ </select>
128
+ </td>
129
+ </tr>
130
+ <tr>
131
+ <td align="right"><label for="formatOptions">Format</label></td>
132
+ <td>
133
+ <select id="formatOptions">
134
+ <option>Waiting for SDK loading.</option>
135
+ </select>
136
+ (riff pcm, mp3, ogg and webm formats are supported for playback.)
137
+ </td>
138
+ </tr>
139
+ <tr>
140
+ <td align="right"><label for="isSSML">Is SSML</label><br></td>
141
+ <td>
142
+ <input type="checkbox" id="isSSML" name="isSSML" value="ssml">
143
+ </td>
144
+ </tr>
145
+ <tr>
146
+ <td align="right"><label for="synthesisText">Text</label></td>
147
+ <td>
148
+ <textarea id="synthesisText" style="display: inline-block;width:500px;height:100px"
149
+ placeholder="Input text or ssml for synthesis."></textarea>
150
+ </td>
151
+ </tr>
152
+ <tr>
153
+ <td></td>
154
+ <td>
155
+ <button id="startSynthesisAsyncButton">Start synthesis</button>
156
+ <button id="pauseButton">Pause</button>
157
+ <button id="resumeButton">Resume</button>
158
+ <button id="downloadButton">Download</button>
159
+ </td>
160
+ </tr>
161
+ <tr>
162
+ <td align="right" valign="top"><label for="resultsDiv">Results</label></td>
163
+ <td><textarea id="resultsDiv" readonly style="display: inline-block;width:500px;height:50px"></textarea></td>
164
+ </tr>
165
+ <tr>
166
+ <td align="right" valign="top"><label for="talkingHeadDiv">
167
+ <a href="https://docs.microsoft.com/azure/cognitive-services/speech-service/how-to-speech-synthesis-viseme?pivots=programming-language-javascript"
168
+ rel="noreferrer noopener"
169
+ target="_blank">Talking Head</a></label></td>
170
+ <td><div id="talkingHeadDiv" style="display: inline-block;width:800px;"></div></td>
171
+ </tr>
172
+ <tr>
173
+ <td align="right" valign="top"><label for="eventsDiv">Events</label></td>
174
+ <td><textarea id="eventsDiv" readonly style="display: inline-block;width:500px;height:200px"></textarea></td>
175
+ </tr>
176
+ <tr>
177
+ <td align="right" valign="top"><label for="highlightDiv">Highlight</label></td>
178
+ <td><div id="highlightDiv" style="display: inline-block;width:800px;"></div></td>
179
+ </tr>
180
+ </table>
181
+ </div>
182
+
183
+ <!-- Speech SDK reference sdk. -->
184
+ <script src="https://aka.ms/csspeech/jsbrowserpackageraw"></script>
185
+
186
+ <!-- Speech SDK Authorization token -->
187
+ <script>
188
+ // Note: Replace the URL with a valid endpoint to retrieve
189
+ // authorization tokens for your subscription.
190
+ var authorizationEndpoint = "token.php";
191
+
192
+ function RequestAuthorizationToken() {
193
+ if (authorizationEndpoint) {
194
+ var a = new XMLHttpRequest();
195
+ a.open("GET", authorizationEndpoint);
196
+ a.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
197
+ a.send("");
198
+ a.onload = function() {
199
+ var token = JSON.parse(atob(this.responseText.split(".")[1]));
200
+ regionOptions.value = token.region;
201
+ authorizationToken = this.responseText;
202
+ subscriptionKey.disabled = true;
203
+ subscriptionKey.value = "using authorization token (hit F5 to refresh)";
204
+ console.log("Got an authorization token: " + token);
205
+ }
206
+ }
207
+ }
208
+ </script>
209
+
210
+ <!-- Speech SDK USAGE -->
211
+ <script>
212
+ // On document load resolve the Speech SDK dependency
213
+ function Initialize(onComplete) {
214
+ if (!!window.SpeechSDK) {
215
+ document.getElementById('content').style.display = 'block';
216
+ document.getElementById('warning').style.display = 'none';
217
+ onComplete(window.SpeechSDK);
218
+ }
219
+ }
220
+ </script>
221
+
222
+ <!-- Browser Hooks -->
223
+ <script>
224
+ // status fields and start button in UI
225
+ var resultsDiv,
226
+ eventsDiv,
227
+ talkingHeadDiv,
228
+ highlightDiv;
229
+ var startSynthesisAsyncButton, pauseButton, resumeButton, downloadButton;
230
+ var updateVoiceListButton;
231
+
232
+ // subscription key and region for speech services.
233
+ var subscriptionKey, regionOptions;
234
+ var authorizationToken;
235
+ var voiceOptions, isSsml;
236
+ var SpeechSDK;
237
+ var synthesisText;
238
+ var synthesizer;
239
+ var player;
240
+ var wordBoundaryList = [];
241
+
242
+ function getExtensionFromFormat(format) {
243
+ format = format.toLowerCase();
244
+ if (format.includes('mp3')) {
245
+ return 'mp3';
246
+ } else if (format.includes('ogg')) {
247
+ return 'ogg';
248
+ } else if (format.includes('webm')) {
249
+ return 'webm';
250
+ } else if (format.includes('ogg')) {
251
+ return 'ogg';
252
+ } else if (format.includes('silk')) {
253
+ return 'silk';
254
+ } else if (format.includes('riff')) {
255
+ return 'wav';
256
+ } else {
257
+ return 'pcm';
258
+ }
259
+ }
260
+
261
+ document.addEventListener("DOMContentLoaded", function () {
262
+ startSynthesisAsyncButton = document.getElementById("startSynthesisAsyncButton");
263
+ updateVoiceListButton = document.getElementById("updateVoiceListButton");
264
+ pauseButton = document.getElementById("pauseButton");
265
+ resumeButton = document.getElementById("resumeButton");
266
+ downloadButton = document.getElementById("downloadButton");
267
+ subscriptionKey = document.getElementById("subscriptionKey");
268
+ regionOptions = document.getElementById("regionOptions");
269
+ resultsDiv = document.getElementById("resultsDiv");
270
+ eventsDiv = document.getElementById("eventsDiv");
271
+ voiceOptions = document.getElementById("voiceOptions");
272
+ isSsml = document.getElementById("isSSML");
273
+ talkingHeadDiv = document.getElementById("talkingHeadDiv");
274
+ highlightDiv = document.getElementById("highlightDiv");
275
+
276
+ setInterval(function () {
277
+ if (player !== undefined) {
278
+ const currentTime = player.currentTime;
279
+ var wordBoundary;
280
+ for (const e of wordBoundaryList) {
281
+ if (currentTime * 1000 > e.audioOffset / 10000) {
282
+ wordBoundary = e;
283
+ } else {
284
+ break;
285
+ }
286
+ }
287
+ if (wordBoundary !== undefined) {
288
+ highlightDiv.innerHTML = synthesisText.value.substr(0, wordBoundary.textOffset) +
289
+ "<span class='highlight'>" + wordBoundary.text + "</span>" +
290
+ synthesisText.value.substr(wordBoundary.textOffset + wordBoundary.wordLength);
291
+ } else {
292
+ highlightDiv.innerHTML = synthesisText.value;
293
+ }
294
+ }
295
+ }, 50);
296
+
297
+ updateVoiceListButton.addEventListener("click", function () {
298
+ var request = new XMLHttpRequest();
299
+ request.open('GET',
300
+ 'https://' + regionOptions.value + ".tts.speech." +
301
+ (regionOptions.value.startsWith("china") ? "azure.cn" : "microsoft.com") +
302
+ "/cognitiveservices/voices/list", true);
303
+ if (authorizationToken) {
304
+ request.setRequestHeader("Authorization", "Bearer " + authorizationToken);
305
+ } else {
306
+ if (subscriptionKey.value === "" || subscriptionKey.value === "subscription") {
307
+ alert("Please enter your Microsoft Cognitive Services Speech subscription key!");
308
+ return;
309
+ }
310
+ request.setRequestHeader("Ocp-Apim-Subscription-Key", subscriptionKey.value);
311
+ }
312
+
313
+ request.onload = function() {
314
+ if (request.status >= 200 && request.status < 400) {
315
+ const response = this.response;
316
+ const defaultVoice = "JennyNeural";
317
+ let selectId;
318
+ const data = JSON.parse(response);
319
+ voiceOptions.innerHTML = "";
320
+ data.forEach((voice, index) => {
321
+ voiceOptions.innerHTML += "<option value=\"" + voice.Name + "\">" + voice.Name + "</option>";
322
+ if (voice.Name.indexOf(defaultVoice) > 0) {
323
+ selectId = index;
324
+ }
325
+ });
326
+ voiceOptions.selectedIndex = selectId;
327
+ voiceOptions.disabled = false;
328
+ } else {
329
+ window.console.log(this);
330
+ eventsDiv.innerHTML += "cannot get voice list, code: " + this.status + " detail: " + this.statusText + "\r\n";
331
+ }
332
+ };
333
+
334
+ request.send()
335
+ });
336
+
337
+ pauseButton.addEventListener("click", function () {
338
+ player.pause();
339
+ pauseButton.disabled = true;
340
+ resumeButton.disabled = false;
341
+ });
342
+
343
+ resumeButton.addEventListener("click", function () {
344
+ player.resume();
345
+ pauseButton.disabled = false;
346
+ resumeButton.disabled = true;
347
+ });
348
+
349
+ startSynthesisAsyncButton.addEventListener("click", function () {
350
+ resultsDiv.innerHTML = "";
351
+ eventsDiv.innerHTML = "";
352
+ wordBoundaryList = [];
353
+ synthesisText = document.getElementById("synthesisText");
354
+
355
+ // if we got an authorization token, use the token. Otherwise use the provided subscription key
356
+ var speechConfig;
357
+ if (authorizationToken) {
358
+ speechConfig = SpeechSDK.SpeechConfig.fromAuthorizationToken(authorizationToken, regionOptions.value);
359
+ } else {
360
+ if (subscriptionKey.value === "" || subscriptionKey.value === "subscription") {
361
+ alert("Please enter your Microsoft Cognitive Services Speech subscription key!");
362
+ return;
363
+ }
364
+ speechConfig = SpeechSDK.SpeechConfig.fromSubscription(subscriptionKey.value, regionOptions.value);
365
+ }
366
+
367
+ speechConfig.speechSynthesisVoiceName = voiceOptions.value;
368
+ speechConfig.speechSynthesisOutputFormat = formatOptions.value;
369
+
370
+ player = new SpeechSDK.SpeakerAudioDestination();
371
+ player.onAudioStart = function(_) {
372
+ window.console.log("playback started");
373
+ setTimeout(function(){ $("svg path :first-child").each( function(i) {this.beginElement();}); }, 0.5);
374
+ }
375
+ player.onAudioEnd = function (_) {
376
+ window.console.log("playback finished");
377
+ eventsDiv.innerHTML += "playback finished" + "\r\n";
378
+ startSynthesisAsyncButton.disabled = false;
379
+ downloadButton.disabled = false;
380
+ pauseButton.disabled = true;
381
+ resumeButton.disabled = true;
382
+ wordBoundaryList = [];
383
+ };
384
+
385
+ var audioConfig = SpeechSDK.AudioConfig.fromSpeakerOutput(player);
386
+
387
+ synthesizer = new SpeechSDK.SpeechSynthesizer(speechConfig, audioConfig);
388
+
389
+ // The event synthesizing signals that a synthesized audio chunk is received.
390
+ // You will receive one or more synthesizing events as a speech phrase is synthesized.
391
+ // You can use this callback to streaming receive the synthesized audio.
392
+ synthesizer.synthesizing = function (s, e) {
393
+ window.console.log(e);
394
+ eventsDiv.innerHTML += "(synthesizing) Reason: " + SpeechSDK.ResultReason[e.result.reason] +
395
+ "Audio chunk length: " + e.result.audioData.byteLength + "\r\n";
396
+ };
397
+
398
+ // The synthesis started event signals that the synthesis is started.
399
+ synthesizer.synthesisStarted = function (s, e) {
400
+ window.console.log(e);
401
+ eventsDiv.innerHTML += "(synthesis started)" + "\r\n";
402
+ pauseButton.disabled = false;
403
+ };
404
+
405
+ // The event synthesis completed signals that the synthesis is completed.
406
+ synthesizer.synthesisCompleted = function (s, e) {
407
+ console.log(e);
408
+ eventsDiv.innerHTML += "(synthesized) Reason: " + SpeechSDK.ResultReason[e.result.reason] +
409
+ " Audio length: " + e.result.audioData.byteLength + "\r\n";
410
+ };
411
+
412
+ // The event signals that the service has stopped processing speech.
413
+ // This can happen when an error is encountered.
414
+ synthesizer.SynthesisCanceled = function (s, e) {
415
+ const cancellationDetails = SpeechSDK.CancellationDetails.fromResult(e.result);
416
+ let str = "(cancel) Reason: " + SpeechSDK.CancellationReason[cancellationDetails.reason];
417
+ if (cancellationDetails.reason === SpeechSDK.CancellationReason.Error) {
418
+ str += ": " + e.result.errorDetails;
419
+ }
420
+ window.console.log(e);
421
+ eventsDiv.innerHTML += str + "\r\n";
422
+ startSynthesisAsyncButton.disabled = false;
423
+ downloadButton.disabled = false;
424
+ pauseButton.disabled = true;
425
+ resumeButton.disabled = true;
426
+ };
427
+
428
+ // This event signals that word boundary is received. This indicates the audio boundary of each word.
429
+ // The unit of e.audioOffset is tick (1 tick = 100 nanoseconds), divide by 10,000 to convert to milliseconds.
430
+ synthesizer.wordBoundary = function (s, e) {
431
+ window.console.log(e);
432
+ eventsDiv.innerHTML += "(WordBoundary), Text: " + e.text + ", Audio offset: " + e.audioOffset / 10000 + "ms." + "\r\n";
433
+ wordBoundaryList.push(e);
434
+ };
435
+
436
+ synthesizer.visemeReceived = function (s, e) {
437
+ window.console.log(e);
438
+ eventsDiv.innerHTML += "(Viseme), Audio offset: " + e.audioOffset / 10000 + "ms. Viseme ID: " + e.visemeId + '\n';
439
+ talkingHeadDiv.innerHTML = e.animation.replaceAll("begin=\"0.5s\"", "begin=\"indefinite\"");
440
+ $("svg").width('500px').height('500px');
441
+ }
442
+
443
+ synthesizer.bookmarkReached = function (s, e) {
444
+ window.console.log(e);
445
+ eventsDiv.innerHTML += "(Bookmark reached), Audio offset: " + e.audioOffset / 10000 + "ms. Bookmark text: " + e.text + '\n';
446
+ }
447
+
448
+ const complete_cb = function (result) {
449
+ if (result.reason === SpeechSDK.ResultReason.SynthesizingAudioCompleted) {
450
+ resultsDiv.innerHTML += "synthesis finished";
451
+ } else if (result.reason === SpeechSDK.ResultReason.Canceled) {
452
+ resultsDiv.innerHTML += "synthesis failed. Error detail: " + result.errorDetails;
453
+ }
454
+ window.console.log(result);
455
+ synthesizer.close();
456
+ synthesizer = undefined;
457
+ };
458
+ const err_cb = function (err) {
459
+ startSynthesisAsyncButton.disabled = false;
460
+ downloadButton.disabled = false;
461
+ phraseDiv.innerHTML += err;
462
+ window.console.log(err);
463
+ synthesizer.close();
464
+ synthesizer = undefined;
465
+ };
466
+
467
+ if (!synthesisText.value) {
468
+ alert("Please enter synthesis content.");
469
+ return;
470
+ }
471
+
472
+ startSynthesisAsyncButton.disabled = true;
473
+ downloadButton.disabled = true;
474
+
475
+ if (isSsml.checked) {
476
+ synthesizer.speakSsmlAsync(synthesisText.value,
477
+ complete_cb,
478
+ err_cb);
479
+ } else {
480
+ synthesizer.speakTextAsync(synthesisText.value,
481
+ complete_cb,
482
+ err_cb);
483
+ }
484
+ });
485
+
486
+ downloadButton.addEventListener("click", function () {
487
+ resultsDiv.innerHTML = "";
488
+ eventsDiv.innerHTML = "";
489
+ synthesisText = document.getElementById("synthesisText");
490
+
491
+ var speechConfig;
492
+
493
+ // if we got an authorization token, use the token. Otherwise use the provided subscription key
494
+ if (authorizationToken) {
495
+ speechConfig = SpeechSDK.SpeechConfig.fromAuthorizationToken(authorizationToken, regionOptions.value);
496
+ } else {
497
+ if (subscriptionKey.value === "" || subscriptionKey.value === "subscription") {
498
+ alert("Please enter your Microsoft Cognitive Services Speech subscription key!");
499
+ return;
500
+ }
501
+ speechConfig = SpeechSDK.SpeechConfig.fromSubscription(subscriptionKey.value, regionOptions.value);
502
+ }
503
+
504
+ speechConfig.speechSynthesisVoiceName = voiceOptions.value;
505
+ speechConfig.speechSynthesisOutputFormat = formatOptions.value;
506
+
507
+ synthesizer = new SpeechSDK.SpeechSynthesizer(speechConfig, null);
508
+
509
+ synthesizer.SynthesisCanceled = function (s, e) {
510
+ const cancellationDetails = SpeechSDK.CancellationDetails.fromResult(e.result);
511
+ let str = "(cancel) Reason: " + SpeechSDK.CancellationReason[cancellationDetails.reason];
512
+ if (cancellationDetails.reason === SpeechSDK.CancellationReason.Error) {
513
+ str += ": " + e.result.errorDetails;
514
+ }
515
+ window.console.log(e);
516
+ eventsDiv.innerHTML += str + "\r\n";
517
+ resultsDiv.innerHTML = str;
518
+ startSynthesisAsyncButton.disabled = false;
519
+ downloadButton.disabled = false;
520
+ pauseButton.disabled = true;
521
+ resumeButton.disabled = true;
522
+ };
523
+
524
+ synthesizer.synthesisCompleted = function (s, e) {
525
+ resultsDiv.innerHTML = "synthesis finished";
526
+ synthesizer.close();
527
+ a = document.createElement('a');
528
+ url = window.URL.createObjectURL(new Blob([e.result.audioData]));
529
+ a.href = url;
530
+ a.download = 'synth.' + getExtensionFromFormat(formatOptions.options[formatOptions.selectedIndex].text);
531
+ document.body.appendChild(a);
532
+ a.click();
533
+ setTimeout(function () {
534
+ document.body.removeChild(a);
535
+ window.URL.revokeObjectURL(url);
536
+ }, 0);
537
+ startSynthesisAsyncButton.disabled = false;
538
+ downloadButton.disabled = false;
539
+ };
540
+
541
+ if (!synthesisText.value) {
542
+ alert("Please enter synthesis content.");
543
+ }
544
+
545
+ startSynthesisAsyncButton.disabled = true;
546
+ downloadButton.disabled = true;
547
+
548
+ if (isSsml.checked) {
549
+ synthesizer.speakSsmlAsync(synthesisText.value);
550
+ } else {
551
+ synthesizer.speakTextAsync(synthesisText.value);
552
+ }
553
+ });
554
+
555
+ Initialize(function (speechSdk) {
556
+ SpeechSDK = speechSdk;
557
+ startSynthesisAsyncButton.disabled = false;
558
+ downloadButton.disabled = false;
559
+ pauseButton.disabled = true;
560
+ resumeButton.disabled = true;
561
+
562
+ formatOptions.innerHTML = "";
563
+ Object.keys(SpeechSDK.SpeechSynthesisOutputFormat).forEach(format => {
564
+ if (isNaN(format) && !format.includes('Siren')) {
565
+ formatOptions.innerHTML += "<option value=\"" + SpeechSDK.SpeechSynthesisOutputFormat[format] + "\">" + format + "</option>"
566
+ }}
567
+ );
568
+ formatOptions.selectedIndex = SpeechSDK.SpeechSynthesisOutputFormat.Audio24Khz48KBitRateMonoMp3;
569
+
570
+ // in case we have a function for getting an authorization token, call it.
571
+ if (typeof RequestAuthorizationToken === "function") {
572
+ RequestAuthorizationToken();
573
+ }
574
+ });
575
+ });
576
+ </script>
577
+ </body>
578
+ </html>
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@creativeorange/azure-text-to-speech",
3
+ "version": "1.0.0",
4
+ "main": "dist/co-azure-tts.umd.js",
5
+ "browser": "dist/co-azure-tts.es.js",
6
+ "scripts": {
7
+ "serve-vite": "vite",
8
+ "build-vite": "vite build --watch",
9
+ "preview-vite": "vite preview"
10
+ },
11
+ "license": "MIT",
12
+ "author": "Edsardio",
13
+ "devDependencies": {
14
+ "build-esm": "^4.2.2",
15
+ "microsoft-cognitiveservices-speech-sdk": "^1.22.0",
16
+ "typescript": "^4.7.4",
17
+ "vite-plugin-env-compatible": "^1.1.1",
18
+ "vite": "^2.7.2",
19
+ "@originjs/vite-plugin-commonjs": "^1.0.1"
20
+ }
21
+ }