Views
No views yet
zipfile, os, subprocess1from google.colab import drive
2drive.mount("/content/drive")1import os
2import subprocess
3
4input_path = "/content/final_VITS_dataset/wavs"
5output_path = "/content/VITS_processed_dataset/wavs"
6os.makedirs(output_path, exist_ok=True)1from TTS.utils.synthesizer import Synthesizer
2
3# Updated parameters for the synthesizer
4model_path = "/content/drive/MyDrive/VITS-TRIAL-PHON-2/runs/VITS-AR-phon-2-December-23-2024_12+04AM-0000000/checkpoint_58000.pth"
5config_path = "/content/drive/MyDrive/VITS-TRIAL-PHON-2/runs/VITS-AR-phon-2-December-23-2024_12+04AM-0000000/config.json"
6
7# Initialize the synthesizer
8synthesizer = Synthesizer(
9 tts_checkpoint=model_path,
10 tts_config_path=config_path,
11 vocoder_checkpoint=None,
12)
13
14# Adjust speech parameters for slower, clearer output
15synthesizer.tts_model.args.length_scale = 2 # Increase for slower speech
16synthesizer.tts_model.args.inference_noise_scale = 0.5 # Reduce noise
17synthesizer.tts_model.args.inference_noise_scale_dp = 0.8 # Reduce noise distortions
18
19# Text to synthesize
20text = "عامل ايه يا حبيبي واحشني أوي فينك من زمان كده"
21
22# Generate speech
23wav = synthesizer.tts(text)
24
25# Save the output to a file
26output_path = "output_slow_clear.wav"
27synthesizer.save_wav(wav, output_path)
28
29print(f"Audio saved to {output_path}")
30
31from IPython.display import Audio
32Audio(output_path, autoplay=True)