-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:VOICEVOX/voicevox_engine
- Loading branch information
Showing
4 changed files
with
47 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
""" | ||
歌唱のテスト | ||
""" | ||
|
||
from test.utility import hash_wave_floats_from_wav_bytes | ||
|
||
from fastapi.testclient import TestClient | ||
from syrupy.assertion import SnapshotAssertion | ||
|
||
|
||
def test_スコアとキャラクターIDから音声を合成できる( | ||
client: TestClient, snapshot: SnapshotAssertion | ||
) -> None: | ||
# スコアとキャラクター ID から FrameAudioQuery を生成する | ||
score = { | ||
"notes": [ | ||
{"key": None, "frame_length": 10, "lyric": ""}, | ||
{"key": 30, "frame_length": 3, "lyric": "て"}, | ||
{"key": 30, "frame_length": 3, "lyric": "す"}, | ||
{"key": 40, "frame_length": 1, "lyric": "と"}, | ||
{"key": None, "frame_length": 10, "lyric": ""}, | ||
] | ||
} | ||
frame_audio_query_res = client.post( | ||
"/sing_frame_audio_query", params={"speaker": 0}, json=score | ||
) | ||
# AivisSpeech Engine では未実装 (501 Not Implemented を返す) | ||
assert frame_audio_query_res.status_code == 501 | ||
return | ||
frame_audio_query = frame_audio_query_res.json() | ||
|
||
# FrameAudioQuery から音声波形を生成する | ||
frame_synthesis_res = client.post( | ||
"/frame_synthesis", params={"speaker": 0}, json=frame_audio_query | ||
) | ||
|
||
# リクエストが成功している | ||
assert frame_synthesis_res.status_code == 200 | ||
|
||
# FileResponse 内の .wav から抽出された音声波形が一致する | ||
assert frame_synthesis_res.headers["content-type"] == "audio/wav" | ||
assert snapshot == hash_wave_floats_from_wav_bytes(frame_synthesis_res.read()) |
6 changes: 3 additions & 3 deletions
6
.../tts_pipeline/__snapshots__/test_tts_engine/test_mocked_create_accent_phrases_output.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters