Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

追加:AudioQuery.pauseLengthのSkipJsonSchemaをなくす #1430

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

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

Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
# name: test_post_synthesis_200
'MD5:f7d42ce5787856549abc3d2d7561c06f'
# ---
# name: test_post_synthesis_old_audio_query_200
'MD5:f7d42ce5787856549abc3d2d7561c06f'
# ---
34 changes: 34 additions & 0 deletions test/e2e/single_api/tts_pipeline/test_synthesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,37 @@ def test_post_synthesis_200(client: TestClient, snapshot: SnapshotAssertion) ->
# 音声波形が一致する
assert response.headers["content-type"] == "audio/wav"
assert snapshot == hash_wave_floats_from_wav_bytes(response.read())


def test_post_synthesis_old_audio_query_200(
client: TestClient, snapshot: SnapshotAssertion
) -> None:
"""古いバージョンの audio_query でもエラーなく合成できる"""
query = {
"accent_phrases": [
{
"moras": [
gen_mora("テ", "t", 2.3, "e", 0.8, 3.3),
gen_mora("ス", "s", 2.1, "U", 0.3, 0.0),
gen_mora("ト", "t", 2.3, "o", 1.8, 4.1),
],
"accent": 1,
"pause_mora": None,
"is_interrogative": False,
}
],
"speedScale": 1.0,
"pitchScale": 1.0,
"intonationScale": 1.0,
"volumeScale": 1.0,
"prePhonemeLength": 0.1,
"postPhonemeLength": 0.1,
"outputSamplingRate": 24000,
"outputStereo": False,
}
response = client.post("/synthesis", params={"speaker": 0}, json=query)
assert response.status_code == 200

# 音声波形が一致する
assert response.headers["content-type"] == "audio/wav"
assert snapshot == hash_wave_floats_from_wav_bytes(response.read())
9 changes: 6 additions & 3 deletions voicevox_engine/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ class AudioQuery(BaseModel):
volumeScale: float = Field(title="全体の音量")
prePhonemeLength: float = Field(title="音声の前の無音時間")
postPhonemeLength: float = Field(title="音声の後の無音時間")
pauseLength: float | SkipJsonSchema[None] = Field(
default=None, title="句読点などの無音時間"
pauseLength: float | None = Field(
default=None,
title="句読点などの無音時間。nullのときは無視される。デフォルト値はnull",
)
pauseLengthScale: float = Field(
default=1, title="句読点などの無音時間(倍率)。デフォルト値は1"
)
pauseLengthScale: float = Field(default=1, title="句読点などの無音時間(倍率)")
outputSamplingRate: int = Field(title="音声データの出力サンプリングレート")
outputStereo: bool = Field(title="音声データをステレオ出力するか否か")
kana: str | SkipJsonSchema[None] = Field(
Expand Down
Loading