AiliaVoice

class AiliaVoice(envId: Int = -1, numThread: Int = 0, memoryMode: Int = 11, flags: Int = AILIA_VOICE_FLAG_NONE) : Closeable

Text to speech (TTS) library.

This class provides speech synthesis (Tacotron2 and GPT-SoVITS) via the ailia Voice native library.

Parameters

envId

Environment ID of ailia (-1 to select automatically).

numThread

Number of threads (0 to select automatically).

memoryMode

Memory mode of ailia.

flags

OR of the AILIA_VOICE_FLAG_* constants.

Constructors

Link copied to clipboard
constructor(envId: Int = -1, numThread: Int = 0, memoryMode: Int = 11, flags: Int = AILIA_VOICE_FLAG_NONE)

Creates an ailia Voice instance.

Types

Link copied to clipboard

Exception thrown when an ailia Voice API call fails.

Link copied to clipboard
data class AudioData(val samplingRate: Int, val channels: Int, val data: FloatArray)

Synthesized audio.

Link copied to clipboard
object Companion

Constants of ailia Voice.

Functions

Link copied to clipboard
open override fun close()

Releases the native resources.

Link copied to clipboard
fun g2p(text: String, g2pType: Int = AILIA_VOICE_G2P_TYPE_GPT_SOVITS_JA): String

Converts graphemes to phonemes (G2P).

Link copied to clipboard
fun openDictionaryFile(path: String, dictionaryType: Int = AILIA_VOICE_DICTIONARY_TYPE_OPEN_JTALK)

Opens a dictionary.

Link copied to clipboard
fun openGPTSoVITSV1ModelFile(encoder: String, decoder1: String, decoder2: String, wave: String, ssl: String)

Opens a GPT-SoVITS V1 model.

Link copied to clipboard
fun openGPTSoVITSV2ModelFile(encoder: String, decoder1: String, decoder2: String, wave: String, ssl: String, chineseBert: String? = null, vocab: String? = null)

Opens a GPT-SoVITS V2 model.

Link copied to clipboard
fun openGPTSoVITSV2ProModelFile(encoder: String, decoder1: String, decoder2: String, ssl: String, vits: String, sv: String, chineseBert: String? = null, vocab: String? = null)

Opens a GPT-SoVITS V2 Pro model.

Link copied to clipboard
fun openGPTSoVITSV3ModelFile(encoder: String, decoder1: String, decoder2: String, ssl: String, vq: String, cfm: String, bigvgan: String, chineseBert: String? = null, vocab: String? = null)

Opens a GPT-SoVITS V3 model.

Link copied to clipboard
fun openModelFile(encoder: String, decoder1: String, decoder2: String, wave: String, ssl: String, modelType: Int = AILIA_VOICE_MODEL_TYPE_TACOTRON2, cleanerType: Int = AILIA_VOICE_CLEANER_TYPE_BASIC)

Opens a model.

Link copied to clipboard
fun openTacotron2ModelFile(encoder: String, decoder1: String, decoder2: String, wave: String, cleanerType: Int)

Opens a Tacotron2 model.

Link copied to clipboard
fun setModelType(modelType: Int)

Set the model type for G2P processing. Sets the model type when using G2P standalone without loading model files. Automatically set when openModelFile or openGPTSoVITSV3ModelFile is called.

Link copied to clipboard
fun setReferenceAudio(buf: FloatArray, bufSize: Int, channels: Int, samplingRate: Int, features: String)

Specifies the voice that will serve as the timbre for speech synthesis.

Link copied to clipboard
fun setSampleSteps(steps: Int)

Sets the number of CFM sampling steps.

Link copied to clipboard
fun setSpeed(speed: Float)

Set the speech speed for synthesis. Supported by GPT-SoVITS V2 and V3. Not effective for V1.

Link copied to clipboard
fun setUserDictionaryFile(path: String, dictionaryType: Int = AILIA_VOICE_DICTIONARY_TYPE_OPEN_JTALK)

Sets a user dictionary file.

Link copied to clipboard

Synthesizes voice from the input text.