Skip to content

Commit

Permalink
Merge branch 'master' into refactor/character_docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tarepan committed Jun 25, 2024
2 parents 6d42fdc + 4965657 commit 3a1269d
Show file tree
Hide file tree
Showing 11 changed files with 115 additions and 121 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ ADD ./run.py ./presets.yaml ./engine_manifest.json /opt/voicevox_engine/
ADD ./resources /opt/voicevox_engine/resources
ADD ./tools/generate_licenses.py /opt/voicevox_engine/tools/
ADD ./tools/licenses /opt/voicevox_engine/tools/licenses
ADD ./tools/generate_filemap.py /opt/voicevox_engine/tools/

# Replace version
ARG VOICEVOX_ENGINE_VERSION=latest
Expand All @@ -259,8 +260,7 @@ RUN <<EOF
EOF

# Generate filemap.json
ADD ./tools/generate_filemap.py /tmp/
RUN gosu user /opt/python/bin/python3 /tmp/generate_filemap.py --target_dir resources/character_info
RUN /opt/python/bin/python3 /opt/voicevox_engine/tools/generate_filemap.py --target_dir /opt/voicevox_engine/resources/character_info

# Keep this layer separated to use layer cache on download failed in local build
RUN <<EOF
Expand Down
1 change: 1 addition & 0 deletions docs/VOICEVOX音声合成エンジンとの連携.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- バージョンが上がっても、`/audio_query`で返ってくる値をそのまま`/synthesis`に POST すれば音声合成できるようにする予定です
- `AudioQuery`のパラメータは増えますが、なるべくデフォルト値で以前と変わらない音声が生成されるようにします
- 以前のバージョンの`AudioQuery`を新しいバージョンの`/synthesis`にそのまま POST できるようにします(後方互換)
- バージョン 0.7 から音声スタイルが実装されました。スタイルの情報は`/speakers`及び`/singers`から取得できます
- スタイルの情報にある`style_id``speaker`に指定することで、今まで通り音声合成ができます
- `style_id`の指定先が`speaker`なのは互換性のためです
5 changes: 5 additions & 0 deletions engine_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
"value": true,
"name": "全体の音量の調整"
},
"adjust_pause_length": {
"type": "bool",
"value": true,
"name": "句読点などの無音時間の調整"
},
"interrogative_upspeak": {
"type": "bool",
"value": true,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 17 additions & 43 deletions test/unit/tts_pipeline/test_tts_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
)

from .test_text_analyzer import stub_unknown_features_koxx
from .tts_utils import gen_mora


def yukarin_s_mock(
Expand Down Expand Up @@ -103,32 +104,13 @@ def is_model_loaded(self, style_id: str) -> bool:
return True


def _gen_mora(
text: str,
consonant: str | None,
consonant_length: float | None,
vowel: str,
vowel_length: float,
pitch: float,
) -> Mora:
"""Generate Mora with positional arguments for test simplicity."""
return Mora(
text=text,
consonant=consonant,
consonant_length=consonant_length,
vowel=vowel,
vowel_length=vowel_length,
pitch=pitch,
)


def test_to_flatten_phonemes() -> None:
"""Test `to_flatten_phonemes`."""
# Inputs
moras = [
_gen_mora(" ", None, None, "sil", 2 * 0.01067, 0.0),
_gen_mora("ヒ", "h", 2 * 0.01067, "i", 4 * 0.01067, 100.0),
_gen_mora(" ", None, None, "sil", 6 * 0.01067, 0.0),
gen_mora(" ", None, None, "sil", 2 * 0.01067, 0.0),
gen_mora("ヒ", "h", 2 * 0.01067, "i", 4 * 0.01067, 5.0),
gen_mora(" ", None, None, "sil", 6 * 0.01067, 0.0),
]

# Expects
Expand All @@ -140,33 +122,25 @@ def test_to_flatten_phonemes() -> None:
assert true_phonemes == phonemes


def _gen_hello_hiho_text() -> str:
return "こんにちは、ヒホです"


def _gen_hello_hiho_kana() -> str:
return "コンニチワ'、ヒ'ホデ_ス"


def _gen_hello_hiho_accent_phrases() -> list[AccentPhrase]:
return [
AccentPhrase(
moras=[
_gen_mora("コ", "k", 0.0, "o", 0.0, 0.0),
_gen_mora("ン", None, None, "N", 0.0, 0.0),
_gen_mora("ニ", "n", 0.0, "i", 0.0, 0.0),
_gen_mora("チ", "ch", 0.0, "i", 0.0, 0.0),
_gen_mora("ワ", "w", 0.0, "a", 0.0, 0.0),
gen_mora("コ", "k", 0.0, "o", 0.0, 0.0),
gen_mora("ン", None, None, "N", 0.0, 0.0),
gen_mora("ニ", "n", 0.0, "i", 0.0, 0.0),
gen_mora("チ", "ch", 0.0, "i", 0.0, 0.0),
gen_mora("ワ", "w", 0.0, "a", 0.0, 0.0),
],
accent=5,
pause_mora=_gen_mora("、", None, None, "pau", 0.0, 0.0),
pause_mora=gen_mora("、", None, None, "pau", 0.0, 0.0),
),
AccentPhrase(
moras=[
_gen_mora("ヒ", "h", 0.0, "i", 0.0, 0.0),
_gen_mora("ホ", "h", 0.0, "o", 0.0, 0.0),
_gen_mora("デ", "d", 0.0, "e", 0.0, 0.0),
_gen_mora("ス", "s", 0.0, "U", 0.0, 0.0),
gen_mora("ヒ", "h", 0.0, "i", 0.0, 0.0),
gen_mora("ホ", "h", 0.0, "o", 0.0, 0.0),
gen_mora("デ", "d", 0.0, "e", 0.0, 0.0),
gen_mora("ス", "s", 0.0, "U", 0.0, 0.0),
],
accent=1,
pause_mora=None,
Expand All @@ -187,7 +161,7 @@ def _gen_hello_hiho_query() -> AudioQuery:
pauseLengthScale=0.8,
outputSamplingRate=12000,
outputStereo=True,
kana=_gen_hello_hiho_kana(),
kana="コンニチワ'、ヒ'ホデ_ス",
)


Expand Down Expand Up @@ -352,7 +326,7 @@ def test_mocked_create_accent_phrases_output(
"""モックされた `TTSEngine.create_accent_phrases()` の出力スナップショットが一定である"""
# Inputs
tts_engine = TTSEngine(MockCoreWrapper())
hello_hiho = _gen_hello_hiho_text()
hello_hiho = "こんにちは、ヒホです"
# Outputs
result = tts_engine.create_accent_phrases(hello_hiho, StyleId(1))
# Tests
Expand All @@ -365,7 +339,7 @@ def test_mocked_create_accent_phrases_from_kana_output(
"""モックされた `TTSEngine.create_accent_phrases_from_kana()` の出力スナップショットが一定である"""
# Inputs
tts_engine = TTSEngine(MockCoreWrapper())
hello_hiho = _gen_hello_hiho_kana()
hello_hiho = "コンニチワ'、ヒ'ホデ_ス"
# Outputs
result = tts_engine.create_accent_phrases_from_kana(hello_hiho, StyleId(1))
# Tests
Expand Down
Loading

0 comments on commit 3a1269d

Please sign in to comment.