Format code (#1153)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
github-actions[bot] 2023-09-01 12:03:35 +08:00 committed by GitHub
parent 0c75454ddf
commit d634c2727e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 16 deletions

View File

@ -303,8 +303,16 @@ if __name__ == "__main__":
), ),
], ],
[ [
sg.Checkbox(i18n("输入降噪"), key="I_noise_reduce", enable_events=True), sg.Checkbox(
sg.Checkbox(i18n("输出降噪"), key="O_noise_reduce", enable_events=True), i18n("输入降噪"),
key="I_noise_reduce",
enable_events=True,
),
sg.Checkbox(
i18n("输出降噪"),
key="O_noise_reduce",
enable_events=True,
),
], ],
], ],
title=i18n("性能设置"), title=i18n("性能设置"),
@ -377,7 +385,7 @@ if __name__ == "__main__":
self.flag_vc = False self.flag_vc = False
# Parameter hot update # Parameter hot update
if event == 'threhold': if event == "threhold":
self.config.threhold = values["threhold"] self.config.threhold = values["threhold"]
elif event == "pitch": elif event == "pitch":
self.config.pitch = values["pitch"] self.config.pitch = values["pitch"]
@ -389,9 +397,9 @@ if __name__ == "__main__":
self.rvc.change_index_rate(values["index_rate"]) self.rvc.change_index_rate(values["index_rate"])
elif event in ["pm", "harvest", "crepe", "rmvpe"]: elif event in ["pm", "harvest", "crepe", "rmvpe"]:
self.config.f0method = event self.config.f0method = event
elif event == 'I_noise_reduce': elif event == "I_noise_reduce":
self.config.I_noise_reduce = values["I_noise_reduce"] self.config.I_noise_reduce = values["I_noise_reduce"]
elif event == 'O_noise_reduce': elif event == "O_noise_reduce":
self.config.O_noise_reduce = values["O_noise_reduce"] self.config.O_noise_reduce = values["O_noise_reduce"]
elif event != "start_vc" and self.flag_vc == True: elif event != "start_vc" and self.flag_vc == True:
# Other parameters do not support hot update # Other parameters do not support hot update
@ -502,9 +510,20 @@ if __name__ == "__main__":
self.sola_buffer: torch.Tensor = torch.zeros( self.sola_buffer: torch.Tensor = torch.zeros(
self.crossfade_frame, device=device, dtype=torch.float32 self.crossfade_frame, device=device, dtype=torch.float32
) )
self.fade_in_window: torch.Tensor = torch.sin(0.5 * np.pi * torch.linspace( self.fade_in_window: torch.Tensor = (
0.0, 1.0, steps=self.crossfade_frame, device=device, dtype=torch.float32 torch.sin(
)) ** 2 0.5
* np.pi
* torch.linspace(
0.0,
1.0,
steps=self.crossfade_frame,
device=device,
dtype=torch.float32,
)
)
** 2
)
self.fade_out_window: torch.Tensor = 1 - self.fade_in_window self.fade_out_window: torch.Tensor = 1 - self.fade_in_window
self.resampler = tat.Resample( self.resampler = tat.Resample(
orig_freq=self.config.samplerate, new_freq=16000, dtype=torch.float32 orig_freq=self.config.samplerate, new_freq=16000, dtype=torch.float32