Skip to content

Commit

Permalink
ut
Browse files Browse the repository at this point in the history
  • Loading branch information
jordimas committed Dec 20, 2024
1 parent f40f09d commit c9223e1
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 33 deletions.
11 changes: 0 additions & 11 deletions open_dubbing/dubbing.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,17 +386,6 @@ def update(self):
# Update voices in case they have changed
modified_utterances = utterance.get_modified_utterances(self.utterance_metadata)

assigned_voices = self.tts.assign_voices(
utterance_metadata=modified_utterances,
target_language=self.target_language,
target_language_region=self.target_language_region,
)

modified_utterances = self.tts.update_utterance_metadata(
utterance_metadata=modified_utterances,
assigned_voices=assigned_voices,
)

self.tts.dub_utterances(
utterance_metadata=modified_utterances,
output_directory=self.output_directory,
Expand Down
18 changes: 0 additions & 18 deletions open_dubbing/text_to_speech.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,24 +103,6 @@ def _add_text_to_speech_properties(
utterance_metadata_copy.update(voice_properties)
return utterance_metadata_copy

def update_utterance_metadata(
self,
*,
utterance_metadata: Sequence[Mapping[str, str | float]],
assigned_voices: Mapping[str, str] | None,
) -> Sequence[Mapping[str, str | float]]:
"""Updates utterance metadata with assigned voices."""
updated_utterance_metadata = []
for metadata_item in utterance_metadata:
new_utterance = metadata_item.copy()
speaker_id = new_utterance.get("speaker_id")
new_utterance["assigned_voice"] = assigned_voices.get(speaker_id)
new_utterance = self._add_text_to_speech_properties(
utterance_metadata=new_utterance
)
updated_utterance_metadata.append(new_utterance)
return updated_utterance_metadata

@abstractmethod
def get_languages(self):
pass
Expand Down
1 change: 0 additions & 1 deletion open_dubbing/utterance.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ def update_utterances(self, utterance_master, utterance_update):
"speed",
"assigned_voice",
"for_dubbing",
"gender",
"start",
"end",
]
Expand Down
6 changes: 3 additions & 3 deletions tests/utterance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def test_update_utterances_operation_update(self):
{
"id": 2,
"operation": "update",
"gender": "Female",
"assigned_voice": "ca-ES-EnricNeural2",
"translated_text": "Sóc de Tarragona",
}
]
Expand All @@ -236,9 +236,9 @@ def test_update_utterances_operation_update(self):
"path": "output/jordi.central.edge.update/chunk_5.24534375_6.629093750000001.mp3",
"text": "I am from Barcelona.",
"for_dubbing": True,
"gender": "Female",
"gender": "Male",
"translated_text": "Sóc de Tarragona",
"assigned_voice": "ca-ES-EnricNeural",
"assigned_voice": "ca-ES-EnricNeural2",
"speed": 1.0,
"dubbed_path": "output/jordi.central.edge.update/dubbed_chunk_5.24534375_6.629093750000001.mp3",
"hash": "629484afdecb7641e35d686d6348cee4445611690f2f77831e892d52c3128bdd",
Expand Down

0 comments on commit c9223e1

Please sign in to comment.