Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion rwc/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
"""
import click
import os

from rwc import __version__
from rwc.core import VoiceConverter


@click.group()
@click.version_option()
@click.version_option(version=__version__, prog_name="rwc")
def cli():
"""Real-time Voice Conversion CLI."""
pass
Expand Down
18 changes: 12 additions & 6 deletions rwc/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ def __init__(
self.config_path = config_path or 'rwc/config.ini'
self.config = self._load_config()

# Use parameter if provided, otherwise use config default
self.use_rmvpe = use_rmvpe if use_rmvpe is not None else self.config.getboolean('CONVERSION', 'use_rmvpe_by_default', fallback=True)
# Track whether RMVPE was requested and whether it's actually available
self.use_rmvpe = use_rmvpe if use_rmvpe is not None else self.config.getboolean(
'CONVERSION', 'use_rmvpe_by_default', fallback=True
)
self.rmvpe_available = False

self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
logger.info(f"Using device: {self.device}")
Expand Down Expand Up @@ -132,9 +135,10 @@ def _load_rmvpe_model(self):
print(f"Loading RMVPE model from {rmvpe_path}")
# In a full implementation, we would load the actual model here
self.rmvpe_model = rmvpe_path
self.rmvpe_available = True
else:
print(f"RMVPE model not found at {rmvpe_path}, falling back to built-in pitch extraction")
self.use_rmvpe = False
self.rmvpe_available = False

def convert_voice(
self,
Expand Down Expand Up @@ -198,9 +202,11 @@ def convert_voice(
# ultimate-rvc uses semitones directly (same as rwc's pitch_shift)
# ultimate-rvc's index_rate maps directly to rwc's index_rate

f0_methods = [F0Method.RMVPE] # Use RMVPE for pitch extraction
if not self.use_rmvpe:
f0_methods = [F0Method.CREPE] # Fallback to CREPE
rmvpe_active = self.use_rmvpe and self.rmvpe_available
if self.use_rmvpe and not rmvpe_active:
logger.warning("RMVPE requested but model not available. Falling back to CREPE.")

f0_methods = [F0Method.RMVPE] if rmvpe_active else [F0Method.CREPE]

logger.info(f"Converting with model: {model_name}")
logger.info(f"Pitch shift: {pitch_shift} semitones")
Expand Down
Loading