from TTS.api import TTS import torch from datetime import datetime tts = TTS("tts_models/en/multi-dataset/tortoise-v2") device = torch.device("cuda" if torch.cuda.is_available() else "cpu") tts.to(device) text="There is, therefore, an increasing need to understand BEVs from a systems perspective. This involves an in-depth consideration of the environmental impact of the product using life cycle assessment (LCA) as well as taking a broader 'circular economy' approach. On the one hand, LCA is a means of assessing the environmental impact associated with all stages of a product's life from cradle to grave: from raw material extraction and processing to the product's manufacture to its use in everyday life and finally to its end of life." # cloning `lj` voice from `TTS/tts/utils/assets/tortoise/voices/lj` # with custom inference settings overriding defaults. time_now = datetime.now().strftime("%Y%m%d%H%M%S") output_path = f"output/tortoise_{time_now}.wav" tts.tts_to_file(text, file_path=output_path, voice_dir="voices", speaker="test", split_sentences=False, # Change to True if context is not enough num_autoregressive_samples=20, diffusion_iterations=50) # # Using presets with the same voice # tts.tts_to_file(text, # file_path="output.wav", # voice_dir="path/to/tortoise/voices/dir/", # speaker="lj", # preset="ultra_fast") # # Random voice generation # tts.tts_to_file(text, # file_path="output.wav")