Skip to content

Commit

Permalink
Update sample usage
Browse files Browse the repository at this point in the history
  • Loading branch information
kyakuno committed Jun 29, 2024
1 parent 391c8fe commit 89b7c4b
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 32 deletions.
47 changes: 33 additions & 14 deletions supplemental/voice/cpp/en/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ <h2><a class="anchor" id="autotoc_md4"></a>
<div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> *argv[]){</div>
<div class="line"> <a class="code" href="struct__AILIAVoiceApiCallback.html">AILIAVoiceApiCallback</a> callback = ailiaVoiceUtilGetCallback();</div>
<div class="line"> </div>
<div class="line"> printf(<span class="stringliteral">&quot;Usage : ailia_voice_sample [tacotron2/gpt-sovits] [input_text]\n&quot;</span>);</div>
<div class="line"> printf(<span class="stringliteral">&quot;Usage : ailia_voice_sample [tacotron2/gpt-sovits/gpt-sovits-en] [input_text]\n&quot;</span>);</div>
<div class="line"> </div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> * input_text = <span class="stringliteral">&quot;&quot;</span>;</div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> * lang = <span class="stringliteral">&quot;&quot;</span>;</div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> * model = <span class="stringliteral">&quot;tacotron2&quot;</span>;</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">if</span> (argc &gt;= 2){</div>
<div class="line"> model = argv[1];</div>
<div class="line"> <span class="keywordflow">if</span> (!(strcmp(model, <span class="stringliteral">&quot;tacotron2&quot;</span>) == 0 || strcmp(model, <span class="stringliteral">&quot;gpt-sovits&quot;</span>)==0)){</div>
<div class="line"> <span class="keywordflow">if</span> (!(strcmp(model, <span class="stringliteral">&quot;tacotron2&quot;</span>) == 0 || strcmp(model, <span class="stringliteral">&quot;gpt-sovits&quot;</span>) == 0 || strcmp(model, <span class="stringliteral">&quot;gpt-sovits-en&quot;</span>) == 0)){</div>
<div class="line"> printf(<span class="stringliteral">&quot;model must be tacotron2 or gpt-sovits\n&quot;</span>);</div>
<div class="line"> <span class="keywordflow">return</span> -1;</div>
<div class="line"> }</div>
Expand All @@ -102,11 +102,15 @@ <h2><a class="anchor" id="autotoc_md4"></a>
<div class="line"> input_text = argv[2];</div>
<div class="line"> }</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">if</span> (strcmp(model, <span class="stringliteral">&quot;tacotron2&quot;</span>) == 0 ){</div>
<div class="line"> input_text = u8<span class="stringliteral">&quot;Hello world.&quot;</span>;</div>
<div class="line"> <span class="keywordflow">if</span> (strcmp(model, <span class="stringliteral">&quot;tacotron2&quot;</span>) == 0 || strcmp(model, <span class="stringliteral">&quot;gpt-sovits-en&quot;</span>) == 0 ){</div>
<div class="line"> <span class="keywordflow">if</span> (strlen(input_text) == 0){</div>
<div class="line"> input_text = u8<span class="stringliteral">&quot;Hello world.&quot;</span>;</div>
<div class="line"> }</div>
<div class="line"> lang = <span class="stringliteral">&quot;en&quot;</span>;</div>
<div class="line"> }<span class="keywordflow">else</span>{</div>
<div class="line"> input_text = u8<span class="stringliteral">&quot;こんにちは。今日は新しいAIエンジンであるアイリアSDKを紹介します。&quot;</span>;</div>
<div class="line"> <span class="keywordflow">if</span> (strlen(input_text) == 0){</div>
<div class="line"> input_text = u8<span class="stringliteral">&quot;こんにちは。今日は新しいAIエンジンであるアイリアSDKを紹介します。&quot;</span>;</div>
<div class="line"> }</div>
<div class="line"> lang = <span class="stringliteral">&quot;ja&quot;</span>;</div>
<div class="line"> }</div>
<div class="line"> </div>
Expand All @@ -123,10 +127,19 @@ <h2><a class="anchor" id="autotoc_md4"></a>
<div class="line"> printf(<span class="stringliteral">&quot;ailiaVoiceCreate error %d\n&quot;</span>, status);</div>
<div class="line"> <span class="keywordflow">return</span> -1;</div>
<div class="line"> }</div>
<div class="line"> status = <a class="code" href="ailia__voice_8h.html#a9dfa5dcce326c5101e95ffe17b2bd22a">ailiaVoiceOpenDictionaryFileA</a>(net, <span class="stringliteral">&quot;./open_jtalk_dic_utf_8-1.11&quot;</span>, <a class="code" href="ailia__voice_8h.html#a167cea63ac188c2b1a6f7a2fd7793165">AILIA_VOICE_DICTIONARY_TYPE_OPEN_JTALK</a>);</div>
<div class="line"> <span class="keywordflow">if</span> (status != AILIA_STATUS_SUCCESS){</div>
<div class="line"> printf(<span class="stringliteral">&quot;ailiaVoiceOpenDictionaryFileA error %d\n&quot;</span>, status);</div>
<div class="line"> <span class="keywordflow">return</span> -1;</div>
<div class="line"> <span class="keywordflow">if</span> (strcmp(model, <span class="stringliteral">&quot;gpt-sovits&quot;</span>) == 0 || strcmp(model, <span class="stringliteral">&quot;gpt-sovits-en&quot;</span>) == 0){</div>
<div class="line"> status = <a class="code" href="ailia__voice_8h.html#a9dfa5dcce326c5101e95ffe17b2bd22a">ailiaVoiceOpenDictionaryFileA</a>(net, <span class="stringliteral">&quot;./open_jtalk_dic_utf_8-1.11&quot;</span>, <a class="code" href="ailia__voice_8h.html#a167cea63ac188c2b1a6f7a2fd7793165">AILIA_VOICE_DICTIONARY_TYPE_OPEN_JTALK</a>);</div>
<div class="line"> <span class="keywordflow">if</span> (status != AILIA_STATUS_SUCCESS){</div>
<div class="line"> printf(<span class="stringliteral">&quot;ailiaVoiceOpenDictionaryFileA error %d\n&quot;</span>, status);</div>
<div class="line"> <span class="keywordflow">return</span> -1;</div>
<div class="line"> }</div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">if</span> (strcmp(model, <span class="stringliteral">&quot;gpt-sovits-en&quot;</span>) == 0){</div>
<div class="line"> status = <a class="code" href="ailia__voice_8h.html#a9dfa5dcce326c5101e95ffe17b2bd22a">ailiaVoiceOpenDictionaryFileA</a>(net, <span class="stringliteral">&quot;../onnx/g2p_en&quot;</span>, <a class="code" href="ailia__voice_8h.html#aaaa63379372f4c0497289609b9c46586">AILIA_VOICE_DICTIONARY_TYPE_G2P_EN</a>);</div>
<div class="line"> <span class="keywordflow">if</span> (status != AILIA_STATUS_SUCCESS){</div>
<div class="line"> printf(<span class="stringliteral">&quot;ailiaVoiceOpenDictionaryFileA error %d\n&quot;</span>, status);</div>
<div class="line"> <span class="keywordflow">return</span> -1;</div>
<div class="line"> }</div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">if</span> (strcmp(model, <span class="stringliteral">&quot;tacotron2&quot;</span>) == 0){</div>
<div class="line"> status = <a class="code" href="ailia__voice_8h.html#ac7875fc17c0e6d575cf39122d082fa7d">ailiaVoiceOpenModelFileA</a>(net, <span class="stringliteral">&quot;../onnx/nvidia/encoder.onnx&quot;</span>, <span class="stringliteral">&quot;../onnx/nvidia/decoder_iter.onnx&quot;</span>, <span class="stringliteral">&quot;../onnx/nvidia/postnet.onnx&quot;</span>, <span class="stringliteral">&quot;../onnx/nvidia/waveglow.onnx&quot;</span>, NULL, <a class="code" href="ailia__voice_8h.html#a85d9bc92f2626c22f4d4df164d259fc2">AILIA_VOICE_MODEL_TYPE_TACOTRON2</a>, <a class="code" href="ailia__voice_8h.html#afdc53effb97f51637b01ecaa426f1cf8">AILIA_VOICE_CLEANER_TYPE_BASIC</a>);</div>
Expand All @@ -138,7 +151,7 @@ <h2><a class="anchor" id="autotoc_md4"></a>
<div class="line"> <span class="keywordflow">return</span> -1;</div>
<div class="line"> }</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">if</span> (strcmp(model, <span class="stringliteral">&quot;gpt-sovits&quot;</span>) == 0){</div>
<div class="line"> <span class="keywordflow">if</span> (strcmp(model, <span class="stringliteral">&quot;gpt-sovits&quot;</span>) == 0 || strcmp(model, <span class="stringliteral">&quot;gpt-sovits-en&quot;</span>) == 0){</div>
<div class="line"> <span class="keywordtype">int</span> sampleRate, nChannels, nSamples;</div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *ref_audio = <span class="stringliteral">&quot;../onnx/gpt-sovits/reference_audio_girl.wav&quot;</span>;</div>
<div class="line"> <span class="comment">//const char *ref_audio = &quot;../onnx/gpt-sovits/reference_audio_man.wav&quot;;</span></div>
Expand Down Expand Up @@ -174,8 +187,14 @@ <h2><a class="anchor" id="autotoc_md4"></a>
<div class="line"> </div>
<div class="line"> std::vector&lt;char&gt; features;</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">if</span> (strcmp(lang, <span class="stringliteral">&quot;ja&quot;</span>) == 0){</div>
<div class="line"> status = <a class="code" href="ailia__voice_8h.html#a03c8e8a9d2a51be435f5a1ef92079e12">ailiaVoiceGraphemeToPhoneme</a>(net, input_text, <a class="code" href="ailia__voice_8h.html#a00bb8376e344f90bee5cd28cfe5d92e1">AILIA_VOICE_G2P_TYPE_GPT_SOVITS_JA</a>);</div>
<div class="line"> <span class="keywordflow">if</span> (strcmp(model, <span class="stringliteral">&quot;tacotron2&quot;</span>) == 0){</div>
<div class="line"> status = <a class="code" href="ailia__voice_8h.html#a3f013aceead50fef4ab3ecb69703001e">ailiaVoiceInference</a>(net, input_text);</div>
<div class="line"> }<span class="keywordflow">else</span>{</div>
<div class="line"> <span class="keywordflow">if</span> (strcmp(model, <span class="stringliteral">&quot;gpt-sovits&quot;</span>) == 0){</div>
<div class="line"> status = <a class="code" href="ailia__voice_8h.html#a03c8e8a9d2a51be435f5a1ef92079e12">ailiaVoiceGraphemeToPhoneme</a>(net, input_text, <a class="code" href="ailia__voice_8h.html#a00bb8376e344f90bee5cd28cfe5d92e1">AILIA_VOICE_G2P_TYPE_GPT_SOVITS_JA</a>);</div>
<div class="line"> }<span class="keywordflow">else</span>{</div>
<div class="line"> status = <a class="code" href="ailia__voice_8h.html#a03c8e8a9d2a51be435f5a1ef92079e12">ailiaVoiceGraphemeToPhoneme</a>(net, input_text, <a class="code" href="ailia__voice_8h.html#a28bdb94212ceabcc41331072375e5d2e">AILIA_VOICE_G2P_TYPE_GPT_SOVITS_EN</a>);</div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">if</span> (status != AILIA_STATUS_SUCCESS){</div>
<div class="line"> printf(<span class="stringliteral">&quot;ailiaVoiceGraphemeToPhoneme error %d\n&quot;</span>, status);</div>
<div class="line"> <span class="keywordflow">return</span> -1;</div>
Expand All @@ -194,8 +213,6 @@ <h2><a class="anchor" id="autotoc_md4"></a>
<div class="line"> }</div>
<div class="line"> printf(<span class="stringliteral">&quot;Features : %s\n&quot;</span>, &amp;features[0]);</div>
<div class="line"> status = <a class="code" href="ailia__voice_8h.html#a3f013aceead50fef4ab3ecb69703001e">ailiaVoiceInference</a>(net, &amp;features[0]);</div>
<div class="line"> }<span class="keywordflow">else</span>{</div>
<div class="line"> status = <a class="code" href="ailia__voice_8h.html#a3f013aceead50fef4ab3ecb69703001e">ailiaVoiceInference</a>(net, input_text);</div>
<div class="line"> }</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">if</span> (status != AILIA_STATUS_SUCCESS){</div>
Expand Down Expand Up @@ -240,9 +257,11 @@ <h2><a class="anchor" id="autotoc_md4"></a>
<div class="ttc" id="aailia__voice_8h_html_a7a6bb7d45bcfee6705b622f30a33a246"><div class="ttname"><a href="ailia__voice_8h.html#a7a6bb7d45bcfee6705b622f30a33a246">AILIA_VOICE_FLAG_NONE</a></div><div class="ttdeci">#define AILIA_VOICE_FLAG_NONE</div><div class="ttdoc">Default flag.</div><div class="ttdef"><b>Definition:</b> ailia_voice.h:117</div></div>
<div class="ttc" id="aailia__voice_8h_html_a03c8e8a9d2a51be435f5a1ef92079e12"><div class="ttname"><a href="ailia__voice_8h.html#a03c8e8a9d2a51be435f5a1ef92079e12">ailiaVoiceGraphemeToPhoneme</a></div><div class="ttdeci">int AILIA_API ailiaVoiceGraphemeToPhoneme(struct AILIAVoice *net, const char *utf8, int g2p_type)</div><div class="ttdoc">Perform g2p.</div></div>
<div class="ttc" id="aailia__voice_8h_html_a3f013aceead50fef4ab3ecb69703001e"><div class="ttname"><a href="ailia__voice_8h.html#a3f013aceead50fef4ab3ecb69703001e">ailiaVoiceInference</a></div><div class="ttdeci">int AILIA_API ailiaVoiceInference(struct AILIAVoice *net, const char *utf8)</div><div class="ttdoc">Perform inference.</div></div>
<div class="ttc" id="aailia__voice_8h_html_a28bdb94212ceabcc41331072375e5d2e"><div class="ttname"><a href="ailia__voice_8h.html#a28bdb94212ceabcc41331072375e5d2e">AILIA_VOICE_G2P_TYPE_GPT_SOVITS_EN</a></div><div class="ttdeci">#define AILIA_VOICE_G2P_TYPE_GPT_SOVITS_EN</div><div class="ttdoc">GPT SOVITS English.</div><div class="ttdef"><b>Definition:</b> ailia_voice.h:132</div></div>
<div class="ttc" id="aailia__voice_8h_html_ac7875fc17c0e6d575cf39122d082fa7d"><div class="ttname"><a href="ailia__voice_8h.html#ac7875fc17c0e6d575cf39122d082fa7d">ailiaVoiceOpenModelFileA</a></div><div class="ttdeci">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)</div><div class="ttdoc">Set models into a network instance.</div></div>
<div class="ttc" id="aailia__voice_8h_html_ac43b2f7f50542dab4bd8966620f046b6"><div class="ttname"><a href="ailia__voice_8h.html#ac43b2f7f50542dab4bd8966620f046b6">AILIA_VOICE_MODEL_TYPE_GPT_SOVITS</a></div><div class="ttdeci">#define AILIA_VOICE_MODEL_TYPE_GPT_SOVITS</div><div class="ttdoc">Format for GPT-SoVITS.</div><div class="ttdef"><b>Definition:</b> ailia_voice.h:80</div></div>
<div class="ttc" id="aailia__voice_8h_html_afdc53effb97f51637b01ecaa426f1cf8"><div class="ttname"><a href="ailia__voice_8h.html#afdc53effb97f51637b01ecaa426f1cf8">AILIA_VOICE_CLEANER_TYPE_BASIC</a></div><div class="ttdeci">#define AILIA_VOICE_CLEANER_TYPE_BASIC</div><div class="ttdoc">BasicCleaner.</div><div class="ttdef"><b>Definition:</b> ailia_voice.h:91</div></div>
<div class="ttc" id="aailia__voice_8h_html_aaaa63379372f4c0497289609b9c46586"><div class="ttname"><a href="ailia__voice_8h.html#aaaa63379372f4c0497289609b9c46586">AILIA_VOICE_DICTIONARY_TYPE_G2P_EN</a></div><div class="ttdeci">#define AILIA_VOICE_DICTIONARY_TYPE_G2P_EN</div><div class="ttdoc">Format for G2P_EN.</div><div class="ttdef"><b>Definition:</b> ailia_voice.h:54</div></div>
<div class="ttc" id="aailia__voice_8h_html_a4c66d0f4b691cb5055dec12bbb6f9f59"><div class="ttname"><a href="ailia__voice_8h.html#a4c66d0f4b691cb5055dec12bbb6f9f59">ailiaVoiceGetWave</a></div><div class="ttdeci">int AILIA_API ailiaVoiceGetWave(struct AILIAVoice *net, float *buf, unsigned int buf_size)</div><div class="ttdoc">Gets the decoded features.</div></div>
<div class="ttc" id="aailia__voice_8h_html_ab2eb40be42730f1dd254b377b87fe516"><div class="ttname"><a href="ailia__voice_8h.html#ab2eb40be42730f1dd254b377b87fe516">AILIA_VOICE_API_CALLBACK_VERSION</a></div><div class="ttdeci">#define AILIA_VOICE_API_CALLBACK_VERSION</div><div class="ttdoc">Struct version.</div><div class="ttdef"><b>Definition:</b> ailia_voice.h:190</div></div>
<div class="ttc" id="aailia__voice_8h_html_a6f807d69708ee2d64230fc575253a07b"><div class="ttname"><a href="ailia__voice_8h.html#a6f807d69708ee2d64230fc575253a07b">ailiaVoiceCreate</a></div><div class="ttdeci">int AILIA_API ailiaVoiceCreate(struct AILIAVoice **net, int env_id, int num_thread, int memory_mode, int flags, AILIAVoiceApiCallback callback, int version)</div><div class="ttdoc">Creates a Voice instance.</div></div>
Expand Down
4 changes: 2 additions & 2 deletions supplemental/voice/cpp/en/setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ <h2><a class="anchor" id="autotoc_md31"></a>
</div><!-- fragment --><h1><a class="anchor" id="autotoc_md35"></a>
Available options when executing the sample</h1>
<p>The sample executable can take the following options.</p>
<div class="fragment"><div class="line">./ailia_voice_sample [tacotron2/gpt-sovits] [input_text]</div>
<div class="fragment"><div class="line">./ailia_voice_sample [tacotron2/gpt-sovits/gpt-sovits-en] [input_text]</div>
</div><!-- fragment --><p>See below for details about each argument:</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">Contents </th><th class="markdownTableHeadNone">Details </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">Model </td><td class="markdownTableBodyNone">Specify the model to use. Specify tacotron2 or gpt-sovits. </td></tr>
<td class="markdownTableBodyNone">Model </td><td class="markdownTableBodyNone">Specify the model to use. For English, specify tacotron2 or gpt-sovits-en, and for Japanese, specify gpt-sovits. </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">Input text </td><td class="markdownTableBodyNone">Indicates the text input file. </td></tr>
</table>
Expand Down
Loading

0 comments on commit 89b7c4b

Please sign in to comment.