sitcom_simulator.speech.speech_generator

Functions

add_voices(script[, engine, ...])

Given a script, returns the same script but with the audio paths filled in.

generate_voices(script[, engine, ...])

Generates and returns a list of voice clip paths for the given script using the given engine.

sitcom_simulator.speech.speech_generator.generate_voices(script, engine='fakeyou', on_voice_downloaded=None, fakeyou_on_voice_url_generated=None, fakeyou_job_delay=30, fakeyou_poll_delay=10)

Generates and returns a list of voice clip paths for the given script using the given engine.

More procedural in nature than add_voices. This function is typically not used directly, since add_voices is more pleasant to work with.

Parameters:
  • script (Script) – The script to generate voice clips for

  • engine (Literal['fakeyou', 'gtts']) – The engine to use for generating voice clips

  • on_voice_downloaded (Optional[Callable[[int, str], None]]) – A callback to call after each voice clip is downloaded which takes the clip index and path to the downloaded audio

  • fakeyou_on_voice_url_generated (Optional[Callable[[int, str], None]]) – A callback to call after each FakeYou voice clip is generated which takes the clip index and url of the generated audio

  • fakeyou_job_delay (int) – The number of seconds to wait between starting audio generation jobs. Lower values render faster but are more likely to get rate limited

  • fakeyou_poll_delay (int) – The number of seconds to wait between polling for audio generation job completion

sitcom_simulator.speech.speech_generator.add_voices(script, engine='fakeyou', on_voice_generated=None, fakeyou_job_delay=30, fakeyou_poll_delay=10)

Given a script, returns the same script but with the audio paths filled in.

More functional in nature than generate_voices.

Parameters:
  • script (Script) – The script to add voices to

  • engine (Literal['fakeyou', 'gtts']) – The engine to use for generating voice clips

  • on_voice_generated (Optional[Callable[[int, str], None]]) – A callback to call after each voice clip is generated which takes the clip index and path to the generated audio

  • fakeyou_job_delay (int) – The number of seconds to wait between starting audio generation jobs. Lower values render faster but are more likely to get rate limited. (FakeYou only)

  • fakeyou_poll_delay (int) – The number of seconds to wait between polling for audio generation job completion. (FakeYou only)