create_voice_string.py 370 B

123456789101112
  1. from bark.generation import SUPPORTED_LANGS
  2. from typing import Union
  3. import os
  4. def create_voice_string(
  5. language: str, speaker_id: Union[int, str], use_v2: bool
  6. ) -> str:
  7. history_prompt = f"{SUPPORTED_LANGS[language][1]}_speaker_{speaker_id}" # type: ignore
  8. if use_v2:
  9. history_prompt = os.path.join("v2", history_prompt)
  10. return history_prompt