web-speech-cognitive-services 7.1.4-master.9e026d9 → 8.0.0-main.428d2a8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/web-speech-cognitive-services.d.mts +186 -0
  2. package/dist/web-speech-cognitive-services.d.ts +186 -0
  3. package/dist/web-speech-cognitive-services.development.js +25608 -0
  4. package/dist/web-speech-cognitive-services.development.js.map +1 -0
  5. package/dist/web-speech-cognitive-services.js +1271 -0
  6. package/dist/web-speech-cognitive-services.js.map +1 -0
  7. package/dist/web-speech-cognitive-services.mjs +1236 -0
  8. package/dist/web-speech-cognitive-services.mjs.map +1 -0
  9. package/dist/web-speech-cognitive-services.production.min.js +31 -0
  10. package/dist/web-speech-cognitive-services.production.min.js.map +1 -0
  11. package/package.json +67 -47
  12. package/CHANGELOG.md +0 -372
  13. package/lib/BingSpeech/SpeechToText/SpeechGrammarList.js +0 -94
  14. package/lib/BingSpeech/SpeechToText/SpeechGrammarList.js.map +0 -1
  15. package/lib/BingSpeech/SpeechToText/createSpeechRecognitionPonyfill.js +0 -483
  16. package/lib/BingSpeech/SpeechToText/createSpeechRecognitionPonyfill.js.map +0 -1
  17. package/lib/BingSpeech/SpeechToText.js +0 -14
  18. package/lib/BingSpeech/SpeechToText.js.map +0 -1
  19. package/lib/BingSpeech/TextToSpeech/AudioContextConsumer.js +0 -122
  20. package/lib/BingSpeech/TextToSpeech/AudioContextConsumer.js.map +0 -1
  21. package/lib/BingSpeech/TextToSpeech/AudioContextQueue.js +0 -104
  22. package/lib/BingSpeech/TextToSpeech/AudioContextQueue.js.map +0 -1
  23. package/lib/BingSpeech/TextToSpeech/SpeechSynthesisUtterance.js +0 -264
  24. package/lib/BingSpeech/TextToSpeech/SpeechSynthesisUtterance.js.map +0 -1
  25. package/lib/BingSpeech/TextToSpeech/SpeechSynthesisVoice.js +0 -61
  26. package/lib/BingSpeech/TextToSpeech/SpeechSynthesisVoice.js.map +0 -1
  27. package/lib/BingSpeech/TextToSpeech/buildSSML.js +0 -32
  28. package/lib/BingSpeech/TextToSpeech/buildSSML.js.map +0 -1
  29. package/lib/BingSpeech/TextToSpeech/createSpeechSynthesisPonyfill.js +0 -220
  30. package/lib/BingSpeech/TextToSpeech/createSpeechSynthesisPonyfill.js.map +0 -1
  31. package/lib/BingSpeech/TextToSpeech/fetchSpeechData.js +0 -74
  32. package/lib/BingSpeech/TextToSpeech/fetchSpeechData.js.map +0 -1
  33. package/lib/BingSpeech/TextToSpeech/fetchVoices.js +0 -335
  34. package/lib/BingSpeech/TextToSpeech/fetchVoices.js.map +0 -1
  35. package/lib/BingSpeech/TextToSpeech/isSSML.js +0 -13
  36. package/lib/BingSpeech/TextToSpeech/isSSML.js.map +0 -1
  37. package/lib/BingSpeech/TextToSpeech/subscribeEvent.js +0 -14
  38. package/lib/BingSpeech/TextToSpeech/subscribeEvent.js.map +0 -1
  39. package/lib/BingSpeech/TextToSpeech.js +0 -14
  40. package/lib/BingSpeech/TextToSpeech.js.map +0 -1
  41. package/lib/BingSpeech/Util/DOMEventEmitter.js +0 -61
  42. package/lib/BingSpeech/Util/DOMEventEmitter.js.map +0 -1
  43. package/lib/BingSpeech/Util/createFetchTokenUsingSubscriptionKey.js +0 -41
  44. package/lib/BingSpeech/Util/createFetchTokenUsingSubscriptionKey.js.map +0 -1
  45. package/lib/BingSpeech/fetchAuthorizationToken.js +0 -57
  46. package/lib/BingSpeech/fetchAuthorizationToken.js.map +0 -1
  47. package/lib/BingSpeech/index.js +0 -84
  48. package/lib/BingSpeech/index.js.map +0 -1
  49. package/lib/SpeechServices/SpeechSDK.js +0 -19
  50. package/lib/SpeechServices/SpeechSDK.js.map +0 -1
  51. package/lib/SpeechServices/SpeechToText/SpeechGrammarList.js +0 -45
  52. package/lib/SpeechServices/SpeechToText/SpeechGrammarList.js.map +0 -1
  53. package/lib/SpeechServices/SpeechToText/cognitiveServiceEventResultToWebSpeechRecognitionResultList.js +0 -56
  54. package/lib/SpeechServices/SpeechToText/cognitiveServiceEventResultToWebSpeechRecognitionResultList.js.map +0 -1
  55. package/lib/SpeechServices/SpeechToText/createSpeechRecognitionPonyfill.js +0 -984
  56. package/lib/SpeechServices/SpeechToText/createSpeechRecognitionPonyfill.js.map +0 -1
  57. package/lib/SpeechServices/SpeechToText.js +0 -24
  58. package/lib/SpeechServices/SpeechToText.js.map +0 -1
  59. package/lib/SpeechServices/TextToSpeech/AudioContextConsumer.js +0 -92
  60. package/lib/SpeechServices/TextToSpeech/AudioContextConsumer.js.map +0 -1
  61. package/lib/SpeechServices/TextToSpeech/AudioContextQueue.js +0 -111
  62. package/lib/SpeechServices/TextToSpeech/AudioContextQueue.js.map +0 -1
  63. package/lib/SpeechServices/TextToSpeech/SpeechSynthesisEvent.js +0 -40
  64. package/lib/SpeechServices/TextToSpeech/SpeechSynthesisEvent.js.map +0 -1
  65. package/lib/SpeechServices/TextToSpeech/SpeechSynthesisUtterance.js +0 -283
  66. package/lib/SpeechServices/TextToSpeech/SpeechSynthesisUtterance.js.map +0 -1
  67. package/lib/SpeechServices/TextToSpeech/SpeechSynthesisVoice.js +0 -63
  68. package/lib/SpeechServices/TextToSpeech/SpeechSynthesisVoice.js.map +0 -1
  69. package/lib/SpeechServices/TextToSpeech/buildSSML.js +0 -32
  70. package/lib/SpeechServices/TextToSpeech/buildSSML.js.map +0 -1
  71. package/lib/SpeechServices/TextToSpeech/createSpeechSynthesisPonyfill.js +0 -282
  72. package/lib/SpeechServices/TextToSpeech/createSpeechSynthesisPonyfill.js.map +0 -1
  73. package/lib/SpeechServices/TextToSpeech/fetchCustomVoices.js +0 -110
  74. package/lib/SpeechServices/TextToSpeech/fetchCustomVoices.js.map +0 -1
  75. package/lib/SpeechServices/TextToSpeech/fetchSpeechData.js +0 -127
  76. package/lib/SpeechServices/TextToSpeech/fetchSpeechData.js.map +0 -1
  77. package/lib/SpeechServices/TextToSpeech/fetchVoices.js +0 -87
  78. package/lib/SpeechServices/TextToSpeech/fetchVoices.js.map +0 -1
  79. package/lib/SpeechServices/TextToSpeech/isSSML.js +0 -13
  80. package/lib/SpeechServices/TextToSpeech/isSSML.js.map +0 -1
  81. package/lib/SpeechServices/TextToSpeech/subscribeEvent.js +0 -14
  82. package/lib/SpeechServices/TextToSpeech/subscribeEvent.js.map +0 -1
  83. package/lib/SpeechServices/TextToSpeech.js +0 -14
  84. package/lib/SpeechServices/TextToSpeech.js.map +0 -1
  85. package/lib/SpeechServices/fetchAuthorizationToken.js +0 -58
  86. package/lib/SpeechServices/fetchAuthorizationToken.js.map +0 -1
  87. package/lib/SpeechServices/patchOptions.js +0 -213
  88. package/lib/SpeechServices/patchOptions.js.map +0 -1
  89. package/lib/SpeechServices/resolveFunctionOrReturnValue.js +0 -11
  90. package/lib/SpeechServices/resolveFunctionOrReturnValue.js.map +0 -1
  91. package/lib/SpeechServices.js +0 -73
  92. package/lib/SpeechServices.js.map +0 -1
  93. package/lib/Util/arrayToMap.js +0 -28
  94. package/lib/Util/arrayToMap.js.map +0 -1
  95. package/lib/Util/createPromiseQueue.js +0 -40
  96. package/lib/Util/createPromiseQueue.js.map +0 -1
  97. package/lib/index.js +0 -14
  98. package/lib/index.js.map +0 -1
  99. package/umd/web-speech-cognitive-services.development.js +0 -4740
  100. package/umd/web-speech-cognitive-services.production.min.js +0 -2
