-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.py
75 lines (62 loc) · 2.32 KB
/
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import os
import configparser
from dotenv import load_dotenv
from multiprocessing import cpu_count
load_dotenv()
HF_TOKEN = os.getenv("HF_TOKEN")
MODEL_DIR = os.getenv("MODEL_DIRECTORY")
OUTPUT_DIR = os.getenv("OUTPUT_DIRECTORY")
VOICES_DIRECTORY = os.getenv("VOICES_DIRECTORY")
RVC_MODEL_DIR = os.getenv("weight_root")
INDEX_DIR = os.getenv("index_root")
config = configparser.ConfigParser()
config.read('config.ini')
HOSTNAME = config.get('Network', 'host')
PORT = config.getint('Network', 'port')
DEVICE = config.get('General', 'device')
COMPUTE_TYPE = config.get('General', 'compute_type')
TTS_TYPE = config.get('TTS', 'tts_type')
VOICE_CHUNK_DURATION_SIZE = 10
class RVCSettings:
def __init__(self):
self.pth_path = os.path.join(RVC_MODEL_DIR, "FrierenFrierenv3_e150_s15000.pth")
self.index_path = os.path.join(INDEX_DIR, "added_IVF3217_Flat_nprobe_1_FrierenFrierenv3_v2.index")
self.I_noise_reduce: bool = True
self.O_noise_reduce: bool = False
self.use_pv: bool = False
self.pitch: int = 0
self.samplerate: int = 24000
self.channels: int = 1
self.threshold: int = -40
self.index_rate: float = 1
self.crossfade_time: float = 0.05
self.block_time: float = .5
self.extra_time: float = 2.5
self.rms_mix_rate: float = 1
self.sr_type = "sr_model"
self.function = "vc"
self.f0method = "rmvpe"
self.n_cpu: int = min(cpu_count(), 4)
class VCSettings:
def __init__(self):
self.model_path = "FrierenFrierenv3_e150_s15000.pth"
self.f0_up_key=0
self.input_path=None
self.orig_sr = 24000
self.output_dir_path=None
self.f0method="rmvpe"
self.file_index = os.path.join(INDEX_DIR, "added_IVF3217_Flat_nprobe_1_FrierenFrierenv3_v2.index")
self.file_index2=""
self.index_rate=1
self.filter_radius=3
self.resample_sr=None
self.rms_mix_rate=1.0
self.protect=0.33
self.verbose=False
class AudioProcessorSettings:
def __init__(self):
self.device = DEVICE
self.compute_type = COMPUTE_TYPE
self.language = config.get('Model Settings', 'language')
self.whisper_arch = config.get('Model Settings', 'whisper_arch')
self.batch_size = config.getint('Model Settings', 'batch_size')