Skip to content

Commit

Permalink
整理: テスト用のピッチを log スケールに修正 (#1426)
Browse files Browse the repository at this point in the history
fix: テスト用のピッチを log スケールに修正
  • Loading branch information
tarepan authored Jun 25, 2024
1 parent 6813b41 commit 4965657
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion test/unit/tts_pipeline/test_tts_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def test_to_flatten_phonemes() -> None:
# Inputs
moras = [
gen_mora(" ", None, None, "sil", 2 * 0.01067, 0.0),
gen_mora("ヒ", "h", 2 * 0.01067, "i", 4 * 0.01067, 100.0),
gen_mora("ヒ", "h", 2 * 0.01067, "i", 4 * 0.01067, 5.0),
gen_mora(" ", None, None, "sil", 6 * 0.01067, 0.0),
]

Expand Down
56 changes: 28 additions & 28 deletions test/unit/tts_pipeline/test_wave_synthesizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ def test_apply_prepost_silence() -> None:
# Inputs
query = _gen_query(prePhonemeLength=2 * 0.01067, postPhonemeLength=6 * 0.01067)
moras = [
gen_mora("ヒ", "h", 2 * 0.01067, "i", 4 * 0.01067, 100.0),
gen_mora("ヒ", "h", 2 * 0.01067, "i", 4 * 0.01067, 5.0),
]

# Expects
true_moras_with_silence = [
gen_mora(" ", None, None, "sil", 2 * 0.01067, 0.0),
gen_mora("ヒ", "h", 2 * 0.01067, "i", 4 * 0.01067, 100.0),
gen_mora("ヒ", "h", 2 * 0.01067, "i", 4 * 0.01067, 5.0),
gen_mora(" ", None, None, "sil", 6 * 0.01067, 0.0),
]

Expand All @@ -78,19 +78,19 @@ def test_apply_speed_scale() -> None:
# Inputs
query = _gen_query(speedScale=2.0)
input_moras = [
gen_mora("コ", "k", 2 * 0.01067, "o", 4 * 0.01067, 50.0),
gen_mora("ン", None, None, "N", 4 * 0.01067, 50.0),
gen_mora("コ", "k", 2 * 0.01067, "o", 4 * 0.01067, 5.0),
gen_mora("ン", None, None, "N", 4 * 0.01067, 5.0),
gen_mora("、", None, None, "pau", 2 * 0.01067, 0.0),
gen_mora("ヒ", "h", 2 * 0.01067, "i", 4 * 0.01067, 125.0),
gen_mora("ヒ", "h", 2 * 0.01067, "i", 4 * 0.01067, 6.0),
gen_mora("ホ", "h", 4 * 0.01067, "O", 2 * 0.01067, 0.0),
]

# Expects - x2 fast
true_moras = [
gen_mora("コ", "k", 1 * 0.01067, "o", 2 * 0.01067, 50.0),
gen_mora("ン", None, None, "N", 2 * 0.01067, 50.0),
gen_mora("コ", "k", 1 * 0.01067, "o", 2 * 0.01067, 5.0),
gen_mora("ン", None, None, "N", 2 * 0.01067, 5.0),
gen_mora("、", None, None, "pau", 1 * 0.01067, 0.0),
gen_mora("ヒ", "h", 1 * 0.01067, "i", 2 * 0.01067, 125.0),
gen_mora("ヒ", "h", 1 * 0.01067, "i", 2 * 0.01067, 6.0),
gen_mora("ホ", "h", 2 * 0.01067, "O", 1 * 0.01067, 0.0),
]

Expand All @@ -105,19 +105,19 @@ def test_apply_pitch_scale() -> None:
# Inputs
query = _gen_query(pitchScale=2.0)
input_moras = [
gen_mora("コ", "k", 0.0, "o", 0.0, 50.0),
gen_mora("ン", None, None, "N", 0.0, 50.0),
gen_mora("コ", "k", 0.0, "o", 0.0, 5.0),
gen_mora("ン", None, None, "N", 0.0, 5.0),
gen_mora("、", None, None, "pau", 0.0, 0.0),
gen_mora("ヒ", "h", 0.0, "i", 0.0, 125.0),
gen_mora("ヒ", "h", 0.0, "i", 0.0, 6.0),
gen_mora("ホ", "h", 0.0, "O", 0.0, 0.0),
]

# Expects - x4 value scaled
true_moras = [
gen_mora("コ", "k", 0.0, "o", 0.0, 200.0),
gen_mora("ン", None, None, "N", 0.0, 200.0),
gen_mora("コ", "k", 0.0, "o", 0.0, 20.0),
gen_mora("ン", None, None, "N", 0.0, 20.0),
gen_mora("、", None, None, "pau", 0.0, 0.0),
gen_mora("ヒ", "h", 0.0, "i", 0.0, 500.0),
gen_mora("ヒ", "h", 0.0, "i", 0.0, 24.0),
gen_mora("ホ", "h", 0.0, "O", 0.0, 0.0),
]

Expand All @@ -132,19 +132,19 @@ def test_apply_intonation_scale() -> None:
# Inputs
query = _gen_query(intonationScale=0.5)
input_moras = [
gen_mora("コ", "k", 0.0, "o", 0.0, 200.0),
gen_mora("ン", None, None, "N", 0.0, 200.0),
gen_mora("コ", "k", 0.0, "o", 0.0, 5.0),
gen_mora("ン", None, None, "N", 0.0, 5.0),
gen_mora("、", None, None, "pau", 0.0, 0.0),
gen_mora("ヒ", "h", 0.0, "i", 0.0, 500.0),
gen_mora("ヒ", "h", 0.0, "i", 0.0, 8.0),
gen_mora("ホ", "h", 0.0, "O", 0.0, 0.0),
]

# Expects - mean=300 var x0.5 intonation scaling
# Expects - mean=6 var x0.5 intonation scaling
true_moras = [
gen_mora("コ", "k", 0.0, "o", 0.0, 250.0),
gen_mora("ン", None, None, "N", 0.0, 250.0),
gen_mora("コ", "k", 0.0, "o", 0.0, 5.5),
gen_mora("ン", None, None, "N", 0.0, 5.5),
gen_mora("、", None, None, "pau", 0.0, 0.0),
gen_mora("ヒ", "h", 0.0, "i", 0.0, 400.0),
gen_mora("ヒ", "h", 0.0, "i", 0.0, 7.0),
gen_mora("ホ", "h", 0.0, "O", 0.0, 0.0),
]

Expand Down Expand Up @@ -235,15 +235,15 @@ def test_query_to_decoder_feature() -> None:
accent_phrases = [
AccentPhrase(
moras=[
gen_mora("コ", "k", 2 * 0.01067, "o", 4 * 0.01067, 50.0),
gen_mora("ン", None, None, "N", 4 * 0.01067, 50.0),
gen_mora("コ", "k", 2 * 0.01067, "o", 4 * 0.01067, 5.0),
gen_mora("ン", None, None, "N", 4 * 0.01067, 5.0),
],
accent=1,
pause_mora=gen_mora("、", None, None, "pau", 2 * 0.01067, 0.0),
),
AccentPhrase(
moras=[
gen_mora("ヒ", "h", 2 * 0.01067, "i", 4 * 0.01067, 125.0),
gen_mora("ヒ", "h", 2 * 0.01067, "i", 4 * 0.01067, 8.0),
gen_mora("ホ", "h", 4 * 0.01067, "O", 2 * 0.01067, 0.0),
],
accent=1,
Expand Down Expand Up @@ -275,10 +275,10 @@ def test_query_to_decoder_feature() -> None:
# Pitch
# paw ko N pau hi hO paw
# frame_per_vowel = [1, 3, 2, 1, 3, 3, 3]
# pau ko ko ko N N
true1_f0 = [0.0, 250.0, 250.0, 250.0, 250.0, 250.0]
# pau pau hi hi hi
true2_f0 = [0.0, 0.0, 400.0, 400.0, 400.0]
# pau ko ko ko N N
true1_f0 = [0.0, 22.0, 22.0, 22.0, 22.0, 22.0]
# pau pau hi hi hi
true2_f0 = [0.0, 0.0, 28.0, 28.0, 28.0]
# hO hO hO paw paw paw
true3_f0 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
true_f0 = np.array(true1_f0 + true2_f0 + true3_f0, dtype=np.float32)
Expand Down

0 comments on commit 4965657

Please sign in to comment.