@@ -1,122 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
-
14
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
-
16
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
-
18
- var _default = /*#__PURE__*/function () {
19
- function _default() {
20
- (0, _classCallCheck2.default)(this, _default);
21
- }
22
-
23
- (0, _createClass2.default)(_default, [{
24
- key: "pause",
25
- value: function pause() {
26
- this.audioContext && this.audioContext.suspend();
27
- this.playingUtterance && this.playingUtterance.emit('pause');
28
- }
29
- }, {
30
- key: "resume",
31
- value: function resume() {
32
- this.audioContext && this.audioContext.resume();
33
- this.playingUtterance && this.playingUtterance.emit('resume');
34
- }
35
- }, {
36
- key: "start",
37
- value: function () {
38
- var _start = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(queue, _ref) {
39
- var AudioContext, utterance;
40
- return _regenerator.default.wrap(function _callee$(_context) {
41
- while (1) {
42
- switch (_context.prev = _context.next) {
43
- case 0:
44
- AudioContext = _ref.AudioContext;
45
-
46
- if (!this.audioContext) {
47
- _context.next = 3;
48
- break;
49
- }
50
-
51
- throw new Error('already started');
52
-
53
- case 3:
54
- _context.prev = 3;
55
-
56
- case 4:
57
- if (!(utterance = queue.shift())) {
58
- _context.next = 11;
59
- break;
60
- }
61
-
62
- this.playingUtterance = utterance;
63
- _context.next = 8;
64
- return utterance.play(this.audioContext || (this.audioContext = new AudioContext()));
65
-
66
- case 8:
67
- this.playingUtterance = null;
68
- _context.next = 4;
69
- break;
70
-
71
- case 11:
72
- _context.prev = 11;
73
- _context.next = 14;
74
- return this.audioContext;
75
-
76
- case 14:
77
- _context.t0 = _context.sent;
78
-
79
- if (!_context.t0) {
80
- _context.next = 17;
81
- break;
82
- }
83
-
84
- this.audioContext.close();
85
-
86
- case 17:
87
- return _context.finish(11);
88
-
89
- case 18:
90
- case "end":
91
- return _context.stop();
92
- }
93
- }
94
- }, _callee, this, [[3,, 11, 18]]);
95
- }));
96
-
97
- function start(_x, _x2) {
98
- return _start.apply(this, arguments);
99
- }
100
-
101
- return start;
102
- }()
103
- }, {
104
- key: "stop",
105
- value: function stop() {
106
- this.playingUtterance && this.playingUtterance.stop();
107
-
108
- if (this.audioContext) {
109
- // Play -> Pause -> Cancel (stop)
110
- // This would generate these events: "start", "pause", "end"
111
- // Without this code, the "end" event will not emit until resume() is called
112
- // Cancelling an unstarted utterance will not emit any "start" or "end" event
113
- this.audioContext.close();
114
- this.audioContext = null;
115
- }
116
- }
117
- }]);
118
- return _default;
119
- }();
120
-
121
- exports.default = _default;
122
- //# sourceMappingURL=AudioContextConsumer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AudioContextConsumer.js","names":["audioContext","suspend","playingUtterance","emit","resume","queue","AudioContext","Error","utterance","shift","play","close","stop"],"sources":["../../../src/BingSpeech/TextToSpeech/AudioContextConsumer.js"],"sourcesContent":["export default class {\n pause() {\n this.audioContext && this.audioContext.suspend();\n this.playingUtterance && this.playingUtterance.emit('pause');\n }\n\n resume() {\n this.audioContext && this.audioContext.resume();\n this.playingUtterance && this.playingUtterance.emit('resume');\n }\n\n async start(queue, { AudioContext }) {\n if (this.audioContext) {\n throw new Error('already started');\n }\n\n let utterance;\n\n try {\n while ((utterance = queue.shift())) {\n this.playingUtterance = utterance;\n\n await utterance.play(this.audioContext || (this.audioContext = new AudioContext()));\n\n this.playingUtterance = null;\n }\n } finally {\n await this.audioContext && this.audioContext.close();\n }\n }\n\n stop() {\n this.playingUtterance && this.playingUtterance.stop();\n\n if (this.audioContext) {\n // Play -> Pause -> Cancel (stop)\n // This would generate these events: \"start\", \"pause\", \"end\"\n\n // Without this code, the \"end\" event will not emit until resume() is called\n // Cancelling an unstarted utterance will not emit any \"start\" or \"end\" event\n this.audioContext.close();\n this.audioContext = null;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;WACE,iBAAQ;MACN,KAAKA,YAAL,IAAqB,KAAKA,YAAL,CAAkBC,OAAlB,EAArB;MACA,KAAKC,gBAAL,IAAyB,KAAKA,gBAAL,CAAsBC,IAAtB,CAA2B,OAA3B,CAAzB;IACD;;;WAED,kBAAS;MACP,KAAKH,YAAL,IAAqB,KAAKA,YAAL,CAAkBI,MAAlB,EAArB;MACA,KAAKF,gBAAL,IAAyB,KAAKA,gBAAL,CAAsBC,IAAtB,CAA2B,QAA3B,CAAzB;IACD;;;;2FAED,iBAAYE,KAAZ;QAAA;QAAA;UAAA;YAAA;cAAA;gBAAqBC,YAArB,QAAqBA,YAArB;;gBAAA,KACM,KAAKN,YADX;kBAAA;kBAAA;gBAAA;;gBAAA,MAEU,IAAIO,KAAJ,CAAU,iBAAV,CAFV;;cAAA;gBAAA;;cAAA;gBAAA,MAQYC,SAAS,GAAGH,KAAK,CAACI,KAAN,EARxB;kBAAA;kBAAA;gBAAA;;gBASM,KAAKP,gBAAL,GAAwBM,SAAxB;gBATN;gBAAA,OAWYA,SAAS,CAACE,IAAV,CAAe,KAAKV,YAAL,KAAsB,KAAKA,YAAL,GAAoB,IAAIM,YAAJ,EAA1C,CAAf,CAXZ;;cAAA;gBAaM,KAAKJ,gBAAL,GAAwB,IAAxB;gBAbN;gBAAA;;cAAA;gBAAA;gBAAA;gBAAA,OAgBU,KAAKF,YAhBf;;cAAA;gBAAA;;gBAAA;kBAAA;kBAAA;gBAAA;;gBAgB+B,KAAKA,YAAL,CAAkBW,KAAlB,EAhB/B;;cAAA;gBAAA;;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;WAoBA,gBAAO;MACL,KAAKT,gBAAL,IAAyB,KAAKA,gBAAL,CAAsBU,IAAtB,EAAzB;;MAEA,IAAI,KAAKZ,YAAT,EAAuB;QACrB;QACA;QAEA;QACA;QACA,KAAKA,YAAL,CAAkBW,KAAlB;QACA,KAAKX,YAAL,GAAoB,IAApB;MACD;IACF"}
@@ -1,104 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
-
14
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
-
16
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
-
18
- var _AudioContextConsumer = _interopRequireDefault(require("./AudioContextConsumer"));
19
-
20
- var _default = /*#__PURE__*/function () {
21
- function _default(ponyfill) {
22
- (0, _classCallCheck2.default)(this, _default);
23
- this.consumer = null;
24
- this.paused = false;
25
- this.ponyfill = ponyfill;
26
- this.queue = [];
27
- }
28
-
29
- (0, _createClass2.default)(_default, [{
30
- key: "pause",
31
- value: function pause() {
32
- this.paused = true;
33
- this.consumer && this.consumer.pause();
34
- }
35
- }, {
36
- key: "push",
37
- value: function push(utterance) {
38
- this.queue.push(utterance);
39
- this.startConsumer();
40
- }
41
- }, {
42
- key: "resume",
43
- value: function resume() {
44
- this.paused = false;
45
-
46
- if (this.consumer) {
47
- this.consumer.resume();
48
- } else {
49
- this.startConsumer();
50
- }
51
- }
52
- }, {
53
- key: "speaking",
54
- get: function get() {
55
- return !!this.consumer;
56
- }
57
- }, {
58
- key: "startConsumer",
59
- value: function () {
60
- var _startConsumer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
61
- return _regenerator.default.wrap(function _callee$(_context) {
62
- while (1) {
63
- switch (_context.prev = _context.next) {
64
- case 0:
65
- if (!(!this.paused && this.queue.length && !this.consumer)) {
66
- _context.next = 7;
67
- break;
68
- }
69
-
70
- this.consumer = new _AudioContextConsumer.default();
71
- _context.next = 4;
72
- return this.consumer.start(this.queue, this.ponyfill);
73
-
74
- case 4:
75
- this.consumer = null;
76
- _context.next = 0;
77
- break;
78
-
79
- case 7:
80
- case "end":
81
- return _context.stop();
82
- }
83
- }
84
- }, _callee, this);
85
- }));
86
-
87
- function startConsumer() {
88
- return _startConsumer.apply(this, arguments);
89
- }
90
-
91
- return startConsumer;
92
- }()
93
- }, {
94
- key: "stop",
95
- value: function stop() {
96
- this.queue.splice(0);
97
- this.consumer && this.consumer.stop();
98
- }
99
- }]);
100
- return _default;
101
- }();
102
-
103
- exports.default = _default;
104
- //# sourceMappingURL=AudioContextQueue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AudioContextQueue.js","names":["ponyfill","consumer","paused","queue","pause","utterance","push","startConsumer","resume","length","AudioContextConsumer","start","splice","stop"],"sources":["../../../src/BingSpeech/TextToSpeech/AudioContextQueue.js"],"sourcesContent":["import AudioContextConsumer from './AudioContextConsumer';\n\nexport default class {\n constructor(ponyfill) {\n this.consumer = null;\n this.paused = false;\n this.ponyfill = ponyfill;\n this.queue = [];\n }\n\n pause() {\n this.paused = true;\n this.consumer && this.consumer.pause();\n }\n\n push(utterance) {\n this.queue.push(utterance);\n this.startConsumer();\n }\n\n resume() {\n this.paused = false;\n\n if (this.consumer) {\n this.consumer.resume();\n } else {\n this.startConsumer();\n }\n }\n\n get speaking() {\n return !!this.consumer;\n }\n\n async startConsumer() {\n while (!this.paused && this.queue.length && !this.consumer) {\n this.consumer = new AudioContextConsumer();\n await this.consumer.start(this.queue, this.ponyfill);\n this.consumer = null;\n }\n }\n\n stop() {\n this.queue.splice(0);\n this.consumer && this.consumer.stop();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;EAGE,kBAAYA,QAAZ,EAAsB;IAAA;IACpB,KAAKC,QAAL,GAAgB,IAAhB;IACA,KAAKC,MAAL,GAAc,KAAd;IACA,KAAKF,QAAL,GAAgBA,QAAhB;IACA,KAAKG,KAAL,GAAa,EAAb;EACD;;;;WAED,iBAAQ;MACN,KAAKD,MAAL,GAAc,IAAd;MACA,KAAKD,QAAL,IAAiB,KAAKA,QAAL,CAAcG,KAAd,EAAjB;IACD;;;WAED,cAAKC,SAAL,EAAgB;MACd,KAAKF,KAAL,CAAWG,IAAX,CAAgBD,SAAhB;MACA,KAAKE,aAAL;IACD;;;WAED,kBAAS;MACP,KAAKL,MAAL,GAAc,KAAd;;MAEA,IAAI,KAAKD,QAAT,EAAmB;QACjB,KAAKA,QAAL,CAAcO,MAAd;MACD,CAFD,MAEO;QACL,KAAKD,aAAL;MACD;IACF;;;SAED,eAAe;MACb,OAAO,CAAC,CAAC,KAAKN,QAAd;IACD;;;;mGAED;QAAA;UAAA;YAAA;cAAA;gBAAA,MACS,CAAC,KAAKC,MAAN,IAAgB,KAAKC,KAAL,CAAWM,MAA3B,IAAqC,CAAC,KAAKR,QADpD;kBAAA;kBAAA;gBAAA;;gBAEI,KAAKA,QAAL,GAAgB,IAAIS,6BAAJ,EAAhB;gBAFJ;gBAAA,OAGU,KAAKT,QAAL,CAAcU,KAAd,CAAoB,KAAKR,KAAzB,EAAgC,KAAKH,QAArC,CAHV;;cAAA;gBAII,KAAKC,QAAL,GAAgB,IAAhB;gBAJJ;gBAAA;;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;WAQA,gBAAO;MACL,KAAKE,KAAL,CAAWS,MAAX,CAAkB,CAAlB;MACA,KAAKX,QAAL,IAAiB,KAAKA,QAAL,CAAcY,IAAd,EAAjB;IACD"}
@@ -1,264 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
-
18
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
-
20
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
-
22
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
23
-
24
- var _DOMEventEmitter2 = _interopRequireDefault(require("../Util/DOMEventEmitter"));
25
-
26
- var _eventAsPromise = _interopRequireDefault(require("event-as-promise"));
27
-
28
- var _fetchSpeechData = _interopRequireDefault(require("./fetchSpeechData"));
29
-
30
- var _subscribeEvent = _interopRequireDefault(require("./subscribeEvent"));
31
-
32
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
33
-
34
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
35
-
36
- function asyncDecodeAudioData(audioContext, arrayBuffer) {
37
- return new Promise(function (resolve, reject) {
38
- var promise = audioContext.decodeAudioData(arrayBuffer, resolve, reject); // Newer implementation of "decodeAudioData" will return a Promise
39
-
40
- promise && typeof promise.then === 'function' && resolve(promise);
41
- });
42
- }
43
-
44
- function playDecoded(audioContext, audioBuffer, source) {
45
- return new Promise( /*#__PURE__*/function () {
46
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(resolve, reject) {
47
- var audioContextClosed, sourceEnded, unsubscribe;
48
- return _regenerator.default.wrap(function _callee$(_context) {
49
- while (1) {
50
- switch (_context.prev = _context.next) {
51
- case 0:
52
- audioContextClosed = new _eventAsPromise.default();
53
- sourceEnded = new _eventAsPromise.default();
54
- unsubscribe = (0, _subscribeEvent.default)(audioContext, 'statechange', function (_ref2) {
55
- var state = _ref2.target.state;
56
- return state === 'closed' && audioContextClosed.eventListener();
57
- });
58
- _context.prev = 3;
59
- source.buffer = audioBuffer; // "ended" may not fire if the underlying AudioContext is closed prematurely
60
-
61
- source.onended = sourceEnded.eventListener;
62
- source.connect(audioContext.destination);
63
- source.start(0);
64
- _context.next = 10;
65
- return Promise.race([audioContextClosed.upcoming(), sourceEnded.upcoming()]);
66
-
67
- case 10:
68
- resolve();
69
- _context.next = 16;
70
- break;
71
-
72
- case 13:
73
- _context.prev = 13;
74
- _context.t0 = _context["catch"](3);
75
- reject(_context.t0);
76
-
77
- case 16:
78
- _context.prev = 16;
79
- unsubscribe();
80
- return _context.finish(16);
81
-
82
- case 19:
83
- case "end":
84
- return _context.stop();
85
- }
86
- }
87
- }, _callee, null, [[3, 13, 16, 19]]);
88
- }));
89
-
90
- return function (_x, _x2) {
91
- return _ref.apply(this, arguments);
92
- };
93
- }());
94
- }
95
-
96
- var _default = /*#__PURE__*/function (_DOMEventEmitter) {
97
- (0, _inherits2.default)(_default, _DOMEventEmitter);
98
-
99
- var _super = _createSuper(_default);
100
-
101
- function _default(text) {
102
- var _this;
103
-
104
- (0, _classCallCheck2.default)(this, _default);
105
- _this = _super.call(this, ['boundary', 'end', 'error', 'mark', 'pause', 'resume', 'start']);
106
- _this._lang = null;
107
- _this._pitch = 1;
108
- _this._rate = 1;
109
- _this._voice = null;
110
- _this._volume = 1;
111
- _this.text = text;
112
- _this.onboundary = null;
113
- _this.onend = null;
114
- _this.onerror = null;
115
- _this.onmark = null;
116
- _this.onpause = null;
117
- _this.onresume = null;
118
- _this.onstart = null;
119
- return _this;
120
- }
121
-
122
- (0, _createClass2.default)(_default, [{
123
- key: "lang",
124
- get: function get() {
125
- return this._lang;
126
- },
127
- set: function set(value) {
128
- this._lang = value;
129
- }
130
- }, {
131
- key: "pitch",
132
- get: function get() {
133
- return this._pitch;
134
- },
135
- set: function set(value) {
136
- this._pitch = value;
137
- }
138
- }, {
139
- key: "rate",
140
- get: function get() {
141
- return this._rate;
142
- },
143
- set: function set(value) {
144
- this._rate = value;
145
- }
146
- }, {
147
- key: "voice",
148
- get: function get() {
149
- return this._voice;
150
- },
151
- set: function set(value) {
152
- this._voice = value;
153
- }
154
- }, {
155
- key: "volume",
156
- get: function get() {
157
- return this._volume;
158
- },
159
- set: function set(value) {
160
- this._volume = value;
161
- }
162
- }, {
163
- key: "preload",
164
- value: function () {
165
- var _preload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
166
- return _regenerator.default.wrap(function _callee2$(_context2) {
167
- while (1) {
168
- switch (_context2.prev = _context2.next) {
169
- case 0:
170
- this.arrayBufferPromise = (0, _fetchSpeechData.default)({
171
- authorizationToken: this.authorizationToken,
172
- lang: this.lang || window.navigator.language,
173
- outputFormat: this.outputFormat,
174
- pitch: this.pitch,
175
- rate: this.rate,
176
- text: this.text,
177
- voice: this.voice && this.voice.voiceURI,
178
- volume: this.volume
179
- });
180
- _context2.next = 3;
181
- return this.arrayBufferPromise;
182
-
183
- case 3:
184
- case "end":
185
- return _context2.stop();
186
- }
187
- }
188
- }, _callee2, this);
189
- }));
190
-
191
- function preload() {
192
- return _preload.apply(this, arguments);
193
- }
194
-
195
- return preload;
196
- }()
197
- }, {
198
- key: "play",
199
- value: function () {
200
- var _play = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(audioContext) {
201
- var source, audioBuffer;
202
- return _regenerator.default.wrap(function _callee3$(_context3) {
203
- while (1) {
204
- switch (_context3.prev = _context3.next) {
205
- case 0:
206
- _context3.prev = 0;
207
- // HACK: iOS requires bufferSourceNode to be constructed before decoding data
208
- source = audioContext.createBufferSource();
209
- _context3.t0 = asyncDecodeAudioData;
210
- _context3.t1 = audioContext;
211
- _context3.next = 6;
212
- return this.arrayBufferPromise;
213
-
214
- case 6:
215
- _context3.t2 = _context3.sent;
216
- _context3.next = 9;
217
- return (0, _context3.t0)(_context3.t1, _context3.t2);
218
-
219
- case 9:
220
- audioBuffer = _context3.sent;
221
- this.emit('start');
222
- this._playingSource = source;
223
- _context3.next = 14;
224
- return playDecoded(audioContext, audioBuffer, source);
225
-
226
- case 14:
227
- this._playingSource = null;
228
- this.emit('end');
229
- _context3.next = 21;
230
- break;
231
-
232
- case 18:
233
- _context3.prev = 18;
234
- _context3.t3 = _context3["catch"](0);
235
- this.emit('error', {
236
- error: _context3.t3,
237
- type: 'error'
238
- });
239
-
240
- case 21:
241
- case "end":
242
- return _context3.stop();
243
- }
244
- }
245
- }, _callee3, this, [[0, 18]]);
246
- }));
247
-
248
- function play(_x3) {
249
- return _play.apply(this, arguments);
250
- }
251
-
252
- return play;
253
- }()
254
- }, {
255
- key: "stop",
256
- value: function stop() {
257
- this._playingSource && this._playingSource.stop();
258
- }
259
- }]);
260
- return _default;
261
- }(_DOMEventEmitter2.default);
262
-
263
- exports.default = _default;
264
- //# sourceMappingURL=SpeechSynthesisUtterance.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SpeechSynthesisUtterance.js","names":["asyncDecodeAudioData","audioContext","arrayBuffer","Promise","resolve","reject","promise","decodeAudioData","then","playDecoded","audioBuffer","source","audioContextClosed","EventAsPromise","sourceEnded","unsubscribe","subscribeEvent","state","target","eventListener","buffer","onended","connect","destination","start","race","upcoming","text","_lang","_pitch","_rate","_voice","_volume","onboundary","onend","onerror","onmark","onpause","onresume","onstart","value","arrayBufferPromise","fetchSpeechData","authorizationToken","lang","window","navigator","language","outputFormat","pitch","rate","voice","voiceURI","volume","createBufferSource","emit","_playingSource","error","type","stop","DOMEventEmitter"],"sources":["../../../src/BingSpeech/TextToSpeech/SpeechSynthesisUtterance.js"],"sourcesContent":["import DOMEventEmitter from '../Util/DOMEventEmitter';\nimport EventAsPromise from 'event-as-promise';\nimport fetchSpeechData from './fetchSpeechData';\nimport subscribeEvent from './subscribeEvent';\n\nfunction asyncDecodeAudioData(audioContext, arrayBuffer) {\n return new Promise((resolve, reject) => {\n const promise = audioContext.decodeAudioData(arrayBuffer, resolve, reject);\n\n // Newer implementation of \"decodeAudioData\" will return a Promise\n promise && typeof promise.then === 'function' && resolve(promise);\n });\n}\n\nfunction playDecoded(audioContext, audioBuffer, source) {\n return new Promise(async (resolve, reject) => {\n const audioContextClosed = new EventAsPromise();\n const sourceEnded = new EventAsPromise();\n const unsubscribe = subscribeEvent(audioContext, 'statechange', ({ target: { state } }) => state === 'closed' && audioContextClosed.eventListener());\n\n try {\n source.buffer = audioBuffer;\n // \"ended\" may not fire if the underlying AudioContext is closed prematurely\n source.onended = sourceEnded.eventListener;\n\n source.connect(audioContext.destination);\n source.start(0);\n\n await Promise.race([\n audioContextClosed.upcoming(),\n sourceEnded.upcoming()\n ]);\n\n resolve();\n } catch (err) {\n reject(err);\n } finally {\n unsubscribe();\n }\n });\n}\n\nexport default class extends DOMEventEmitter {\n constructor(text) {\n super(['boundary', 'end', 'error', 'mark', 'pause', 'resume', 'start']);\n\n this._lang = null;\n this._pitch = 1;\n this._rate = 1;\n this._voice = null;\n this._volume = 1;\n\n this.text = text;\n\n this.onboundary = null;\n this.onend = null;\n this.onerror = null;\n this.onmark = null;\n this.onpause = null;\n this.onresume = null;\n this.onstart = null;\n }\n\n get lang() { return this._lang; }\n set lang(value) { this._lang = value; }\n\n get pitch() { return this._pitch; }\n set pitch(value) { this._pitch = value; }\n\n get rate() { return this._rate; }\n set rate(value) { this._rate = value; }\n\n get voice() { return this._voice; }\n set voice(value) { this._voice = value; }\n\n get volume() { return this._volume; }\n set volume(value) { this._volume = value; }\n\n async preload() {\n this.arrayBufferPromise = fetchSpeechData({\n authorizationToken: this.authorizationToken,\n lang: this.lang || window.navigator.language,\n outputFormat: this.outputFormat,\n pitch: this.pitch,\n rate: this.rate,\n text: this.text,\n voice: this.voice && this.voice.voiceURI,\n volume: this.volume\n });\n\n await this.arrayBufferPromise;\n }\n\n async play(audioContext) {\n try {\n // HACK: iOS requires bufferSourceNode to be constructed before decoding data\n const source = audioContext.createBufferSource();\n const audioBuffer = await asyncDecodeAudioData(audioContext, await this.arrayBufferPromise);\n\n this.emit('start');\n this._playingSource = source;\n\n await playDecoded(audioContext, audioBuffer, source);\n\n this._playingSource = null;\n this.emit('end');\n } catch (error) {\n this.emit('error', { error, type: 'error' });\n }\n }\n\n stop() {\n this._playingSource && this._playingSource.stop();\n }\n}\n"],"mappings":"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"}
@@ -1,61 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
- var _default = /*#__PURE__*/function () {
15
- function _default(_ref) {
16
- var gender = _ref.gender,
17
- lang = _ref.lang,
18
- voiceURI = _ref.voiceURI;
19
- (0, _classCallCheck2.default)(this, _default);
20
- this._gender = gender;
21
- this._lang = lang;
22
- this._name = voiceURI;
23
- this._voiceURI = voiceURI;
24
- }
25
-
26
- (0, _createClass2.default)(_default, [{
27
- key: "default",
28
- get: function get() {
29
- return false;
30
- }
31
- }, {
32
- key: "gender",
33
- get: function get() {
34
- return this._gender;
35
- }
36
- }, {
37
- key: "lang",
38
- get: function get() {
39
- return this._lang;
40
- }
41
- }, {
42
- key: "localService",
43
- get: function get() {
44
- return false;
45
- }
46
- }, {
47
- key: "name",
48
- get: function get() {
49
- return this._name;
50
- }
51
- }, {
52
- key: "voiceURI",
53
- get: function get() {
54
- return this._voiceURI;
55
- }
56
- }]);
57
- return _default;
58
- }();
59
-
60
- exports.default = _default;
61
- //# sourceMappingURL=SpeechSynthesisVoice.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SpeechSynthesisVoice.js","names":["gender","lang","voiceURI","_gender","_lang","_name","_voiceURI"],"sources":["../../../src/BingSpeech/TextToSpeech/SpeechSynthesisVoice.js"],"sourcesContent":["export default class {\n constructor({ gender, lang, voiceURI }) {\n this._gender = gender;\n this._lang = lang;\n this._name = voiceURI;\n this._voiceURI = voiceURI;\n }\n\n get default() { return false; }\n get gender() { return this._gender; }\n get lang() { return this._lang; }\n get localService() { return false; }\n get name() { return this._name; }\n get voiceURI() { return this._voiceURI; }\n}\n"],"mappings":";;;;;;;;;;;;;;EACE,wBAAwC;IAAA,IAA1BA,MAA0B,QAA1BA,MAA0B;IAAA,IAAlBC,IAAkB,QAAlBA,IAAkB;IAAA,IAAZC,QAAY,QAAZA,QAAY;IAAA;IACtC,KAAKC,OAAL,GAAeH,MAAf;IACA,KAAKI,KAAL,GAAaH,IAAb;IACA,KAAKI,KAAL,GAAaH,QAAb;IACA,KAAKI,SAAL,GAAiBJ,QAAjB;EACD;;;;SAED,eAAc;MAAE,OAAO,KAAP;IAAe;;;SAC/B,eAAa;MAAE,OAAO,KAAKC,OAAZ;IAAsB;;;SACrC,eAAW;MAAE,OAAO,KAAKC,KAAZ;IAAoB;;;SACjC,eAAmB;MAAE,OAAO,KAAP;IAAe;;;SACpC,eAAW;MAAE,OAAO,KAAKC,KAAZ;IAAoB;;;SACjC,eAAe;MAAE,OAAO,KAAKC,SAAZ;IAAwB"}
@@ -1,32 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = buildSSML;
7
-
8
- // Cognitive Services does not support unsigned percentage
9
- // It must be converted into +/- first.
10
- function relativePercentage(value) {
11
- var relative = Math.round((value - 1) * 100);
12
-
13
- if (relative >= 0) {
14
- relative = '+' + relative;
15
- }
16
-
17
- return relative + '%';
18
- }
19
-
20
- function buildSSML(_ref) {
21
- var gender = _ref.gender,
22
- lang = _ref.lang,
23
- _ref$pitch = _ref.pitch,
24
- pitch = _ref$pitch === void 0 ? 1 : _ref$pitch,
25
- _ref$rate = _ref.rate,
26
- rate = _ref$rate === void 0 ? 1 : _ref$rate,
27
- text = _ref.text,
28
- voice = _ref.voice,
29
- volume = _ref.volume;
30
- return "<speak version=\"1.0\" xml:lang=\"".concat(lang, "\">\n <voice xml:lang=\"").concat(lang, "\" xml:gender=\"").concat(gender, "\" name=\"").concat(voice, "\">\n <prosody pitch=\"").concat(relativePercentage(pitch), "\" rate=\"").concat(relativePercentage(rate), "\" volume=\"").concat(relativePercentage(volume), "\">\n ").concat(text, "\n </prosody>\n </voice>\n</speak>");
31
- }
32
- //# sourceMappingURL=buildSSML.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildSSML.js","names":["relativePercentage","value","relative","Math","round","buildSSML","gender","lang","pitch","rate","text","voice","volume"],"sources":["../../../src/BingSpeech/TextToSpeech/buildSSML.js"],"sourcesContent":["// Cognitive Services does not support unsigned percentage\n// It must be converted into +/- first.\nfunction relativePercentage(value) {\n let relative = Math.round((value - 1) * 100);\n\n if (relative >= 0) {\n relative = '+' + relative;\n }\n\n return relative + '%';\n}\n\nexport default function buildSSML({ gender, lang, pitch = 1, rate = 1, text, voice, volume }) {\n return `<speak version=\"1.0\" xml:lang=\"${ lang }\">\n <voice xml:lang=\"${ lang }\" xml:gender=\"${ gender }\" name=\"${ voice }\">\n <prosody pitch=\"${ relativePercentage(pitch) }\" rate=\"${ relativePercentage(rate) }\" volume=\"${ relativePercentage(volume) }\">\n ${ text }\n </prosody>\n </voice>\n</speak>`;\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA,SAASA,kBAAT,CAA4BC,KAA5B,EAAmC;EACjC,IAAIC,QAAQ,GAAGC,IAAI,CAACC,KAAL,CAAW,CAACH,KAAK,GAAG,CAAT,IAAc,GAAzB,CAAf;;EAEA,IAAIC,QAAQ,IAAI,CAAhB,EAAmB;IACjBA,QAAQ,GAAG,MAAMA,QAAjB;EACD;;EAED,OAAOA,QAAQ,GAAG,GAAlB;AACD;;AAEc,SAASG,SAAT,OAA+E;EAAA,IAA1DC,MAA0D,QAA1DA,MAA0D;EAAA,IAAlDC,IAAkD,QAAlDA,IAAkD;EAAA,sBAA5CC,KAA4C;EAAA,IAA5CA,KAA4C,2BAApC,CAAoC;EAAA,qBAAjCC,IAAiC;EAAA,IAAjCA,IAAiC,0BAA1B,CAA0B;EAAA,IAAvBC,IAAuB,QAAvBA,IAAuB;EAAA,IAAjBC,KAAiB,QAAjBA,KAAiB;EAAA,IAAVC,MAAU,QAAVA,MAAU;EAC5F,mDAA0CL,IAA1C,sCACoBA,IADpB,6BAC2CD,MAD3C,uBAC8DK,KAD9D,uCAEqBX,kBAAkB,CAACQ,KAAD,CAFvC,uBAE2DR,kBAAkB,CAACS,IAAD,CAF7E,yBAEkGT,kBAAkB,CAACY,MAAD,CAFpH,wBAGOF,IAHP;AAOD"}