PyThaiTTS

Open Source Thai Text-to-speech library in Python

class pythaitts.TTS(pretrained='khanomtan', mode='last_checkpoint', version='1.0', device: str = 'cpu')[source]
__init__(pretrained='khanomtan', mode='last_checkpoint', version='1.0', device: str = 'cpu') None[source]
Parameters:
  • pretrained (str) – TTS pretrained (khanomtan, lunarlist)

  • mode (str) – pretrained mode

  • version (str) – model version (default is 1.0 or 1.1)

Options for mode
  • last_checkpoint (default) - last checkpoint of model

  • best_model - Best model (best loss)

You can see more about khanomtan tts at https://github.com/wannaphong/KhanomTan-TTS-v1.0 and https://github.com/wannaphong/KhanomTan-TTS-v1.1

For lunarlist tts model, you must to install nemo before use the model by pip install nemo_toolkit[‘tts’]. You can see more about lunarlist tts at https://link.medium.com/OpPjQis6wBb

load_pretrained(version)[source]

Load pretrined

tts(text: str, speaker_idx: str = 'Linda', language_idx: str = 'th-th', return_type: str = 'file', filename: Optional[str] = None)[source]

speech synthesis

Parameters:
  • text (str) – text

  • speaker_idx (str) – speaker (default is Linda)

  • language_idx (str) – language (default is th-th)

  • return_type (str) – return type (default is file)

  • filename (str) – path filename for save wav file if return_type is file.