Skip to content

Methods

Artem Dikarev edited this page Mar 28, 2025 · 1 revision

TTS-with-RVC Function Documentation

set_index_path(index_path)

Updates the path to the index file for voice model adjustments.

  • index_path (str): Path to the RVC .index file
  • If the index path doesn't exist and isn't an empty string, a warning message is printed
  • When a valid path is provided, it prints confirmation and updates the internal index path

voiceover_file(input_path, pitch=0, output_directory=None, filename=None, index_rate=0.75)

Applies RVC voice conversion directly to an existing audio file without TTS.

  • input_path (str): Path to the input audio file (WAV recommended)
  • pitch (int, optional): Pitch change (transpose) for RVC in semitones (default: 0)
  • output_directory (str, optional): Directory to save voiceovered audios (default: TTS_RVC's output directory)
  • filename (str, optional): Name for the output file (default: None, derived from input name + hash)
  • index_rate (float, optional): Contribution of the RVC index file (0 to 1) (default: 0.75)

Returns:

  • str: The absolute path to the converted audio file

Raises:

  • FileNotFoundError: If the input file doesn't exist
  • RuntimeError: If RVC process fails
  • ValueError: If parameters are invalid
from tts_with_rvc import TTS_RVC

# Initialize with your RVC model
tts = TTS_RVC(
    model_path="path/to/your/model.pth",
    index_path="path/to/your/model.index",  # Optional
    voice="en-US-GuyNeural",  # Edge TTS voice
    output_directory="output_folder"
)

# Update index path
tts.set_index_path("path/to/new/index.index")

# Convert existing audio file
converted_path = tts.voiceover_file(
    input_path="path/to/input.wav",
    pitch=0
)

print(f"Converted audio saved to: {converted_path}")