Add documentation of flow of information for Text-to-Speech on Chrome/CROS.
NOTRY=true
[email protected]
Change-Id: I52c8cb2287f31554f5c6faab740ebd701b135eed
Reviewed-on: https://chromium-review.googlesource.com/1013693
Commit-Queue: Katie Dektar <[email protected]>
Reviewed-by: Katie Dektar <[email protected]>
Cr-Commit-Position: refs/heads/master@{#551355}
diff --git a/docs/README.md b/docs/README.md
index 975dcb5b..7aee7c0 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -280,6 +280,10 @@
feedback (ChromeVox) on Chrome OS.
* [ChromeVox on Desktop Linux](accessibility/chromevox_on_desktop_linux.md) -
Enabling spoken feedback (ChromeVox) on desktop Linux.
+* [Offscreen, Invisible and Size](accessibility/offscreen.md) - How Chrome
+ defines offscreen, invisible and size in the accessibility tree.
+* [Text to Speech](accessibility/tts.md) - Overview of text to speech in
+ Chrome and Chrome OS.
* [BRLTTY in Chrome OS](accessibility/brltty.md) - Chrome OS integration with
BRLTTY to support refreshable braille displays
* [PATTS on Chrome OS](accessibility/patts.md) - Notes on the PATTS speech
diff --git a/docs/accessibility.md b/docs/accessibility.md
index 869e1d1..363ba81 100644
--- a/docs/accessibility.md
+++ b/docs/accessibility.md
@@ -6,6 +6,7 @@
## Cross-Platform
* [Offscreen, Invisible and Size](accessibility/offscreen.md)
+* [Text to Speech in Chrome and Chrome OS](accessibility/tts.md)
## Chrome OS
diff --git a/docs/accessibility/patts.md b/docs/accessibility/patts.md
index 2270151b..11c7c42 100644
--- a/docs/accessibility/patts.md
+++ b/docs/accessibility/patts.md
@@ -3,6 +3,8 @@
Chrome OS comes with a speech synthesis engine developed internally at Google
called PATTS. It's based on the same engine that ships with all Android devices.
+[Read more about Text-to-Speech in Chrome](tts.md).
+
## Building from source
This is for Googlers only.
diff --git a/docs/accessibility/tts.md b/docs/accessibility/tts.md
new file mode 100644
index 0000000..e1d0764
--- /dev/null
+++ b/docs/accessibility/tts.md
@@ -0,0 +1,52 @@
+# Text to Speech in Chrome and Chrome OS
+
+Chrome and Chrome OS allow developers to produce synthesized speech. This
+document is an overview of the relevant code and code structure around
+synthesized speech.
+
+## Code structure
+
+A brief outline of the flow from speech request to the resulting speech on any
+platform.
+
+### Input
+
+- chrome.tts extension API
+
+ - The [chrome.tts extension API](https://developer.chrome.com/apps/tts)
+ allows extensions to request speech across Windows, Mac or Chrome OS, using
+ native speech synthesis.
+
+ - Input to the extension is first processed in the
+ [TtsExtensionApi](https://cs.chromium.org/chromium/src/chrome/browser/speech/extension_api/tts_extension_api.h).
+
+ - The extension is passed an [Options object](https://developer.chrome.com/apps/tts#method-speak)
+ in chrome.tts.speak, which is translated into a
+ [tts_controller Utterance](https://cs.chromium.org/chromium/src/chrome/browser/speech/tts_controller.h?dr=CSs&l=130).
+
+- Web Speech API
+
+ - Chrome implements
+ [Window.SpeechSynthesis](https://developer.mozilla.org/en-US/docs/Web/API/Window/speechSynthesis)
+ from the [Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API).
+ This allows web apps to do text-to-speech via the device's speech
+ synthesizer.
+
+ - A [WebSpeechSynthesisUtterance](https://cs.chromium.org/chromium/src/third_party/blink/public/platform/web_speech_synthesis_utterance.h)
+ is created by window.SpeechSynthesis
+
+### Processing
+
+- The [TtsController](https://cs.chromium.org/chromium/src/chrome/browser/speech/tts_controller.h) processes utterances and sends them to the correct output engine
+
+### Output
+
+- May differ by system, including Mac, Wind, Android, Arc++, and Chrome OS
+
+- In Chrome OS:
+
+ - [TtsEngineExtensionAPI](https://cs.chromium.org/chromium/src/chrome/browser/speech/extension_api/tts_engine_extension_api.h)
+ forwards speech events to PATTS, or the network speech engine, or,
+ coming soon, third-party speech engines.
+
+ - [PATTS](patts.md) is the built-in Chrome OS text-to-speech engine.