sitcom_simulator.speech.integrations.fakeyou¶
Functions
|
Strips all non-alphanumeric characters from the input string. |
|
Returns the input string up to the first parenthesis with all non-alphanumeric characters removed. |
|
Downloads audio from a given URL and saves it to a temporary file. |
Fetches the list of available voices from the FakeYou API. |
|
|
Sequentially generates voices for each line in the script using the FakeYou API. |
Scans the prompt for character names and returns a dictionary of character names to a list of voice tokens. |
|
|
Signs in to the FakeYou API and returns the session cookie. |
|
- sitcom_simulator.speech.integrations.fakeyou.download_voice(url)¶
Downloads audio from a given URL and saves it to a temporary file.
- Parameters:
url (
str
) – The URL of the audio to download
- sitcom_simulator.speech.integrations.fakeyou.fetch_voicelist()¶
Fetches the list of available voices from the FakeYou API.
- sitcom_simulator.speech.integrations.fakeyou.string_to_keywords(string, stop_at_first_paren=False)¶
- Return type:
Set
[str
]- Parameters:
string (str)
- sitcom_simulator.speech.integrations.fakeyou.alphanumeric_to_first_paren(string)¶
Returns the input string up to the first parenthesis with all non-alphanumeric characters removed.
- Parameters:
string (
str
) – The input string- Return type:
str
- sitcom_simulator.speech.integrations.fakeyou.alphanumeric(string)¶
Strips all non-alphanumeric characters from the input string.
- Parameters:
string (
str
) – The input string
- sitcom_simulator.speech.integrations.fakeyou.get_possible_characters_from_prompt(prompt)¶
Scans the prompt for character names and returns a dictionary of character names to a list of voice tokens.
- Parameters:
prompt (
str
) – The prompt for the script- Return type:
dict
- sitcom_simulator.speech.integrations.fakeyou.sign_in(username_or_email, password)¶
Signs in to the FakeYou API and returns the session cookie.
- Return type:
str
- Parameters:
username_or_email (str)
password (str)
- sitcom_simulator.speech.integrations.fakeyou.generate_voices(script, on_voice_url_generated=None, job_delay=30, poll_delay=10, cookie=None)¶
Sequentially generates voices for each line in the script using the FakeYou API. It is intentionally slow to avoid getting rate limited. It can be sped up by having FAKEYOU_USERNAME and FAKEYOU_PASSWORD set as environment variables.
- Parameters:
script (
Script
) – The script to generate voices foron_voice_generated – A callback function to call when a voice is generated which takes the clip index and the URL of the generated audio
job_delay (
float
) – The number of seconds to wait between starting audio generation jobs. Lower values render faster but are more likely to get rate limitedpoll_delay (
float
) – The number of seconds to wait between polling for audio generation job completioncookie (
str
|None
) – The session cookie to use for the FakeYou API (acquired from sign_in)on_voice_url_generated (Callable[[int, str], None] | None)
- Return type:
List
[str
|None
]