ailia_voice  1.1.0.0
Classes | Macros | Typedefs | Functions
ailia_voice.h File Reference
#include "ailia.h"
#include "ailia_audio.h"
Include dependency graph for ailia_voice.h:

Go to the source code of this file.

Classes

struct  _AILIAVoiceApiCallback
 

Macros

#define AILIA_API   __stdcall
 
#define AILIA_VOICE_DICTIONARY_TYPE_OPEN_JTALK   (0)
 Format for OpenJTalk. More...
 
#define AILIA_VOICE_DICTIONARY_TYPE_G2P_EN   (1)
 Format for G2P_EN. More...
 
#define AILIA_VOICE_MODEL_TYPE_TACOTRON2   (0)
 Format for Tacotron2. More...
 
#define AILIA_VOICE_MODEL_TYPE_GPT_SOVITS   (1)
 Format for GPT-SoVITS. More...
 
#define AILIA_VOICE_CLEANER_TYPE_BASIC   (0)
 BasicCleaner. More...
 
#define AILIA_VOICE_CLEANER_TYPE_ENGLISH   (1)
 EnglishCleaner. More...
 
#define AILIA_VOICE_FLAG_NONE   (0)
 Default flag. More...
 
#define AILIA_VOICE_G2P_TYPE_GPT_SOVITS_EN   (1)
 GPT SOVITS English. More...
 
#define AILIA_VOICE_G2P_TYPE_GPT_SOVITS_JA   (2)
 GPT SOVITS Japanese. More...
 
#define AILIA_VOICE_TEXT_POST_PROCESS_APPEND_PUNCTUATION   (2)
 
#define AILIA_VOICE_USER_API
 
#define AILIA_VOICE_API_CALLBACK_VERSION   (1)
 Struct version. More...
 
#define ailiaVoiceOpenDictionaryFile   ailiaVoiceOpenDictionaryFileW
 
#define ailiaVoiceOpenModelFile   ailiaVoiceOpenModelFileW
 

Typedefs

typedef int(AILIA_VOICE_USER_APIAILIA_VOICE_USER_API_AILIA_AUDIO_RESAMPLE) (void *, const void *, int, int, int, int)
 
typedef int(AILIA_VOICE_USER_APIAILIA_VOICE_USER_API_AILIA_AUDIO_GET_RESAMPLE_LEN) (int *, int, int, int)
 
typedef int(AILIA_VOICE_USER_APIAILIA_VOICE_USER_API_AILIA_CREATE) (struct AILIANetwork **, int, int)
 
typedef int(AILIA_VOICE_USER_APIAILIA_VOICE_USER_API_AILIA_OPEN_WEIGHT_FILE_A) (struct AILIANetwork *, const char *)
 
typedef int(AILIA_VOICE_USER_APIAILIA_VOICE_USER_API_AILIA_OPEN_WEIGHT_FILE_W) (struct AILIANetwork *, const wchar_t *)
 
typedef int(AILIA_VOICE_USER_APIAILIA_VOICE_USER_API_AILIA_OPEN_WEIGHT_MEM) (struct AILIANetwork *, const void *, unsigned int)
 
typedef int(AILIA_VOICE_USER_APIAILIA_VOICE_USER_API_AILIA_SET_MEMORY_MODE) (struct AILIANetwork *, unsigned int)
 
typedef void(AILIA_VOICE_USER_APIAILIA_VOICE_USER_API_AILIA_DESTROY) (struct AILIANetwork *)
 
typedef int(AILIA_VOICE_USER_APIAILIA_VOICE_USER_API_AILIA_UPDATE) (struct AILIANetwork *)
 
typedef int(AILIA_VOICE_USER_APIAILIA_VOICE_USER_API_AILIA_GET_BLOB_INDEX_BY_INPUT_INDEX) (struct AILIANetwork *, unsigned int *, unsigned int)
 
