All Downloads are FREE. Search and download functionalities are using the official Maven repository.

iosMain.nl.marc_apps.tts.IOSVoice.kt Maven / Gradle / Ivy

Go to download

Kotlin Multiplatform Text-to-Speech library for Android and browser (Kotlin/JS & Kotlin/Wasm). This library will enable you to use Text-to-Speech in multiplatform Kotlin projects.

There is a newer version: 3.0.0-beta.1
Show newest version
package nl.marc_apps.tts

import nl.marc_apps.tts.experimental.ExperimentalIOSTarget
import nl.marc_apps.tts.experimental.ExperimentalVoiceApi
import platform.AVFAudio.AVSpeechSynthesisVoice

@ExperimentalVoiceApi
@ExperimentalIOSTarget
internal data class IOSVoice constructor(
    override val name: String,
    override val isDefault: Boolean,
    override val isOnline: Boolean,
    override val languageTag: String,
    override val language: String,
    override val region: String?,
    val iosVoice: AVSpeechSynthesisVoice
) : Voice {
    constructor(voice: AVSpeechSynthesisVoice, isDefault: Boolean) : this(
        voice.name,
        isDefault,
        false,
        voice.language,
        voice.language.substringBefore("-"),
        if("-" in voice.language) voice.language.substringAfter("-") else null,
        voice
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy