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

Core関数docstringの移植 #795

Merged
merged 3 commits into from
Nov 29, 2023
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
63 changes: 63 additions & 0 deletions voicevox_engine/synthesis_engine/core_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,21 @@ def yukarin_s_forward(
phoneme_list: np.ndarray,
style_id: np.ndarray,
) -> np.ndarray:
"""
音素列から、音素ごとの長さを求める関数
Parameters
----------
length : int
音素列の長さ
phoneme_list : np.ndarray
音素列
style_id : np.ndarray
スタイル番号
Returns
-------
output : np.ndarray
音素ごとの長さ
"""
output = np.zeros((length,), dtype=np.float32)
self.assert_core_success(
self.core.yukarin_s_forward(
Expand All @@ -467,6 +482,31 @@ def yukarin_sa_forward(
end_accent_phrase_list: np.ndarray,
style_id: np.ndarray,
) -> np.ndarray:
"""
モーラごとの音素列とアクセント情報から、モーラごとの音高を求める関数
Parameters
----------
length : int
モーラ列の長さ
vowel_phoneme_list : np.ndarray
母音の音素列
consonant_phoneme_list : np.ndarray
子音の音素列
start_accent_list : np.ndarray
アクセントの開始位置
end_accent_list : np.ndarray
アクセントの終了位置
start_accent_phrase_list : np.ndarray
アクセント句の開始位置
end_accent_phrase_list : np.ndarray
アクセント句の終了位置
style_id : np.ndarray
スタイル番号
Returns
-------
output : np.ndarray
モーラごとの音高
"""
output = np.empty(
(
len(style_id),
Expand Down Expand Up @@ -497,6 +537,26 @@ def decode_forward(
phoneme: np.ndarray,
style_id: np.ndarray,
) -> np.ndarray:
"""
フレームごとの音素と音高から波形を求める関数
Parameters
----------
length : int
フレームの長さ
phoneme_size : int
音素の種類数
f0 : np.ndarray
フレームごとの音高
phoneme : np.ndarray
フレームごとの音素
style_id : np.ndarray
スタイル番号
Returns
-------
output : np.ndarray
音声波形
"""

output = np.empty((length * 256,), dtype=np.float32)
self.assert_core_success(
self.core.decode_forward(
Expand All @@ -511,6 +571,9 @@ def decode_forward(
return output

def supported_devices(self) -> str:
"""
coreから取得した対応デバイスに関するjsonデータの文字列
"""
if self.exist_supported_devices:
return self.core.supported_devices().decode("utf-8")
raise OldCoreError
Expand Down
29 changes: 0 additions & 29 deletions voicevox_engine/synthesis_engine/synthesis_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,36 +218,7 @@ def __init__(
core: CoreWrapper,
):
"""
core.yukarin_s_forward: 音素列から、音素ごとの長さを求める関数
length: 音素列の長さ
phoneme_list: 音素列
style_id: スタイル番号
return: 音素ごとの長さ

core.yukarin_sa_forward: モーラごとの音素列とアクセント情報から、モーラごとの音高を求める関数
length: モーラ列の長さ
vowel_phoneme_list: 母音の音素列
consonant_phoneme_list: 子音の音素列
start_accent_list: アクセントの開始位置
end_accent_list: アクセントの終了位置
start_accent_phrase_list: アクセント句の開始位置
end_accent_phrase_list: アクセント句の終了位置
style_id: スタイル番号
return: モーラごとの音高

core.decode_forward: フレームごとの音素と音高から波形を求める関数
length: フレームの長さ
phoneme_size: 音素の種類数
f0: フレームごとの音高
phoneme: フレームごとの音素
style_id: スタイル番号
return: 音声波形

speakers: coreから取得したspeakersに関するjsonデータの文字列

supported_devices:
coreから取得した対応デバイスに関するjsonデータの文字列
Noneの場合はコアが情報の取得に対応していないため、対応デバイスは不明
"""
super().__init__()
self.core = core
Expand Down