|
int | GetEnvironmentId (bool is_gpu) |
| Get the environmen id. More...
|
|
string | GetEnvironmentName () |
| Get the environmen name. More...
|
|
bool | Create (int env_id, int flag) |
| Create a instance. More...
|
|
bool | SetUserDictionary (string dict_path, int dict_type) |
| Set user dictionary file. More...
|
|
bool | OpenDictionary (string dict_path, int dict_type) |
| Set dictionary path. More...
|
|
bool | OpenModel (string encoder, string decoder1, string decoder2, string wave, string ssl, int model_type, int cleaner_type) |
|
virtual void | Close () |
| Destroys instance. More...
|
|
virtual void | Dispose () |
| Release resources. More...
|
|
string | G2P (string utf8, int g2p_type) |
| Get features. More...
|
|
bool | SetReference (AudioClip ref_audio, string ref_text) |
| Set reference audio. More...
|
|
bool | Inference (string feature) |
| Perform inference. More...
|
|
AudioClip | GetAudioClip () |
| Get audio clip. More...
|
|
|
virtual void | Dispose (bool disposing) |
|
◆ Close()
virtual void ailiaVoice.AiliaVoiceModel.Close |
( |
| ) |
|
|
inlinevirtual |
Destroys instance.
Destroys and initializes the instance.
230 if (net != IntPtr.Zero){
231 AiliaVoice.ailiaVoiceDestroy(net);
◆ Create()
bool ailiaVoice.AiliaVoiceModel.Create |
( |
int |
env_id, |
|
|
int |
flag |
|
) |
| |
|
inline |
Create a instance.
- Parameters
-
env_id | Environment ID of ailia |
flag | OR of flags (AiliaVoice.AILIA_VOICE_FLAG_*) |
- Returns
- If this function is successful, it returns true , or false otherwise.
104 AiliaVoice.AILIAVoiceApiCallback callback = AiliaVoice.GetCallback();
106 int memory_mode = Ailia.AILIA_MEMORY_REDUCE_CONSTANT | Ailia.AILIA_MEMORY_REDUCE_CONSTANT_WITH_INPUT_INITIALIZER | Ailia.AILIA_MEMORY_REUSE_INTERSTAGE;
107 int status = AiliaVoice.ailiaVoiceCreate(ref net, env_id, Ailia.AILIA_MULTITHREAD_AUTO, memory_mode, flag, callback, AiliaVoice.AILIA_VOICE_API_CALLBACK_VERSION);
110 Debug.Log(
"ailiaVoiceCreate failed " + status);
◆ Dispose() [1/2]
virtual void ailiaVoice.AiliaVoiceModel.Dispose |
( |
| ) |
|
|
inlinevirtual |
◆ Dispose() [2/2]
virtual void ailiaVoice.AiliaVoiceModel.Dispose |
( |
bool |
disposing | ) |
|
|
inlineprotectedvirtual |
◆ G2P()
string ailiaVoice.AiliaVoiceModel.G2P |
( |
string |
utf8, |
|
|
int |
g2p_type |
|
) |
| |
|
inline |
Get features.
- Parameters
-
utf8 | Input string |
g2p_type | G2P type |
- Returns
- If this function is successful, it returns string , or empty string otherwise.
280 byte[] text = System.Text.Encoding.UTF8.GetBytes(utf8+
"\u0000");
282 GCHandle handle = GCHandle.Alloc(text, GCHandleType.Pinned);
283 IntPtr input = handle.AddrOfPinnedObject();
284 int status = AiliaVoice.ailiaVoiceGraphemeToPhoneme(net, input, g2p_type);
288 Debug.Log(
"ailiaVoiceGraphemeToPhoneme faield " + status);
293 status = AiliaVoice.ailiaVoiceGetFeatureLength(net, ref count);
296 Debug.Log(
"ailiaVoiceGetFeatureLength faield " + status);
300 byte[] texts =
new byte [count];
301 handle = GCHandle.Alloc(texts, GCHandleType.Pinned);
302 IntPtr output = handle.AddrOfPinnedObject();
303 status = AiliaVoice.ailiaVoiceGetFeatures(net, output, count);
307 Debug.Log(
"ailiaVoiceGetFeatures faield " + status);
311 return System.Text.Encoding.UTF8.GetString(texts);
◆ GetAudioClip()
AudioClip ailiaVoice.AiliaVoiceModel.GetAudioClip |
( |
| ) |
|
|
inline |
Get audio clip.
- Returns
- If this function is successful, it returns AudioClip , or null otherwise.
419 AudioClip audioClip = AudioClip.Create(audio_clip_name, audio_data.Length, (
int)channels, (
int)sampling_rate,
false);
420 audioClip.SetData(audio_data, 0);
◆ GetEnvironmentId()
int ailiaVoice.AiliaVoiceModel.GetEnvironmentId |
( |
bool |
is_gpu | ) |
|
|
inline |
Get the environmen id.
- Parameters
-
- Returns
- env_id
45 int env_id = Ailia.AILIA_ENVIRONMENT_ID_AUTO;
48 Ailia.ailiaGetEnvironmentCount(ref count);
49 for (
int i = 0; i < count; i++){
50 IntPtr env_ptr = IntPtr.Zero;
51 Ailia.ailiaGetEnvironment(ref env_ptr, (uint)i, Ailia.AILIA_ENVIRONMENT_VERSION);
52 Ailia.AILIAEnvironment env = (Ailia.AILIAEnvironment)Marshal.PtrToStructure(env_ptr, typeof(Ailia.AILIAEnvironment));
54 if (env.backend == Ailia.AILIA_ENVIRONMENT_BACKEND_MPS || env.backend == Ailia.AILIA_ENVIRONMENT_BACKEND_CUDA || env.backend == Ailia.AILIA_ENVIRONMENT_BACKEND_VULKAN){
56 env_name = Marshal.PtrToStringAnsi(env.name);
◆ GetEnvironmentName()
string ailiaVoice.AiliaVoiceModel.GetEnvironmentName |
( |
| ) |
|
|
inline |
Get the environmen name.
- Returns
- env_name
◆ Inference()
bool ailiaVoice.AiliaVoiceModel.Inference |
( |
string |
feature | ) |
|
|
inline |
Perform inference.
- Parameters
-
feature | Input feature string |
- Returns
- If this function is successful, it returns true , or false otherwise.
369 byte[] text = System.Text.Encoding.UTF8.GetBytes(feature);
370 GCHandle handle = GCHandle.Alloc(text, GCHandleType.Pinned);
371 IntPtr input = handle.AddrOfPinnedObject();
372 int status = AiliaVoice.ailiaVoiceInference(net, input);
376 Debug.Log(
"ailiaVoiceInference faield " + status);
380 status = AiliaVoice.ailiaVoiceGetWaveInfo(net, ref samples, ref channels, ref sampling_rate);
383 Debug.Log(
"ailiaVoiceGetWaveInfo faield " + status);
388 uint count = samples * channels;
389 audio_data =
new float [count];
390 handle = GCHandle.Alloc(audio_data, GCHandleType.Pinned);
391 IntPtr output = handle.AddrOfPinnedObject();
392 status = AiliaVoice.ailiaVoiceGetWave(net, output, count *
sizeof(
float));
396 Debug.Log(
"ailiaVoiceGetWave faield " + status);
401 audio_clip_name = feature;
◆ OpenDictionary()
bool ailiaVoice.AiliaVoiceModel.OpenDictionary |
( |
string |
dict_path, |
|
|
int |
dict_type |
|
) |
| |
|
inline |
Set dictionary path.
- Parameters
-
net | A network instance pointer |
dictionary_path | The path name to the dictionary folder |
dictionary_type | AILIA_VOICE_DICTIONARY_TYPE_* |
- Returns
- If this function is successful, it returns true , or false otherwise.
166 int status = AiliaVoice.ailiaVoiceOpenDictionaryFile(net, dict_path, dict_type);
169 Debug.Log(
"ailiaVoiceOpenDictionaryFile faield " + status);
◆ OpenModel()
bool ailiaVoice.AiliaVoiceModel.OpenModel |
( |
string |
encoder, |
|
|
string |
decoder1, |
|
|
string |
decoder2, |
|
|
string |
wave, |
|
|
string |
ssl, |
|
|
int |
model_type, |
|
|
int |
cleaner_type |
|
) |
| |
|
inline |
- Parameters
-
net | A network instance pointer |
encoder | The path name to the onnx file |
decoder1 | The path name to the onnx file |
decoder2 | The path name to the onnx file |
wave | The path name to the onnx file |
ssl | The path name to the onnx file |
model_type | AILIA_VOICE_MODEL_TYPE_* |
cleaner_type | AILIA_VOICE_CLEANER_TYPE_* |
- Returns
- If this function is successful, it returns true , or false otherwise.
202 AiliaLicense.CheckAndDownloadLicense();
204 int status = AiliaVoice.ailiaVoiceOpenModelFile(net, encoder, decoder1, decoder2, wave, ssl, model_type, cleaner_type);
207 Debug.Log(
"ailiaVoiceOpenModelFile faield " + status);
◆ SetReference()
bool ailiaVoice.AiliaVoiceModel.SetReference |
( |
AudioClip |
ref_audio, |
|
|
string |
ref_text |
|
) |
| |
|
inline |
Set reference audio.
- Parameters
-
ref_audio | Reference audio |
ref_text | Reference text |
- Returns
- If this function is successful, it returns AudioClip , or null otherwise.
331 float[] audio_data =
new float[ref_audio.samples * ref_audio.channels];
332 ref_audio.GetData(audio_data, 0);
334 GCHandle audio_handle = GCHandle.Alloc(audio_data, GCHandleType.Pinned);
335 IntPtr audio_input = audio_handle.AddrOfPinnedObject();
337 byte[] text = System.Text.Encoding.UTF8.GetBytes(ref_text);
338 GCHandle text_handle = GCHandle.Alloc(text, GCHandleType.Pinned);
339 IntPtr text_input = text_handle.AddrOfPinnedObject();
340 int status = AiliaVoice.ailiaVoiceSetReference(net, audio_input, (uint)(ref_audio.samples * ref_audio.channels * 4), (uint)(ref_audio.channels), (uint)(ref_audio.frequency), text_input);
346 Debug.Log(
"ailiaVoiceSetReference faield " + status);
◆ SetUserDictionary()
bool ailiaVoice.AiliaVoiceModel.SetUserDictionary |
( |
string |
dict_path, |
|
|
int |
dict_type |
|
) |
| |
|
inline |
Set user dictionary file.
- Parameters
-
net | A network instance pointer |
dictionary_path | The path name to the user dictionary file |
dictionary_type | AILIA_VOICE_DICTIONARY_TYPE_* |
- Returns
- If this function is successful, it returns true , or false otherwise.
You need to call before OpenDictionary.
139 int status = AiliaVoice.ailiaVoiceSetUserDictionaryFile(net, dict_path, dict_type);
142 Debug.Log(
"ailiaVoiceSetUserDictionaryFile faield " + status);
The documentation for this class was generated from the following file: