Add Windows realtime voice changer (RVC via Applio) + set operator to 사금향
- voice-changer/: install.bat (uv + Python 3.12 + pinned Applio + torch cu128), VoiceChanger.exe launcher (mingw), tkinter GUI (model list, auto ±12 pitch across genders, mic/output/monitor devices, latency, noise gate), train.bat (preprocess/extract/train/index → models/<id>), examples.bat (Korean example models from KSS + Zeroth-Korean), build-release.sh - consent-recorder: default OPERATOR_NAME=사금향 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
59
voice-changer/app/models.py
Normal file
59
voice-changer/app/models.py
Normal file
@@ -0,0 +1,59 @@
|
||||
"""models/<아이디>/ 안의 model.pth · model.index · info.json 을 목록으로 읽는다."""
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
from common import MODELS, load_json
|
||||
|
||||
GENDERS = {"male": "남성", "female": "여성"}
|
||||
|
||||
|
||||
@dataclass
|
||||
class VoiceModel:
|
||||
id: str
|
||||
name: str
|
||||
gender: str # male | female
|
||||
pth: Path
|
||||
index: Optional[Path]
|
||||
source: str
|
||||
license: str
|
||||
example: bool
|
||||
|
||||
@property
|
||||
def label(self) -> str:
|
||||
tag = " · 예시" if self.example else ""
|
||||
return f"{self.name} ({GENDERS.get(self.gender, '?')}{tag})"
|
||||
|
||||
|
||||
def list_models(root: Path = MODELS) -> list[VoiceModel]:
|
||||
out = []
|
||||
if not root.is_dir():
|
||||
return out
|
||||
for d in sorted(root.iterdir()):
|
||||
pth = d / "model.pth"
|
||||
if not d.is_dir() or not pth.is_file():
|
||||
continue
|
||||
info = load_json(d / "info.json", {})
|
||||
idx = d / "model.index"
|
||||
out.append(
|
||||
VoiceModel(
|
||||
id=d.name,
|
||||
name=info.get("name") or d.name,
|
||||
gender=info.get("gender") if info.get("gender") in GENDERS else "male",
|
||||
pth=pth,
|
||||
index=idx if idx.is_file() else None,
|
||||
source=info.get("source", ""),
|
||||
license=info.get("license", ""),
|
||||
example=bool(info.get("example")),
|
||||
)
|
||||
)
|
||||
# 직접 만든 모델 먼저, 예시는 뒤로
|
||||
out.sort(key=lambda m: (m.example, m.name))
|
||||
return out
|
||||
|
||||
|
||||
def auto_pitch(my_gender: str, model_gender: str) -> int:
|
||||
"""성별이 다르면 한 옥타브(12반음) 올리거나 내린다. 같으면 0."""
|
||||
if my_gender == model_gender:
|
||||
return 0
|
||||
return 12 if model_gender == "female" else -12
|
||||
Reference in New Issue
Block a user