@@ -52,7 +52,7 @@ def __init__(
52
52
self .model = self .model .half ()
53
53
self .model .eval ()
54
54
cpt = torch .load (pth_path , map_location = "cpu" )
55
- tgt_sr = cpt ["config" ][- 1 ]
55
+ self . tgt_sr = cpt ["config" ][- 1 ]
56
56
cpt ["config" ][- 3 ] = cpt ["weight" ]["emb_g.weight" ].shape [0 ] # n_spk
57
57
self .if_f0 = cpt .get ("f0" , 1 )
58
58
if self .if_f0 == 1 :
@@ -374,10 +374,10 @@ def start_vc(self):
374
374
self .block_frame = int (self .config .block_time * self .config .samplerate )
375
375
self .crossfade_frame = int (self .config .crossfade_time * self .config .samplerate )
376
376
self .sola_search_frame = int (0.012 * self .config .samplerate )
377
- self .delay_frame = int (0.02 * self .config .samplerate ) # 往前预留0.02s
377
+ self .delay_frame = int (0.01 * self .config .samplerate ) # 往前预留0.02s
378
378
self .extra_frame = int (
379
379
self .config .extra_time * self .config .samplerate
380
- ) # 往后预留0.04s
380
+ )
381
381
self .rvc = None
382
382
self .rvc = RVC (
383
383
self .config .pitch ,
@@ -408,7 +408,7 @@ def start_vc(self):
408
408
orig_freq = self .config .samplerate , new_freq = 16000 , dtype = torch .float32
409
409
)
410
410
self .resampler2 = tat .Resample (
411
- orig_freq = 40000 , new_freq = self .config .samplerate , dtype = torch .float32
411
+ orig_freq = self . rvc . tgt_sr , new_freq = self .config .samplerate , dtype = torch .float32
412
412
)
413
413
thread_vc = threading .Thread (target = self .soundinput )
414
414
thread_vc .start ()
0 commit comments