typedef int(AILIA_VOICE_USER_APIAILIA_VOICE_USER_API_AILIA_GET_BLOB_INDEX_BY_OUTPUT_INDEX) (struct AILIANetwork *, unsigned int *, unsigned int)
 
typedef int(AILIA_VOICE_USER_APIAILIA_VOICE_USER_API_AILIA_GET_BLOB_DATA) (struct AILIANetwork *, void *, unsigned int, unsigned int)
 
typedef int(AILIA_VOICE_USER_APIAILIA_VOICE_USER_API_AILIA_SET_INPUT_BLOB_DATA) (struct AILIANetwork *, const void *, unsigned int, unsigned int)
 
typedef int(AILIA_VOICE_USER_APIAILIA_VOICE_USER_API_AILIA_SET_INPUT_BLOB_SHAPE) (struct AILIANetwork *, const AILIAShape *, unsigned int, unsigned int)
 
typedef int(AILIA_VOICE_USER_APIAILIA_VOICE_USER_API_AILIA_GET_BLOB_SHAPE) (struct AILIANetwork *, AILIAShape *, unsigned int, unsigned int)
 
typedef int(AILIA_VOICE_USER_APIAILIA_VOICE_USER_API_AILIA_GET_INPUT_BLOB_COUNT) (struct AILIANetwork *, unsigned int *)
 
typedef int(AILIA_VOICE_USER_APIAILIA_VOICE_USER_API_AILIA_GET_OUTPUT_BLOB_COUNT) (struct AILIANetwork *, unsigned int *)
 
typedef struct _AILIAVoiceApiCallback AILIAVoiceApiCallback
 

Functions

const typedef char *AILIA_VOICE_USER_APIAILIA_VOICE_USER_API_AILIA_GET_ERROR_DETAIL (struct AILIANetwork *)
 
int AILIA_API ailiaVoiceCreate (struct AILIAVoice **net, int env_id, int num_thread, int memory_mode, int flags, AILIAVoiceApiCallback callback, int version)
 Creates a Voice instance. More...
 
int AILIA_API ailiaVoiceOpenDictionaryFileA (struct AILIAVoice *net, const char *dictionary_path, int dictionary_type)
 Set dictionary into a network instance. More...
 
int AILIA_API ailiaVoiceOpenDictionaryFileW (struct AILIAVoice *net, const wchar_t *dictionary_path, int dictionary_type)
 Set dictionary into a network instance. More...
 
int AILIA_API ailiaVoiceOpenModelFileA (struct AILIAVoice *net, const char *encoder, const char *decoder1, const char *decoder2, const char *wave, const char *ssl, int model_type, int cleaner_type)
 Set models into a network instance. More...
 
int AILIA_API ailiaVoiceOpenModelFileW (struct AILIAVoice *net, const wchar_t *encoder, const wchar_t *decoder1, const wchar_t *decoder2, const wchar_t *wave, const wchar_t *ssl, int model_type, int cleaner_type)
 Set models into a network instance. More...
 
int AILIA_API ailiaVoiceGraphemeToPhoneme (struct AILIAVoice *net, const char *utf8, int g2p_type)
 Perform g2p. More...
 
int AILIA_API ailiaVoiceExtractFullContext (struct AILIAVoice *net, const char *utf8)
 Perform ExtractFullContext. More...
 
int AILIA_API ailiaVoiceGetFeatureLength (struct AILIAVoice *net, unsigned int *len)
 Gets the size of features. (Include null) More...
 
int AILIA_API ailiaVoiceGetFeatures (struct AILIAVoice *net, char *features, unsigned int len)
 Gets the decoded features. More...
 
int AILIA_API ailiaVoiceSetReference (struct AILIAVoice *net, float *buf, unsigned int buf_size, unsigned int channels, unsigned int sampling_rate, const char *features)
 Set the waveform and text as references for zero-shot voice synthesis. More...
 
int AILIA_API ailiaVoiceInference (struct AILIAVoice *net, const char *utf8)
 Perform inference. More...
 
