TextToSpeechKt
Kotlin Multiplatform Text-to-Speech library for Android, iOS, macOS and browser (Kotlin/JS & Kotlin/Wasm).
Install / Use
/learn @Marc-JB/TextToSpeechKtREADME
TextToSpeechKt
Text-to-Speech library for Kotlin Multiplatform. Supports targets Android, iOS, macOS and browser (js and wasmJs).
</div>:notebook_with_decorative_cover: Table of Contents
:star2: About the Project
:space_invader: Tech Stack
Uses Kotlin Multiplatform with support for the following targets:
| Platform | Language | Support | |---------------------|---------------|---------------------------| | Android | Kotlin/JVM | ✅ | | Browser | Kotlin/JS | ✅ | | Browser | Kotlin/Wasm | ✅ | | Browser | JS, TS | ❌ Support ended in v2.0 | | Desktop | Kotlin/JVM | ⚠️ Experimental support | | iOS, MacOS | Kotlin/Native | ✅ | | Other Kotlin/Native | Kotlin/Native | ❌ |
:dart: Features
- Kotlin Multiplatform API for text-to-speech on the following platforms: Android, iOS, macOS, js and wasmJs
- Await synthesis completion using Kotlin Coroutines
- Supports the following configuration:
- Voice pitch & rate
- Volume
- Voice selection
- Language (through voice selection)
- Compose Multiplatform support with
rememberTextToSpeechOrNull()available in thetts-composepackage.
:toolbox: Getting Started
:bangbang: Prerequisites
A build tool like Gradle or Maven.
:gear: Installation
<details> <summary><strong>libs.versions.toml</strong></summary>[versions]
textToSpeech = "3.0.0"
[libraries]
textToSpeech = { module = "nl.marc-apps:tts", version.ref = "textToSpeech" }
# Optional: Extensions for Compose
textToSpeech-compose = { module = "nl.marc-apps:tts-compose", version.ref = "textToSpeech" }
Make sure to configure the latest stable version:
And add the library to your dependencies:
dependencies {
implementation("nl.marc-apps:tts:3.0.0")
// Optional: Extensions for Compose
implementation("nl.marc-apps:tts-compose:3.0.0")
}
Or
kotlin {
sourceSets {
commonMain.dependencies {
implementation("nl.marc-apps:tts:3.0.0")
// Optional: Extensions for Compose
implementation("nl.marc-apps:tts-compose:3.0.0")
}
}
}
Make sure to configure the latest stable version:
:eyes: Usage
Documentation files
View documentation generated by Dokka
Demo projects
Go to the /demo directory of this project.
:warning: License
This project is published under the MIT License. Read more about this license in the LICENSE file.
