Skip to content

Commit

Permalink
Merge 26c6f63 into a451258
Browse files Browse the repository at this point in the history
  • Loading branch information
qwerty2501 committed Dec 18, 2021
2 parents a451258 + 26c6f63 commit d6ebdc7
Show file tree
Hide file tree
Showing 5 changed files with 489 additions and 29 deletions.
29 changes: 23 additions & 6 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,15 @@ async def start_catch_disconnection():
tags=["クエリ作成"],
summary="音声合成用のクエリを作成する",
)
def audio_query(text: str, speaker: int):
def audio_query(text: str, speaker: int, enable_interrogative: bool = True):
"""
クエリの初期値を得ます。ここで得られたクエリはそのまま音声合成に利用できます。各値の意味は`Schemas`を参照してください。
"""
accent_phrases = engine.create_accent_phrases(text, speaker_id=speaker)
accent_phrases = engine.create_accent_phrases(
text,
speaker_id=speaker,
enable_interrogative=enable_interrogative,
)
return AudioQuery(
accent_phrases=accent_phrases,
speedScale=1,
Expand All @@ -103,7 +107,9 @@ def audio_query(text: str, speaker: int):
tags=["クエリ作成"],
summary="音声合成用のクエリをプリセットを用いて作成する",
)
def audio_query_from_preset(text: str, preset_id: int):
def audio_query_from_preset(
text: str, preset_id: int, enable_interrogative: bool = True
):
"""
クエリの初期値を得ます。ここで得られたクエリはそのまま音声合成に利用できます。各値の意味は`Schemas`を参照してください。
"""
Expand All @@ -118,7 +124,9 @@ def audio_query_from_preset(text: str, preset_id: int):
raise HTTPException(status_code=422, detail="該当するプリセットIDが見つかりません")

accent_phrases = engine.create_accent_phrases(
text, speaker_id=selected_preset.style_id
text,
speaker_id=selected_preset.style_id,
enable_interrogative=enable_interrogative,
)
return AudioQuery(
accent_phrases=accent_phrases,
Expand All @@ -145,7 +153,12 @@ def audio_query_from_preset(text: str, preset_id: int):
}
},
)
def accent_phrases(text: str, speaker: int, is_kana: bool = False):
def accent_phrases(
text: str,
speaker: int,
is_kana: bool = False,
enable_interrogative: bool = True,
):
"""
テキストからアクセント句を得ます。
is_kanaが`true`のとき、テキストは次のようなAquesTalkライクな記法に従う読み仮名として処理されます。デフォルトは`false`です。
Expand All @@ -166,7 +179,11 @@ def accent_phrases(text: str, speaker: int, is_kana: bool = False):
accent_phrases=accent_phrases, speaker_id=speaker
)
else:
return engine.create_accent_phrases(text, speaker_id=speaker)
return engine.create_accent_phrases(
text,
speaker_id=speaker,
enable_interrogative=enable_interrogative,
)

@app.post(
"/mora_data",
Expand Down
Loading

0 comments on commit d6ebdc7

Please sign in to comment.