int AILIA_API ailiaVoiceGetWaveInfo (struct AILIAVoice *net, unsigned int *samples, unsigned int *channels, unsigned int *sampling_rate)
 Gets the information of wave. More...
 
int AILIA_API ailiaVoiceGetWave (struct AILIAVoice *net, float *buf, unsigned int buf_size)
 Gets the decoded features. More...
 
void AILIA_API ailiaVoiceDestroy (struct AILIAVoice *net)
 It destroys the Voice instance. More...
 
const char *AILIA_API ailiaVoiceGetErrorDetail (struct AILIAVoice *net)
 Returns the details of errors. More...
 

Macro Definition Documentation

◆ AILIA_API

#define AILIA_API   __stdcall

◆ AILIA_VOICE_API_CALLBACK_VERSION

#define AILIA_VOICE_API_CALLBACK_VERSION   (1)

Struct version.

◆ AILIA_VOICE_CLEANER_TYPE_BASIC

#define AILIA_VOICE_CLEANER_TYPE_BASIC   (0)

BasicCleaner.

◆ AILIA_VOICE_CLEANER_TYPE_ENGLISH

#define AILIA_VOICE_CLEANER_TYPE_ENGLISH   (1)

EnglishCleaner.

◆ AILIA_VOICE_DICTIONARY_TYPE_G2P_EN

#define AILIA_VOICE_DICTIONARY_TYPE_G2P_EN   (1)

Format for G2P_EN.

◆ AILIA_VOICE_DICTIONARY_TYPE_OPEN_JTALK

#define AILIA_VOICE_DICTIONARY_TYPE_OPEN_JTALK   (0)

Format for OpenJTalk.

◆ AILIA_VOICE_FLAG_NONE

#define AILIA_VOICE_FLAG_NONE   (0)

Default flag.

◆ AILIA_VOICE_G2P_TYPE_GPT_SOVITS_EN

#define AILIA_VOICE_G2P_TYPE_GPT_SOVITS_EN   (1)

GPT SOVITS English.

◆ AILIA_VOICE_G2P_TYPE_GPT_SOVITS_JA

#define AILIA_VOICE_G2P_TYPE_GPT_SOVITS_JA   (2)

GPT SOVITS Japanese.

◆ AILIA_VOICE_MODEL_TYPE_GPT_SOVITS

#define AILIA_VOICE_MODEL_TYPE_GPT_SOVITS   (1)

Format for GPT-SoVITS.

◆ AILIA_VOICE_MODEL_TYPE_TACOTRON2

#define AILIA_VOICE_MODEL_TYPE_TACOTRON2   (0)

Format for Tacotron2.

◆ AILIA_VOICE_TEXT_POST_PROCESS_APPEND_PUNCTUATION

#define AILIA_VOICE_TEXT_POST_PROCESS_APPEND_PUNCTUATION   (2)

◆ AILIA_VOICE_USER_API

#define AILIA_VOICE_USER_API

◆ ailiaVoiceOpenDictionaryFile

#define ailiaVoiceOpenDictionaryFile   ailiaVoiceOpenDictionaryFileW

◆ ailiaVoiceOpenModelFile

#define ailiaVoiceOpenModelFile   ailiaVoiceOpenModelFileW

Typedef Documentation

◆ AILIA_VOICE_USER_API_AILIA_AUDIO_GET_RESAMPLE_LEN

typedef int(AILIA_VOICE_USER_API* AILIA_VOICE_USER_API_AILIA_AUDIO_GET_RESAMPLE_LEN) (int *, int, int, int)

◆ AILIA_VOICE_USER_API_AILIA_AUDIO_RESAMPLE

typedef int(AILIA_VOICE_USER_API* AILIA_VOICE_USER_API_AILIA_AUDIO_RESAMPLE) (void *, const void *, int, int, int, int)

◆ AILIA_VOICE_USER_API_AILIA_CREATE

