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

追加: ソングでノートごとに ID を持たせ、音素と対応づける #1460

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.

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.

18 changes: 18 additions & 0 deletions test/e2e/single_api/tts_pipeline/test_sing_frame_audio_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@
def test_post_sing_frame_audio_query_200(
client: TestClient, snapshot_json: SnapshotAssertion
) -> None:
score = {
"notes": [
{"id": "a", "key": None, "frame_length": 10, "lyric": ""},
{"id": "b", "key": 30, "frame_length": 3, "lyric": "て"},
{"id": "c", "key": 30, "frame_length": 3, "lyric": "す"},
{"id": "d", "key": 40, "frame_length": 1, "lyric": "と"},
{"id": "e", "key": None, "frame_length": 10, "lyric": ""},
]
}
response = client.post("/sing_frame_audio_query", params={"speaker": 0}, json=score)
assert response.status_code == 200
assert snapshot_json == round_floats(response.json(), 2)


def test_post_sing_old_frame_audio_query_200(
client: TestClient, snapshot_json: SnapshotAssertion
) -> None:
"""古いバージョンの楽譜でもエラーなく合成できる"""
score = {
"notes": [
{"key": None, "frame_length": 10, "lyric": ""},
Expand Down

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

5 changes: 5 additions & 0 deletions voicevox_engine/tts_pipeline/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
"""

from enum import Enum
from typing import NewType

from pydantic import BaseModel, ConfigDict, Field
from pydantic.json_schema import SkipJsonSchema

NoteId = NewType("NoteId", str)


class Mora(BaseModel):
"""
Expand Down Expand Up @@ -63,6 +66,7 @@ class Note(BaseModel):
音符ごとの情報
"""

id: NoteId | None = Field(default=None, description="ID")
key: int | SkipJsonSchema[None] = Field(default=None, description="音階")
frame_length: int = Field(description="音符のフレーム長")
lyric: str = Field(description="音符の歌詞")
Expand All @@ -83,6 +87,7 @@ class FramePhoneme(BaseModel):

phoneme: str = Field(description="音素")
frame_length: int = Field(description="音素のフレーム長")
note_id: NoteId | None = Field(default=None, description="音符のID")


class FrameAudioQuery(BaseModel):
Expand Down
Loading