class_docstr: TODO: Add voice conversion and Capacitron support.
docstr: 🐸TTS python interface that allows to load and use the released models.
  
  Example with a multi-speaker model:
      >>> from TTS.api import TTS
      >>> tts = TTS(TTS.list_models()[0])
      >>> wav = tts.tts("This is a test! This is also a test!!", speaker=tts.speakers[0], language=tts.languages[0])
      >>> tts.tts_to_file(text="Hello world!", speaker=tts.speakers[0], language=tts.languages[0], file_path="output.wav")
  
  Example with a single-speaker model:
      >>> tts = TTS(model_name="tts_models/de/thorsten/tacotron2-DDC", progress_bar=False, gpu=False)
      >>> tts.tts_to_file(text="Ich bin eine Testnachricht.", file_path="output.wav")
  
  Example loading a model from a path:
      >>> tts = TTS(model_path="/path/to/checkpoint_100000.pth", config_path="/path/to/config.json", progress_bar=False, gpu=False)
      >>> tts.tts_to_file(text="Ich bin eine Testnachricht.", file_path="output.wav")
  
  Example voice cloning with YourTTS in English, French and Portuguese:
      >>> tts = TTS(model_name="tts_models/multilingual/multi-dataset/your_tts", progress_bar=False, gpu=True)
      >>> tts.tts_to_file("This is voice cloning.", speaker_wav="my/cloning/audio.wav", language="en", file_path="thisisit.wav")
      >>> tts.tts_to_file("C'est le clonage de la voix.", speaker_wav="my/cloning/audio.wav", language="fr", file_path="thisisit.wav")
      >>> tts.tts_to_file("Isso é clonagem de voz.", speaker_wav="my/cloning/audio.wav", language="pt", file_path="thisisit.wav")
  
  Example Fairseq TTS models (uses ISO language codes in https://dl.fbaipublicfiles.com/mms/tts/all-tts-languages.html):
      >>> tts = TTS(model_name="tts_models/eng/fairseq/vits", progress_bar=False, gpu=True)
      >>> tts.tts_to_file("This is a test.", file_path="output.wav")
  
  Args:
      model_name (str, optional): Model name to load. You can list models by ```tts.models```. Defaults to None.
      model_path (str, optional): Path to the model checkpoint. Defaults to None.
      config_path (str, optional): Path to the model config. Defaults to None.
      vocoder_path (str, optional): Path to the vocoder checkpoint. Defaults to None.
      vocoder_config_path (str, optional): Path to the vocoder config. Defaults to None.
      progress_bar (bool, optional): Whether to pring a progress bar while downloading a model. Defaults to True.
      gpu (bool, optional): Enable/disable GPU. Some models might be too slow on CPU. Defaults to False.
docstr_tok: ["\ud83d\udc38TTS","python","interface","that","allows","to","load","and","use","the","released","models",".","Example","with","a","multi-speaker","model",":",">",">",">","from","TTS.api","import","TTS",">",">",">","tts","=","TTS","(","TTS.list_models","(",")","[","0","]",")",">",">",">","wav","=","tts.tts","(","``","This","is","a","test","!","This","is","also","a","test","!","!","``",",","speaker=tts.speakers","[","0","]",",","language=tts.languages","[","0","]",")",">",">",">","tts.tts_to_file","(","text=","''","Hello","world","!","``",",","speaker=tts.speakers","[","0","]",",","language=tts.languages","[","0","]",",","file_path=","''","output.wav","''",")","Example","with","a","single-speaker","model",":",">",">",">","tts","=","TTS","(","model_name=","''","tts_models\/de\/thorsten\/tacotron2-DDC","''",",","progress_bar=False",",","gpu=False",")",">",">",">","tts.tts_to_file","(","text=","''","Ich","bin","eine","Testnachricht",".","``",",","file_path=","''","output.wav","''",")","Example","loading","a","model","from","a","path",":",">",">",">","tts","=","TTS","(","model_path=","''","\/path\/to\/checkpoint_100000.pth","''",",","config_path=","''","\/path\/to\/config.json","''",",","progress_bar=False",",","gpu=False",")",">",">",">","tts.tts_to_file","(","text=","''","Ich","bin","eine","Testnachricht",".","``",",","file_path=","''","output.wav","''",")","Example","voice","cloning","with","YourTTS","in","English",",","French","and","Portuguese",":",">",">",">","tts","=","TTS","(","model_name=","''","tts_models\/multilingual\/multi-dataset\/your_tts","''",",","progress_bar=False",",","gpu=True",")",">",">",">","tts.tts_to_file","(","``","This","is","voice","cloning",".","``",",","speaker_wav=","''","my\/cloning\/audio.wav","''",",","language=","''","en","''",",","file_path=","''","thisisit.wav","''",")",">",">",">","tts.tts_to_file","(","``","C'est","le","clonage","de","la","voix",".","``",",","speaker_wav=","''","my\/cloning\/audio.wav","''",",","language=","''","fr","''",",","file_path=","''","thisisit.wav","''",")",">",">",">","tts.tts_to_file","(","``","Isso","\u00e9","clonagem","de","voz",".","``",",","speaker_wav=","''","my\/cloning\/audio.wav","''",",","language=","''","pt","''",",","file_path=","''","thisisit.wav","''",")","Example","Fairseq","TTS","models","(","uses","ISO","language","codes","in","https",":","\/\/dl.fbaipublicfiles.com\/mms\/tts\/all-tts-languages.html",")",":",">",">",">","tts","=","TTS","(","model_name=","''","tts_models\/eng\/fairseq\/vits","''",",","progress_bar=False",",","gpu=True",")",">",">",">","tts.tts_to_file","(","``","This","is","a","test",".","``",",","file_path=","''","output.wav","''",")","Args",":","model_name","(","str",",","optional",")",":","Model","name","to","load",".","You","can","list","models","by","``","`","tts.models","``","`",".","Defaults","to","None",".","model_path","(","str",",","optional",")",":","Path","to","the","model","checkpoint",".","Defaults","to","None",".","config_path","(","str",",","optional",")",":","Path","to","the","model","config",".","Defaults","to","None",".","vocoder_path","(","str",",","optional",")",":","Path","to","the","vocoder","checkpoint",".","Defaults","to","None",".","vocoder_config_path","(","str",",","optional",")",":","Path","to","the","vocoder","config",".","Defaults","to","None",".","progress_bar","(","bool",",","optional",")",":","Whether","to","pring","a","progress","bar","while","downloading","a","model",".","Defaults","to","True",".","gpu","(","bool",",","optional",")",":","Enable\/disable","GPU",".","Some","models","might","be","too","slow","on","CPU",".","Defaults","to","False","."]
code: def __init__(
      self,
      model_name: str = "",
      model_path: str = None,
      config_path: str = None,
      vocoder_path: str = None,
      vocoder_config_path: str = None,
      progress_bar: bool = True,
      gpu=False,
  ):
      """🐸TTS python interface that allows to load and use the released models.
  
      Example with a multi-speaker model:
          >>> from TTS.api import TTS
          >>> tts = TTS(TTS.list_models()[0])
          >>> wav = tts.tts("This is a test! This is also a test!!", speaker=tts.speakers[0], language=tts.languages[0])
          >>> tts.tts_to_file(text="Hello world!", speaker=tts.speakers[0], language=tts.languages[0], file_path="output.wav")
  
      Example with a single-speaker model:
          >>> tts = TTS(model_name="tts_models/de/thorsten/tacotron2-DDC", progress_bar=False, gpu=False)
          >>> tts.tts_to_file(text="Ich bin eine Testnachricht.", file_path="output.wav")
  
      Example loading a model from a path:
          >>> tts = TTS(model_path="/path/to/checkpoint_100000.pth", config_path="/path/to/config.json", progress_bar=False, gpu=False)
          >>> tts.tts_to_file(text="Ich bin eine Testnachricht.", file_path="output.wav")
  
      Example voice cloning with YourTTS in English, French and Portuguese:
          >>> tts = TTS(model_name="tts_models/multilingual/multi-dataset/your_tts", progress_bar=False, gpu=True)
          >>> tts.tts_to_file("This is voice cloning.", speaker_wav="my/cloning/audio.wav", language="en", file_path="thisisit.wav")
          >>> tts.tts_to_file("C'est le clonage de la voix.", speaker_wav="my/cloning/audio.wav", language="fr", file_path="thisisit.wav")
          >>> tts.tts_to_file("Isso é clonagem de voz.", speaker_wav="my/cloning/audio.wav", language="pt", file_path="thisisit.wav")
  
      Example Fairseq TTS models (uses ISO language codes in https://dl.fbaipublicfiles.com/mms/tts/all-tts-languages.html):
          >>> tts = TTS(model_name="tts_models/eng/fairseq/vits", progress_bar=False, gpu=True)
          >>> tts.tts_to_file("This is a test.", file_path="output.wav")
  
      Args:
          model_name (str, optional): Model name to load. You can list models by ```tts.models```. Defaults to None.
          model_path (str, optional): Path to the model checkpoint. Defaults to None.
          config_path (str, optional): Path to the model config. Defaults to None.
          vocoder_path (str, optional): Path to the vocoder checkpoint. Defaults to None.
          vocoder_config_path (str, optional): Path to the vocoder config. Defaults to None.
          progress_bar (bool, optional): Whether to pring a progress bar while downloading a model. Defaults to True.
          gpu (bool, optional): Enable/disable GPU. Some models might be too slow on CPU. Defaults to False.
      """
      super().__init__()
      self.manager = ModelManager(
          models_file=self.get_models_file_path(),
          progress_bar=progress_bar,
          verbose=False,
      )
      self.config = load_config(config_path) if config_path else None
      self.synthesizer = None
      self.voice_converter = None
      self.model_name = ""
      if gpu:
          warnings.warn(
              "`gpu` will be deprecated. Please use `tts.to(device)` instead."
          )
  
      if model_name is not None and len(model_name) > 0:
          if "tts_models" in model_name:
              self.load_tts_model_by_name(model_name, gpu)
          elif "voice_conversion_models" in model_name:
              self.load_vc_model_by_name(model_name, gpu)
          else:
              self.load_model_by_name(model_name, gpu)
  
      if model_path:
          self.load_tts_model_by_path(
              model_path,
              config_path,
              vocoder_path=vocoder_path,
              vocoder_config=vocoder_config_path,
              gpu=gpu,
          )
  
imports: import tempfile
  import warnings
  from pathlib import Path
  from typing import Union
  import numpy
  from torch import nn
  from TTS.utils.audio.numpy_transforms import save_wav
  from TTS.utils.manage import ModelManager
  from TTS.utils.synthesizer import Synthesizer
  from TTS.config import load_config
label_desc: Use image node_id 1 to create a new TTS object from inherited base classes: nn with example: obj = TTS(model_name, model_path, config_path, vocoder_path, vocoder_config_path, progress_bar, gpu)