typedef int(AILIA_VOICE_USER_API* AILIA_VOICE_USER_API_AILIA_CREATE) (struct AILIANetwork **, int, int)

◆ AILIA_VOICE_USER_API_AILIA_DESTROY

typedef void(AILIA_VOICE_USER_API* AILIA_VOICE_USER_API_AILIA_DESTROY) (struct AILIANetwork *)

◆ AILIA_VOICE_USER_API_AILIA_GET_BLOB_DATA

typedef int(AILIA_VOICE_USER_API* AILIA_VOICE_USER_API_AILIA_GET_BLOB_DATA) (struct AILIANetwork *, void *, unsigned int, unsigned int)

◆ AILIA_VOICE_USER_API_AILIA_GET_BLOB_INDEX_BY_INPUT_INDEX

typedef int(AILIA_VOICE_USER_API* AILIA_VOICE_USER_API_AILIA_GET_BLOB_INDEX_BY_INPUT_INDEX) (struct AILIANetwork *, unsigned int *, unsigned int)

◆ AILIA_VOICE_USER_API_AILIA_GET_BLOB_INDEX_BY_OUTPUT_INDEX

typedef int(AILIA_VOICE_USER_API* AILIA_VOICE_USER_API_AILIA_GET_BLOB_INDEX_BY_OUTPUT_INDEX) (struct AILIANetwork *, unsigned int *, unsigned int)

◆ AILIA_VOICE_USER_API_AILIA_GET_BLOB_SHAPE

typedef int(AILIA_VOICE_USER_API* AILIA_VOICE_USER_API_AILIA_GET_BLOB_SHAPE) (struct AILIANetwork *, AILIAShape *, unsigned int, unsigned int)

◆ AILIA_VOICE_USER_API_AILIA_GET_INPUT_BLOB_COUNT

typedef int(AILIA_VOICE_USER_API* AILIA_VOICE_USER_API_AILIA_GET_INPUT_BLOB_COUNT) (struct AILIANetwork *, unsigned int *)

◆ AILIA_VOICE_USER_API_AILIA_GET_OUTPUT_BLOB_COUNT

typedef int(AILIA_VOICE_USER_API* AILIA_VOICE_USER_API_AILIA_GET_OUTPUT_BLOB_COUNT) (struct AILIANetwork *, unsigned int *)

◆ AILIA_VOICE_USER_API_AILIA_OPEN_WEIGHT_FILE_A

typedef int(AILIA_VOICE_USER_API* AILIA_VOICE_USER_API_AILIA_OPEN_WEIGHT_FILE_A) (struct AILIANetwork *, const char *)

◆ AILIA_VOICE_USER_API_AILIA_OPEN_WEIGHT_FILE_W

typedef int(AILIA_VOICE_USER_API* AILIA_VOICE_USER_API_AILIA_OPEN_WEIGHT_FILE_W) (struct AILIANetwork *, const wchar_t *)

◆ AILIA_VOICE_USER_API_AILIA_OPEN_WEIGHT_MEM

typedef int(AILIA_VOICE_USER_API* AILIA_VOICE_USER_API_AILIA_OPEN_WEIGHT_MEM) (struct AILIANetwork *, const void *, unsigned int)

◆ AILIA_VOICE_USER_API_AILIA_SET_INPUT_BLOB_DATA

typedef int(AILIA_VOICE_USER_API* AILIA_VOICE_USER_API_AILIA_SET_INPUT_BLOB_DATA) (struct AILIANetwork *, const void *, unsigned int, unsigned int)

◆ AILIA_VOICE_USER_API_AILIA_SET_INPUT_BLOB_SHAPE

typedef int(AILIA_VOICE_USER_API* AILIA_VOICE_USER_API_AILIA_SET_INPUT_BLOB_SHAPE) (struct AILIANetwork *, const AILIAShape *, unsigned int, unsigned int)

◆ AILIA_VOICE_USER_API_AILIA_SET_MEMORY_MODE

