Skip to content

Commit

Permalink
update models and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bejager committed Aug 19, 2024
1 parent 36317fe commit eec78b2
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 23 deletions.
6 changes: 2 additions & 4 deletions binding/python/test_orca.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@


class OrcaTestCase(unittest.TestCase):
EXACT_ALIGNMENT_TEST_MODEL_IDENTIFIER = "female"

access_key: str
orcas: List[Orca]
model_paths: List[str]
Expand Down Expand Up @@ -105,7 +103,7 @@ def test_synthesize(self) -> None:
def test_synthesize_alignment_exact(self) -> None:
orca = [
orca for i, orca in enumerate(self.orcas) if
self.EXACT_ALIGNMENT_TEST_MODEL_IDENTIFIER in self.model_paths[i]].pop()
test_data.exact_alignment_test_model_identifier in self.model_paths[i]].pop()
pcm, alignments = orca.synthesize(test_data.text_alignment, random_state=test_data.random_state)
self.assertGreater(len(pcm), 0)

Expand All @@ -115,7 +113,7 @@ def test_synthesize_alignment_exact(self) -> None:

def test_synthesize_alignment(self) -> None:
for i, orca in enumerate(self.orcas):
if self.EXACT_ALIGNMENT_TEST_MODEL_IDENTIFIER in self.model_paths[i]:
if test_data.exact_alignment_test_model_identifier in self.model_paths[i]:
continue

pcm, alignments = orca.synthesize(test_data.text_alignment, random_state=test_data.random_state)
Expand Down
9 changes: 5 additions & 4 deletions binding/python/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class TestData:
alignments: Sequence[Orca.WordAlignment]
random_state: int
audio_data_folder: str
exact_alignment_test_model_identifier: str


def read_wav_file(path: str) -> Sequence[int]:
Expand All @@ -49,7 +50,7 @@ def get_test_data() -> TestData:
test_data = json.loads(data_file.read())

alignments = []
for word_data in test_data["alignments"]:
for word_data in test_data.pop("alignments"):
phonemes = []
for phoneme_data in word_data["phonemes"]:
phoneme = Orca.PhonemeAlignment(
Expand All @@ -65,11 +66,11 @@ def get_test_data() -> TestData:
phonemes=phonemes)
alignments.append(word)

test_sentences = test_data.pop("test_sentences")
test_data = TestData(
alignments=alignments,
random_state=test_data["random_state"],
audio_data_folder=test_data["audio_data_folder"],
**test_data["test_sentences"])
**test_data,
**test_sentences)

return test_data

Expand Down
Binary file modified lib/common/orca_params_female.pv
Binary file not shown.
Binary file modified lib/common/orca_params_male.pv
Binary file not shown.
31 changes: 16 additions & 15 deletions resources/.test/test_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,53 +26,53 @@
{
"word": "Test",
"start_sec": 0.000,
"end_sec": 0.36,
"end_sec": 0.37,
"phonemes": [
{
"phoneme": "T",
"start_sec": 0.00,
"end_sec": 0.10
"end_sec": 0.12
},
{
"phoneme": "EH",
"start_sec": 0.10,
"end_sec": 0.21
"start_sec": 0.12,
"end_sec": 0.22
},
{
"phoneme": "S",
"start_sec": 0.21,
"end_sec": 0.29
"start_sec": 0.22,
"end_sec": 0.30
},
{
"phoneme": "T",
"start_sec": 0.29,
"end_sec": 0.36
"start_sec": 0.30,
"end_sec": 0.37
}
]
},
{
"word": "alignment",
"start_sec": 0.36,
"start_sec": 0.37,
"end_sec": 0.86,
"phonemes": [
{
"phoneme": "AH",
"start_sec": 0.36,
"start_sec": 0.37,
"end_sec": 0.42
},
{
"phoneme": "L",
"start_sec": 0.42,
"end_sec": 0.50
"end_sec": 0.51
},
{
"phoneme": "AY",
"start_sec": 0.50,
"end_sec": 0.57
"start_sec": 0.51,
"end_sec": 0.58
},
{
"phoneme": "N",
"start_sec": 0.57,
"start_sec": 0.58,
"end_sec": 0.65
},
{
Expand Down Expand Up @@ -110,5 +110,6 @@
]
}
],
"audio_data_folder": "resources/.test/wav/"
"audio_data_folder": "resources/.test/wav/",
"exact_alignment_test_model_identifier": "orca_params_female"
}
Binary file modified resources/.test/wav/orca_params_female_single.wav
Binary file not shown.
Binary file modified resources/.test/wav/orca_params_female_stream.wav
Binary file not shown.
Binary file modified resources/.test/wav/orca_params_male_single.wav
Binary file not shown.
Binary file modified resources/.test/wav/orca_params_male_stream.wav
Binary file not shown.

0 comments on commit eec78b2

Please sign in to comment.