tts-1.6b-en_fr / utils.py
rumbleFTW's picture
tts
f2c3e4e verified
raw
history blame contribute delete
648 Bytes
import os
def load_voice_path(voice):
"""Load the voice path from the given voice identifier."""
return os.path.join("path_to_voice_repo", voice)
def load_configuration(config_file):
"""Load configuration settings from a specified file."""
import json
with open(config_file, 'r') as f:
return json.load(f)
def save_audio_file(audio, file_path):
"""Save the generated audio to a specified file path."""
from scipy.io.wavfile import write
write(file_path, 22050, audio) # Assuming a sample rate of 22050 Hz
def clip_audio(audio):
"""Clip audio to the range [-1, 1]."""
return np.clip(audio, -1, 1)