typedef int(AILIA_VOICE_USER_API* AILIA_VOICE_USER_API_AILIA_SET_MEMORY_MODE) (struct AILIANetwork *, unsigned int)

◆ AILIA_VOICE_USER_API_AILIA_UPDATE

typedef int(AILIA_VOICE_USER_API* AILIA_VOICE_USER_API_AILIA_UPDATE) (struct AILIANetwork *)

◆ AILIAVoiceApiCallback

Function Documentation

◆ AILIA_VOICE_USER_API_AILIA_GET_ERROR_DETAIL()

const typedef char* AILIA_VOICE_USER_API* AILIA_VOICE_USER_API_AILIA_GET_ERROR_DETAIL ( struct AILIANetwork *  )

◆ ailiaVoiceCreate()

int AILIA_API ailiaVoiceCreate ( struct AILIAVoice **  net,
int  env_id,
int  num_thread,
int  memory_mode,
int  flags,
AILIAVoiceApiCallback  callback,
int  version 
)

Creates a Voice instance.

Parameters
netA pointer to the Voice instance pointer
env_idThe ID of the inference backend used for computation (obtained by ailiaGetEnvironment() ). It is selected automatically if AILIA_ENVIRONMENT_ID_AUTO is specified.
num_threadThe upper limit on the number of threads (It is set automatically if AILIA_MULTITHREAD_AUTO
memory_modeThe memory mode (AILIA_MEMORY_MODE_*)
flagOR of AILIA_Voice_FLAG_*
api_callbackThe callback for ailia API
versionAILIA_VOICE_API_CALLBACK_VERSION is specified.)
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

Creates a Voice instance.

◆ ailiaVoiceDestroy()

void AILIA_API ailiaVoiceDestroy ( struct AILIAVoice *  net)

It destroys the Voice instance.

Parameters
netA Voice instance pointer

◆ ailiaVoiceExtractFullContext()

int AILIA_API ailiaVoiceExtractFullContext ( struct AILIAVoice *  net,
const char *  utf8 
)

Perform ExtractFullContext.

Parameters
netA Voice instance pointer
textText (UTF8)
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

Get the result with ailiaVoiceGetFeatures API.

◆ ailiaVoiceGetErrorDetail()

const char* AILIA_API ailiaVoiceGetErrorDetail ( struct AILIAVoice *  net)

Returns the details of errors.

Parameters
netThe network instance pointer
Returns
Error details

The return value does not have to be released. The string is valid until the next ailiaVoice API function is called.

◆ ailiaVoiceGetFeatureLength()

int AILIA_API ailiaVoiceGetFeatureLength ( struct AILIAVoice *  net,
unsigned int *  len 
)

Gets the size of features. (Include null)

Parameters
netA Voice instance pointer
lenThe length of features
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

◆ ailiaVoiceGetFeatures()

int AILIA_API ailiaVoiceGetFeatures ( struct AILIAVoice *  net,
char *  features,
unsigned int  len 
)

Gets the decoded features.

Parameters
netA Voice instance pointer
featuresFeatures(UTF8)
lenThe length of features
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

If ailiaVoiceGraphemeToPhoneme() or ailiaVoiceExtractFullContext() is not run at all, the function returns AILIA_STATUS_INVALID_STATE .

◆ ailiaVoiceGetWave()

int AILIA_API ailiaVoiceGetWave ( struct AILIAVoice *  net,
float *  buf,
unsigned int  buf_size 
)

Gets the decoded features.

Parameters
netA Voice instance pointer
bufPCM Wave (Normalized by 0 - 1)
buf_sizeBuffer size (Byte unit)
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

If ailiaVoiceInference() is not run at all, the function returns AILIA_STATUS_INVALID_STATE .

◆ ailiaVoiceGetWaveInfo()

int AILIA_API ailiaVoiceGetWaveInfo ( struct AILIAVoice *  net,
unsigned int *  samples,
unsigned int *  channels,
unsigned int *  sampling_rate 
)

