Add support for explicit timepoints in text-to-speech playback
This change introduces the ideas of explicit and implicit timepoints. An explicit timepoint is a time delta from the beginning of playback paired with a character index into the spoken string. An implicit timepoint is simply a character index into the spoken string which is annotated on a particular audio buffer. Both types of timepoints achieve the same goal of letting a TtsEventObserver know about when playback has reached a specific character within the spoken string. Prior to this change, implicit timepoints were the only type of timepoint. All tts stream types (playback and Google), did not need explicit timepointing. As of the latest Google tts models, however, explicit timepointing is needed because the latest Google tts engine exposes multiple timepoints on a single audio buffer, breaking the assumption that timepoints are coupled to their audio buffres. This change does not attempt to choose between timepoint types to eliminate one or the other; that can be deferred to a future change given proper motivation. Misc notes Implicit timepoints have some advantages. It will make it easier to write more sophisticated features such as seeking into the audio buffers queue by character index. It also reduces the playback tts stream interface, which may eventually turn into the public api surface for a playback tts extension api. Explicit timepoints also have some advantages. They can allow the tts service to reason about all timepoints for a given sentence at once or provide them to the tts caller for additional logic. Test: chromeos_unittests --gtest_filter=Tts*.* (coverage for both types of timepoints). Manually on-device. Bug: b/174804378 Change-Id: I548c20f642317516795d494b10cd47a3dcee0e70 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2577538 Commit-Queue: David Tseng <dtseng@chromium.org> Reviewed-by:Akihiro Ota <akihiroota@chromium.org> Cr-Commit-Position: refs/heads/master@{#835328}
Showing
Please register or sign in to comment