#tts #windows

tts

High-level Text-To-Speech (TTS) interface

50 releases (16 breaking)

0.17.3 May 20, 2021
0.16.0 Apr 5, 2021
0.15.2 Mar 16, 2021
0.13.1 Dec 30, 2020
0.1.0 Dec 30, 2018

#111 in Windows APIs

Download history 15/week @ 2021-02-25 92/week @ 2021-03-04 102/week @ 2021-03-11 170/week @ 2021-03-18 644/week @ 2021-03-25 234/week @ 2021-04-01 286/week @ 2021-04-08 840/week @ 2021-04-15 300/week @ 2021-04-22 361/week @ 2021-04-29 471/week @ 2021-05-06 267/week @ 2021-05-13 373/week @ 2021-05-20 243/week @ 2021-05-27 436/week @ 2021-06-03 343/week @ 2021-06-10

1,307 downloads per month
Used in 4 crates (3 directly)

MIT and maybe LGPL-2.1

79KB
2K SLoC

TTS-RS

This library provides a high-level Text-To-Speech (TTS) interface supporting various backends. Currently supported backends are:

  • Windows
    • Screen readers/SAPI via Tolk (requires tolk Cargo feature)
    • WinRT
  • Linux via Speech Dispatcher
  • MacOS/iOS
    • AppKit on MacOS 10.13 and below
    • AVFoundation on MacOS 10.14 and above, and iOS
  • Android
  • WebAssembly

Android Setup

On most platforms, this library is plug-and-play. Because of JNI's complexity, Android setup is a bit more involved. In general, look to the Android example for guidance. Here are some rough steps to get going:

  • Set up Cargo.toml as the example does. Be sure to depend on ndk-glue.
  • Place Bridge.java appropriately in your app. This is needed to support various Android TTS callbacks.
  • Create a main activity similar to MainActivity.kt. In particular, you need to derive android.app.NativeActivity, and you need a System.loadLibrary(...) call appropriate for your app. System.loadLibrary(...) is needed to trigger JNI_OnLoad.
    • Even though you've loaded the library in your main activity, add a metadata tag to your activity in AndroidManifest.xml referencing it. Yes, this is redundant but necessary.
  • Set if your various build.gradle scripts to reference the plugins, dependencies, etc. from the example. In particular, you'll want to set up cargo-ndk-android-gradle and either depend on androidx.annotation or otherwise configure your app to keep the class rs.tts.Bridge.

And I think that should about do it. Good luck!

Dependencies

~0.4–3.5MB
~80K SLoC