Skip to content

Commit

Permalink
Merge branch 'versae-patch-1'
Browse files Browse the repository at this point in the history
  • Loading branch information
r4victor committed Jan 19, 2023
2 parents 248e638 + 746a10d commit 116562c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/afaligner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def align(
text_dir, audio_dir, output_dir=None, output_format='smil',
sync_map_text_path_prefix='', sync_map_audio_path_prefix='',
skip_penalty=None, radius=None,
times_as_timedelta=False,
times_as_timedelta=False, language=Language.ENG,
):
"""
This function performs an automatic synchronization of text and audio.
Expand Down Expand Up @@ -54,6 +54,8 @@ def align(
`times_as_timedelta` – if True, returned times are datetime.timedelta() instances.
If False, the times are strings of the format
f'{hours:d}:{minutes:0>2d}:{seconds:0>2d}.{ms:0>3d}'
`language` - language of the text. One of aenas.language.Language. Defaults to `Language.ENG`
Output:
Expand Down Expand Up @@ -93,7 +95,8 @@ def align(
sync_map_audio_path_prefix=sync_map_audio_path_prefix,
skip_penalty=skip_penalty,
radius=radius,
times_as_timedelta=times_as_timedelta
times_as_timedelta=times_as_timedelta,
language=language,
)

if output_dir is not None:
Expand All @@ -111,7 +114,8 @@ def build_sync_map(
text_paths, audio_paths, tmp_dir,
sync_map_text_path_prefix, sync_map_audio_path_prefix,
skip_penalty, radius,
times_as_timedelta
times_as_timedelta,
language,
):
"""
This is an algorithm for building a sync map.
Expand Down Expand Up @@ -164,7 +168,7 @@ def build_sync_map(
text_name = get_name_from_path(text_path)
output_text_name = os.path.join(sync_map_text_path_prefix, text_name)
textfile = TextFile(text_path, file_format=TextFileFormat.UNPARSED, parameters=parse_parameters)
textfile.set_language(Language.ENG)
textfile.set_language(language)
text_wav_path = os.path.join(tmp_dir, f'{drop_extension(text_name)}_text.wav')
sync_map[output_text_name] = {}

Expand Down

0 comments on commit 116562c

Please sign in to comment.