| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 [ |
| 6 { |
| 7 "namespace": "tts", |
| 8 "types": [ |
| 9 { |
| 10 "id": "TtsEvent", |
| 11 "type": "object", |
| 12 "description": "An event from the TTS engine to communicate the status o
f an utterance.", |
| 13 "properties": { |
| 14 "type": { |
| 15 "type": "string", |
| 16 "enum": ["start", "end", "word", "sentence", "marker", "interrupted"
, "cancelled", "error"], |
| 17 "description": "The type can be 'start' as soon as speech has starte
d, 'word' when a word boundary is reached, 'sentence' when a sentence boundary i
s reached, 'marker' when an SSML mark element is reached, 'end' when the end of
the utterance is reached, 'interrupted' when the utterance is stopped or interru
pted before reaching the end, 'cancelled' when it's removed from the queue befor
e ever being synthesized, or 'error' when any other error occurs." |
| 18 }, |
| 19 "charIndex": { |
| 20 "type": "number", |
| 21 "optional": true, |
| 22 "description": "The index of the current character in the utterance.
" |
| 23 }, |
| 24 "errorMessage": { |
| 25 "type": "string", |
| 26 "description": "The error description, if the event type is 'error'.
", |
| 27 "optional": true |
| 28 }, |
| 29 "srcId": { |
| 30 "type": "number", |
| 31 "description": "An ID unique to the calling function's context so th
at events can get routed back to the correct tts.speak call.", |
| 32 "nodoc": true, |
| 33 "optional": true |
| 34 }, |
| 35 "isFinalEvent": { |
| 36 "type": "boolean", |
| 37 "description": "True if this is the final event that will be sent to
this handler.", |
| 38 "nodoc": true, |
| 39 "optional": true |
| 40 } |
| 41 } |
| 42 }, |
| 43 { |
| 44 "id": "TtsVoice", |
| 45 "type": "object", |
| 46 "description": "A description of a voice available for speech synthesis.
", |
| 47 "properties": { |
| 48 "voiceName": { |
| 49 "type": "string", |
| 50 "optional": true, |
| 51 "description": "The name of the voice." |
| 52 }, |
| 53 "lang": { |
| 54 "type": "string", |
| 55 "optional": true, |
| 56 "description": "The language that this voice supports, in the form <
em>language</em>-<em>region</em>. Examples: 'en', 'en-US', 'en-GB', 'zh-CN'." |
| 57 }, |
| 58 "gender": { |
| 59 "type": "string", |
| 60 "optional": true, |
| 61 "description": "This voice's gender.", |
| 62 "enum": ["male", "female"] |
| 63 }, |
| 64 "extensionId": { |
| 65 "type": "string", |
| 66 "optional": true, |
| 67 "description": "The ID of the extension providing this voice." |
| 68 }, |
| 69 "eventTypes": { |
| 70 "type": "array", |
| 71 "items": {"type": "string"}, |
| 72 "optional": true, |
| 73 "description": "All of the callback event types that this voice is c
apable of sending." |
| 74 } |
| 75 } |
| 76 } |
| 77 ], |
| 78 "functions": [ |
| 79 { |
| 80 "name": "speak", |
| 81 "type": "function", |
| 82 "description": "Speaks text using a text-to-speech engine.", |
| 83 "parameters": [ |
| 84 { |
| 85 "type": "string", |
| 86 "name": "utterance", |
| 87 "description": "The text to speak, either plain text or a complete,
well-formed SSML document. Speech engines that do not support SSML will strip aw
ay the tags and speak the text. The maximum length of the text is 32,768 charact
ers." |
| 88 }, |
| 89 { |
| 90 "type": "object", |
| 91 "name": "options", |
| 92 "optional": true, |
| 93 "description": "The speech options.", |
| 94 "properties": { |
| 95 "enqueue": { |
| 96 "type": "boolean", |
| 97 "optional": true, |
| 98 "description": "If true, enqueues this utterance if TTS is alrea
dy in progress. If false (the default), interrupts any current speech and flushe
s the speech queue before speaking this new utterance." |
| 99 }, |
| 100 "voiceName": { |
| 101 "type": "string", |
| 102 "optional": true, |
| 103 "description": "The name of the voice to use for synthesis. If e
mpty, uses any available voice." |
| 104 }, |
| 105 "extensionId": { |
| 106 "type": "string", |
| 107 "optional": true, |
| 108 "description": "The extension ID of the speech engine to use, if
known." |
| 109 }, |
| 110 "lang": { |
| 111 "type": "string", |
| 112 "optional": true, |
| 113 "description": "The language to be used for synthesis, in the fo
rm <em>language</em>-<em>region</em>. Examples: 'en', 'en-US', 'en-GB', 'zh-CN'.
" |
| 114 }, |
| 115 "gender": { |
| 116 "type": "string", |
| 117 "optional": true, |
| 118 "description": "Gender of voice for synthesized speech.", |
| 119 "enum": ["male", "female"] |
| 120 }, |
| 121 "rate": { |
| 122 "type": "number", |
| 123 "optional": true, |
| 124 "minimum": 0.1, |
| 125 "maximum": 10, |
| 126 "description": "Speaking rate relative to the default rate for t
his voice. 1.0 is the default rate, normally around 180 to 220 words per minute.
2.0 is twice as fast, and 0.5 is half as fast. Values below 0.1 or above 10.0 a
re strictly disallowed, but many voices will constrain the minimum and maximum r
ates further—for example a particular voice may not actually speak faster
than 3 times normal even if you specify a value larger than 3.0." |
| 127 }, |
| 128 "pitch": { |
| 129 "type": "number", |
| 130 "optional": true, |
| 131 "minimum": 0, |
| 132 "maximum": 2, |
| 133 "description": "Speaking pitch between 0 and 2 inclusive, with 0
being lowest and 2 being highest. 1.0 corresponds to a voice's default pitch." |
| 134 }, |
| 135 "volume": { |
| 136 "type": "number", |
| 137 "optional": true, |
| 138 "minimum": 0, |
| 139 "maximum": 1, |
| 140 "description": "Speaking volume between 0 and 1 inclusive, with
0 being lowest and 1 being highest, with a default of 1.0." |
| 141 }, |
| 142 "requiredEventTypes": { |
| 143 "type": "array", |
| 144 "items": {"type": "string"}, |
| 145 "optional": true, |
| 146 "description": "The TTS event types the voice must support." |
| 147 }, |
| 148 "desiredEventTypes": { |
| 149 "type": "array", |
| 150 "items": {"type": "string"}, |
| 151 "optional": true, |
| 152 "description": "The TTS event types that you are interested in l
istening to. If missing, all event types may be sent." |
| 153 }, |
| 154 "onEvent": { |
| 155 "type": "function", |
| 156 "optional": true, |
| 157 "description": "This function is called with events that occur i
n the process of speaking the utterance.", |
| 158 "parameters": [ |
| 159 { |
| 160 "name": "event", |
| 161 "$ref": "TtsEvent", |
| 162 "description": "The update event from the text-to-speech eng
ine indicating the status of this utterance." |
| 163 } |
| 164 ] |
| 165 } |
| 166 } |
| 167 }, |
| 168 { |
| 169 "type": "function", |
| 170 "name": "callback", |
| 171 "optional": true, |
| 172 "description": "Called right away, before speech finishes. Check chr
ome.runtime.lastError to make sure there were no errors. Use options.onEvent to
get more detailed feedback.", |
| 173 "parameters": [] |
| 174 } |
| 175 ] |
| 176 }, |
| 177 { |
| 178 "name": "stop", |
| 179 "type": "function", |
| 180 "description": "Stops any current speech.", |
| 181 "parameters": [] |
| 182 }, |
| 183 { |
| 184 "name": "isSpeaking", |
| 185 "type": "function", |
| 186 "description": "Checks whether the engine is currently speaking. On Mac
OS X, the result is true whenever the system speech engine is speaking, even if
the speech wasn't initiated by Chrome.", |
| 187 "parameters": [ |
| 188 { |
| 189 "type": "function", |
| 190 "name": "callback", |
| 191 "optional": true, |
| 192 "parameters": [ |
| 193 { |
| 194 "name": "speaking", |
| 195 "type": "boolean", |
| 196 "description": "True if speaking, false otherwise." |
| 197 } |
| 198 ] |
| 199 } |
| 200 ] |
| 201 }, |
| 202 { |
| 203 "name": "getVoices", |
| 204 "type": "function", |
| 205 "description": "Gets an array of all available voices.", |
| 206 "parameters": [ |
| 207 { |
| 208 "type": "function", |
| 209 "name": "callback", |
| 210 "optional": true, |
| 211 "parameters": [ |
| 212 { |
| 213 "type": "array", |
| 214 "name": "voices", |
| 215 "items": { "$ref": "TtsVoice" }, |
| 216 "description": "Array of $ref:TtsVoice objects representing the
available voices for speech synthesis." |
| 217 } |
| 218 ] |
| 219 } |
| 220 ] |
| 221 } |
| 222 ], |
| 223 "events": [ |
| 224 { |
| 225 "name": "onEvent", |
| 226 "type": "function", |
| 227 "nodoc": true, |
| 228 "parameters": [ |
| 229 { |
| 230 "name": "event", |
| 231 "$ref": "TtsEvent", |
| 232 "description": "The event from the text-to-speech engine indicating
the status of this utterance." |
| 233 } |
| 234 ], |
| 235 "description": "Used to pass events back to the function calling speak()
." |
| 236 } |
| 237 ] |
| 238 } |
| 239 ] |
| OLD | NEW |