Skip to content

Commit

Permalink
Added support for '*' specifier in input files, which allows insertio…
Browse files Browse the repository at this point in the history
…n of silence of specified duration instead of speech. Added support for non-integer inter-snippet durations. Added --fi, --fo options (fade-in and fade-out durations).
  • Loading branch information
Jeffrey Wright committed Feb 26, 2023
1 parent 505cbb8 commit fc4de3a
Show file tree
Hide file tree
Showing 3 changed files with 732 additions and 572 deletions.
5 changes: 2 additions & 3 deletions audio_program_generator/apg.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ def capture(cleaned: str = "") -> list:

cln = clean(phrase_file_contents)
cpt = [c[:2] for c in capture(cln)]
return cpt
# return capture(clean(phrase_file_contents))
return [(c[0].strip(), c[1]) for c in cpt]


class AudioProgramGenerator:
Expand Down Expand Up @@ -98,7 +97,7 @@ def _create_tmp_speech_file(
"""Thread worker function to turn a phrase into encoded snippet or silence"""
if phrase_handler.phrase == "*":
tempfile = audio_segment = AudioSegment.silent(
duration=phrase_handler.duration * 1000
duration=int(phrase_handler.duration) * 1000
)
else:
tempfile = BytesIO(None)
Expand Down
Loading

0 comments on commit fc4de3a

Please sign in to comment.