Gets the information of wave.

Parameters
netA Voice instance pointer
samplesNumber of samples (per channel)
channelsNumber of channels
sampling_rateSampling rate
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

◆ ailiaVoiceGraphemeToPhoneme()

int AILIA_API ailiaVoiceGraphemeToPhoneme ( struct AILIAVoice *  net,
const char *  utf8,
int  g2p_type 
)

Perform g2p.

Parameters
netA Voice instance pointer
textText(UTF8)
g2p_typeAILIA_VOICE_G2P_TYPE_*
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

Get the result with ailiaVoiceGetFeatures API.

◆ ailiaVoiceInference()

int AILIA_API ailiaVoiceInference ( struct AILIAVoice *  net,
const char *  utf8 
)

Perform inference.

Parameters
netA Voice instance pointer
textText(UTF8)
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

Get the result with ailiaVoiceGetWave API.

◆ ailiaVoiceOpenDictionaryFileA()

int AILIA_API ailiaVoiceOpenDictionaryFileA ( struct AILIAVoice *  net,
const char *  dictionary_path,
int  dictionary_type 
)

Set dictionary into a network instance.

Parameters
netA network instance pointer
dictionary_pathThe path name to the dictionary folder (MBSC)
dictionary_typeAILIA_VOICE_DICTIONARY_TYPE_*
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

◆ ailiaVoiceOpenDictionaryFileW()

int AILIA_API ailiaVoiceOpenDictionaryFileW ( struct AILIAVoice *  net,
const wchar_t *  dictionary_path,
int  dictionary_type 
)

Set dictionary into a network instance.

Parameters
netA network instance pointer
dictionary_pathThe path name to the dictionary folder (UTF16)
dictionary_typeAILIA_VOICE_DICTIONARY_TYPE_*
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

◆ ailiaVoiceOpenModelFileA()

int AILIA_API ailiaVoiceOpenModelFileA ( struct AILIAVoice *  net,
const char *  encoder,
const char *  decoder1,
const char *  decoder2,
const char *  wave,
const char *  ssl,
int  model_type,
int  cleaner_type 
)

Set models into a network instance.

Parameters
netA network instance pointer
encoderThe path name to the onnx file (MBSC)
decoder1The path name to the onnx file (MBSC)
decoder2The path name to the onnx file (MBSC)
waveThe path name to the onnx file (MBSC)
sslThe path name to the onnx file (MBSC)
model_typeAILIA_VOICE_MODEL_TYPE_*
cleaner_typeAILIA_VOICE_CLEANER_TYPE_*
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

◆ ailiaVoiceOpenModelFileW()

int AILIA_API ailiaVoiceOpenModelFileW ( struct AILIAVoice *  net,
const wchar_t *  encoder,
const wchar_t *  decoder1,
const wchar_t *  decoder2,
const wchar_t *  wave,
const wchar_t *  ssl,
int  model_type,
int  cleaner_type 
)

Set models into a network instance.

Parameters
netA network instance pointer
encoderThe path name to the onnx file (UTF16)
decoder1The path name to the onnx file (UTF16)
decoder2The path name to the onnx file (UTF16)
waveThe path name to the onnx file (UTF16)
sslThe path name to the onnx file (UTF16)
model_typeAILIA_VOICE_MODEL_TYPE_*
cleaner_typeAILIA_VOICE_CLEANER_TYPE_*
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

◆ ailiaVoiceSetReference()

int AILIA_API ailiaVoiceSetReference ( struct AILIAVoice *  net,
float *  buf,
unsigned int  buf_size,
unsigned int  channels,
unsigned int  sampling_rate,
const char *  features 
)

Set the waveform and text as references for zero-shot voice synthesis.

Parameters
netA Voice instance pointer
bufPCM Wave (Normalized by 0 - 1)
buf_sizebuffer size (byte unit)
channelsnum channels
sampling_ratesampling rate
featuresFeature (UTF8)
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.