blob: 878822ad3dc8ad2d1b876dc235a0902599748399 [file] [log] [blame] [view]
dmazzoni2f489752017-02-16 03:39:161# The Chrome OS PATTS speech synthesis engine
2
3Chrome OS comes with a speech synthesis engine developed internally at Google
4called PATTS. It's based on the same engine that ships with all Android devices.
5
David Tseng7f8ddfb2021-11-01 19:32:596[Read more about Text-to-Speech in Chrome](../browser/tts.md).
Katie Ded1a9972018-04-17 16:22:187
Dominic Mazzonifd246a02018-10-26 18:33:128[See also the eSpeak engine](espeak.md).
9
dmazzoni2f489752017-02-16 03:39:1610## Building from source
11
12This is for Googlers only.
13
Anastasia Helfinstein2ac2efb2022-01-19 17:38:1114Visit [http://go/google-tts-web-ports](http://go/google-tts-web-ports)
dmazzoni2f489752017-02-16 03:39:1615for instructions on how to build the engine from source and get the
16latest voice files.
17
18When debugging, start Chrome from the command-line and set the
19NACL_PLUGIN_DEBUG environment variable to 1 to print log messages to stdout.
20
Katie D602acdef2018-01-18 19:38:0221If running on Chrome OS on desktop Linux, you can put the unpacked extension in
22your downloads directory, and hide the existing TTS extension by temporarily
23renaming /usr/share/chromeos-assets to something else. Then in
24chrome://extensions you can enable developer mode and "load unpacked extension".
25You must hide the existing TTS extension because extension keys must not be
26duplicated, and ChromeOS will crash if you try to load the unpacked extension
27while the built-in one is already loaded.
28
Katie D5da13902018-03-08 22:54:2229To test, use the [TTS Demo extension](https://chrome.google.com/webstore/detail/tts-demo/chhkejkkcghanjclmhhpncachhgejoel)
Katie D602acdef2018-01-18 19:38:0230in Chromeos. This should automatically recognize the unpacked TTS extension
31based on its manifest key. You can also use any site that uses a web speech API
32demo. In addition, the Chrome Accessibility team has a
Katie D5da13902018-03-08 22:54:2233[TTS Debug extension](https://chrome.google.com/webstore/detail/idllbaaoaldabjncnbfokacibfehkemd)
Katie D602acdef2018-01-18 19:38:0234which can run several automated tests.
35
dmazzoni2f489752017-02-16 03:39:1636## Updating
37
38First, follow the public
39[Chromium OS Developer Guide](http://www.chromium.org/chromium-os/developer-guide) to check out the source.
Katie D602acdef2018-01-18 19:38:0240At a minimum you'll need to create a chroot and initialize the build for your board.
dmazzoni2f489752017-02-16 03:39:1641You do not need to build everything from source.
42You do need to start the devserver.
43
44Next, flash your device to a very recent test build. Internally at Google
45you can do this with the following command when the dev server is running,
46where CHROMEBOOK_IP_ADDRESS is the IP address of your Chromebook already
47in developer mode, and $BOARD is your Chromebook's board name.
48
49```cros flash ssh://CHROMEBOOK_IP_ADDRESS xbuddy://remote/$BOARD/latest-dev/test```
50
51Before you can make changes to PATTS, the first thing you need to run
52(from the chroot) is call cros_workon with two relevant ebuilds:
53
54```
wez03343932017-02-25 02:01:4255cros_workon --board=$BOARD start chromiumos-assets
dmazzoni2f489752017-02-16 03:39:1656cros_workon --board=$BOARD start common-assets
57```
58
wez03343932017-02-25 02:01:4259From outside the root, from anywhere under your top-level ```<repo-dir>```, pull down the relevant sources:
dmazzoni2f489752017-02-16 03:39:1660
61```
wez03343932017-02-25 02:01:4262repo sync
63```
64
65Again, outside the root, make sure you're in the ```<repo-dir>/src/platform/assets``` directory and run
66```repo start``` to create a branch:
67
68```
69cd src/platform/assets
dmazzoni2f489752017-02-16 03:39:1670repo start <branch_name> .
71```
72
73
74The PATTS data files can be found in this directory:
75
wez03343932017-02-25 02:01:4276```src/platform/assets/speech_synthesis/patts```
dmazzoni2f489752017-02-16 03:39:1677
78When updating the files, the native client files (nexe) need to be zipped.
79
Katie D602acdef2018-01-18 19:38:0280Replace all of the files you need to update. You will probably not need
81to update the manifest.json, tts_main.js or tts_controller.js, as these
82are probably most up-to-date on ChromeOS and not google3. Look at recent
83commit history on both platforms to determine what changes should be
84pushed.
85
86Commit your changes using git, then from the chroot, run:
dmazzoni2f489752017-02-16 03:39:1687
88```
89emerge-$BOARD common-assets
90cros deploy CHROMEBOOK_IP_ADDRESS common-assets
91```
92
93Note that you need to call cros_workon on both chromeos-assets and
94common-assets. You will be changing files in chromeos-assets, but
95to flash it onto your device, you need to emerge and deploy
96common-assets.
97
98After that, reboot your Chromebook and verify that speech works.
99
100To upload the change, use repo upload, something like this:
101
102```
103git commit -a
Lei Zhang3fd577db2020-05-21 21:33:19104 Bug: chromium:12345
105 Test: Write what you tested here
dmazzoni2f489752017-02-16 03:39:16106repo upload .
107```
dmazzonie442e9b2017-03-02 06:08:08108
Katie D5da13902018-03-08 22:54:22109After submitting, inform the [Chrome Accessibility Team](mailto:chrome-a11y-core@google.com)
Katie D602acdef2018-01-18 19:38:02110so that they can update their local copies of TTS per the
Katie D5da13902018-03-08 22:54:22111[Chromevox instructions](chromevox_on_desktop_linux.md).
Katie D602acdef2018-01-18 19:38:02112
dmazzonie442e9b2017-03-02 06:08:08113## Ebuild
114
115Note that sometimes you'll have to update the ebuild file that
116takes the patts data files and installs them, unzipping the .nexe
117files in the process.
118
119For example, you'll need to edit the ebuild if you add or remove
120a language code, or if you add or remove a file that needs to be
121installed as part of the extension.
122
123To update the ebuild, edit this file:
124
125```
126/third_party/chromiumos-overlay/chromeos-base/common-assets/common-assets-9999.ebuild
127```
128
129If you need to land changes to both common-assets and chromiumos-assets,
130upload the changes separately and then make them depend on one another
131using this syntax in the changelog:
132
133```
134CQ-DEPEND=CL:12345
135```
136
137Note that you can (and often should) have two changes depend on one another
138so they'll land atomically.
139
140