https://github.com/simplisticated/tellme-for-android
Easy-to-use voice API for Android apps. Made in Kotlin.
https://github.com/simplisticated/tellme-for-android
android kotlin voice
Last synced: 8 months ago
JSON representation
Easy-to-use voice API for Android apps. Made in Kotlin.
- Host: GitHub
- URL: https://github.com/simplisticated/tellme-for-android
- Owner: simplisticated
- License: apache-2.0
- Created: 2019-03-27T20:51:13.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-10T09:41:50.000Z (almost 7 years ago)
- Last Synced: 2025-04-04T15:52:46.095Z (12 months ago)
- Topics: android, kotlin, voice
- Language: Kotlin
- Size: 162 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## At a Glance
`TellMe` is a library that simplifies work with voice in Android.
## How to Get Started
Add `jitpack.io` repository to your project:
```javascript
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
```
Then add `TellMe` to dependencies list:
```javascript
dependencies {
implementation 'com.github.igormatyushkin014:TellMe-for-Android:1.2.1'
}
```
## Requirements
* Android SDK 21 and later
* Android Studio 3.3 and later
* Kotlin 1.3 or later
## Usage
Use it from any activity, fragment or service:
```kotlin
tellMeIn(Locale.ENGLISH)
.say("Hello")
```
Another example with chain of texts:
```kotlin
tellMeIn(Locale.ENGLISH)
.say("Hello! How are you doing?")
.say("What's up?")
.say("Tell me something new.")
```
Want more flexibility? Add a listener:
```kotlin
tellMeIn(Locale.ENGLISH)
.say("Hello! How are you doing?")
.setOnSpeechListener(
object : Speaker.OnSpeechListener {
override fun onStartedSaying(text: String) {
// Called when text is going to be pronounced
}
override fun onProgress(text: String, position: SpeechPosition) {
val currentlyPronouncing = text.substring(position.start, position.start + position.length)
// Called when a part of source text is going to be pronounced
}
override fun onFinishedSaying(text: String) {
// Called when finished speaking
}
}
)
```
Also, to make sure that all resources are released, call `releaseWhenFinish()` anywhere in the chain:
```kotlin
tellMeIn(Locale.ENGLISH)
.say("Hello! How are you doing?")
.say("What's up?")
.say("Tell me something new.")
.releaseWhenFinish()
```
Use this method when you don't need to use text-to-speech conversion frequently.
## License
`TellMe` is available under the Apache 2.0 license. See the [LICENSE](./LICENSE) file for more info.