Skip to content

Commit

Permalink
example下の"speaker_id"を、"style_id"に直す #562 (#584)
Browse files Browse the repository at this point in the history
* change variable speaker_id to style_id in example/

* READMEのspeaker_idの変更と、それによるオプション文字列の変更

* 修正ミスの修正 simple_tts.cpp

* 空白の追加 simple_tts.cpp
  • Loading branch information
weweweok authored Aug 26, 2023
1 parent 90bed0c commit f0e9870
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
4 changes: 2 additions & 2 deletions example/cpp/unix/simple_tts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ int main(int argc, char *argv[]) {

std::cout << "音声生成中..." << std::endl;

int64_t speaker_id = 0;
int64_t style_id = 0;
size_t output_wav_size = 0;
uint8_t *output_wav = nullptr;

result = voicevox_synthesizer_tts(synthesizer,text.c_str(), speaker_id,
result = voicevox_synthesizer_tts(synthesizer,text.c_str(), style_id,
voicevox_make_default_tts_options(),
&output_wav_size, &output_wav);
if (result != VOICEVOX_RESULT_OK) {
Expand Down
4 changes: 2 additions & 2 deletions example/cpp/windows/simple_tts/simple_tts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ int main() {
voicevox_open_jtalk_rc_delete(open_jtalk);

std::wcout << L"音声生成中" << std::endl;
int32_t speaker_id = 0;
int32_t style_id = 0;
uintptr_t output_binary_size = 0;
uint8_t* output_wav = nullptr;
VoicevoxTtsOptions ttsOptions = voicevox_make_default_tts_options();

result = voicevox_synthesizer_tts(synthesizer,wide_to_utf8_cppapi(speak_words).c_str(), speaker_id, ttsOptions, &output_binary_size, &output_wav);
result = voicevox_synthesizer_tts(synthesizer,wide_to_utf8_cppapi(speak_words).c_str(), style_id, ttsOptions, &output_binary_size, &output_wav);
if (result != VoicevoxResultCode::VOICEVOX_RESULT_OK) {
OutErrorMessage(result);
return 0;
Expand Down
15 changes: 7 additions & 8 deletions example/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,22 @@ voicevox_core ライブラリ の Python バインディングを使った音声

## 準備

1. wheelパッケージのインストールをします
1. wheel パッケージのインストールをします

`[バージョン]`の部分は適宜書き換えてください。

```console
pip install https://github.com/VOICEVOX/voicevox_core/releases/download/[バージョン]/voicevox_core-[バージョン]+cpu-cp38-abi3-linux_x86_64.whl
```

cpu-cp38-abi3-linux_x86_64のところはアーキテクチャやOSによって適宜読み替えてください
cpu-cp38-abi3-linux_x86_64 のところはアーキテクチャや OS によって適宜読み替えてください
https://github.com/VOICEVOX/voicevox_core/releases/latest


2. ダウンローダーを使って環境構築します。

linux/macの場合
linux/mac の場合

download-linux-x64のところはアーキテクチャやOSによって適宜読み替えてください
download-linux-x64 のところはアーキテクチャや OS によって適宜読み替えてください
https://github.com/VOICEVOX/voicevox_core/releases/latest#%E3%83%80%E3%82%A6%E3%83%B3%E3%83%AD%E3%83%BC%E3%83%80

```console
Expand All @@ -33,7 +32,7 @@ https://github.com/VOICEVOX/voicevox_core/releases/latest#%E3%83%80%E3%82%A6%E3%
#rm -r ./example/python/{model,VERSION,*voicevox_core*}
```

windowsの場合
windows の場合

```console
Invoke-WebRequest https://github.com/VOICEVOX/voicevox_core/releases/latest/download/download-windows-x64.exe -OutFile ./download.exe
Expand All @@ -52,7 +51,7 @@ run.py を実行します。 Open JTalk 辞書ディレクトリ、読み上げ

```console
python ./run.py -h
usage: run.py [-h] [--mode MODE] [--dict-dir DICT_DIR] [--text TEXT] [--out OUT] [--speaker-id SPEAKER_ID] vvm
usage: run.py [-h] [--mode MODE] [--dict-dir DICT_DIR] [--text TEXT] [--out OUT] [--style-id STYLE_ID] vvm

positional arguments:
vvm vvmファイルへのパス
Expand All @@ -63,7 +62,7 @@ optional arguments:
--dict-dir DICT_DIR Open JTalkの辞書ディレクトリ
--text TEXT 読み上げさせたい文章
--out OUT 出力wavファイルのパス
--speaker-id SPEAKER_ID
--style-id STYLE_ID
話者IDを指定
```

Expand Down
10 changes: 5 additions & 5 deletions example/python/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async def main() -> None:
open_jtalk_dict_dir,
text,
out,
speaker_id,
style_id,
) = parse_args()

logger.debug("%s", f"{voicevox_core.supported_devices()=}")
Expand All @@ -47,10 +47,10 @@ async def main() -> None:
await synthesizer.load_voice_model(model)

logger.info("%s", f"Creating an AudioQuery from {text!r}")
audio_query = await synthesizer.audio_query(text, speaker_id)
audio_query = await synthesizer.audio_query(text, style_id)

logger.info("%s", f"Synthesizing with {display_as_json(audio_query)}")
wav = await synthesizer.synthesis(audio_query, speaker_id)
wav = await synthesizer.synthesis(audio_query, style_id)

out.write_bytes(wav)
logger.info("%s", f"Wrote `{out}`")
Expand Down Expand Up @@ -87,13 +87,13 @@ def parse_args() -> Tuple[AccelerationMode, Path, Path, str, Path, int]:
help="出力wavファイルのパス",
)
argparser.add_argument(
"--speaker-id",
"--style-id",
default=0,
type=int,
help="話者IDを指定",
)
args = argparser.parse_args()
return (args.mode, args.vvm, args.dict_dir, args.text, args.out, args.speaker_id)
return (args.mode, args.vvm, args.dict_dir, args.text, args.out, args.style_id)


def display_as_json(audio_query: AudioQuery) -> str:
Expand Down

0 comments on commit f0e9870

Please sign in to comment.