mirror of
https://github.com/Mangio621/Mangio-RVC-Fork.git
synced 2026-02-24 03:49:51 +01:00
patch for new fixes i made before
remade system of reading the formant settings on startup (still janky as hell, going to remake with sql) fixed when value is true in the txt but the checkbox isn't checked. therefore, also fixed when other parts of formanting in the ui doesn't appear. my_utils.py now utilizes the stftpitchshift from local environment instead of globally installed one.
This commit is contained in:
21
infer-web.py
21
infer-web.py
@@ -57,14 +57,21 @@ os.environ["TEMP"] = tmp
|
||||
warnings.filterwarnings("ignore")
|
||||
torch.manual_seed(114514)
|
||||
|
||||
DoFormant = False
|
||||
Quefrency = 8.0
|
||||
Timbre = 1.2
|
||||
global DoFormant, Quefrency, Timbre
|
||||
|
||||
with open('formanting.txt', 'w+') as fsf:
|
||||
fsf.truncate(0)
|
||||
|
||||
fsf.writelines([str(DoFormant) + '\n', str(Quefrency) + '\n', str(Timbre) + '\n'])
|
||||
try:
|
||||
with open('formanting.txt', 'r') as psx:
|
||||
content = psx.readlines()
|
||||
Quefrency, Timbre = content[1].split('\n')[0], content[2].split('\n')[0]
|
||||
DoFormant = True if content[0].split('\n')[0] == 'True' else False
|
||||
|
||||
except Exception:
|
||||
with open('formanting.txt', 'w+') as fsf:
|
||||
fsf.truncate(0)
|
||||
DoFormant = False
|
||||
Quefrency, Timbre = 8.0, 1.2
|
||||
fsf.writelines([str(DoFormant) + '\n', str(Quefrency) + '\n', str(Timbre) + '\n'])
|
||||
|
||||
|
||||
config = Config()
|
||||
@@ -2126,7 +2133,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
||||
)
|
||||
|
||||
formant_preset.change(fn=preset_apply, inputs=[formant_preset, qfrency, tmbre], outputs=[qfrency, tmbre])
|
||||
frmntbut = gr.Button("Apply", variant="primary", visible=False)
|
||||
frmntbut = gr.Button("Apply", variant="primary", visible=DoFormant)
|
||||
formanting.change(fn=formant_enabled,inputs=[formanting,qfrency,tmbre,frmntbut,formant_preset,formant_refresh_button],outputs=[formanting,qfrency,tmbre,frmntbut,formant_preset,formant_refresh_button])
|
||||
frmntbut.click(fn=formant_apply,inputs=[qfrency, tmbre], outputs=[qfrency, tmbre])
|
||||
formant_refresh_button.click(fn=update_fshift_presets,inputs=[formant_preset, qfrency, tmbre],outputs=[formant_preset, qfrency, tmbre])
|
||||
|
||||
@@ -34,15 +34,14 @@ def load_audio(file, sr, DoFormant, Quefrency, Timbre):
|
||||
# os.system(f"stftpitchshift -i {file} -q {Quefrency} -t {Timbre} -o {file_formanted}")
|
||||
# print('stftpitchshift -i "%s" -p 1.0 --rms -w 128 -v 8 -q %s -t %s -o "%s"' % (file, Quefrency, Timbre, file_formanted))
|
||||
print("formanting...")
|
||||
|
||||
os.system(
|
||||
'stftpitchshift -i "%s" -q %s -t %s -o "%sFORMANTED"'
|
||||
'runtime\Scripts\stftpitchshift.exe -i "%s" -q %s -t %s -o "%sFORMANTED"'
|
||||
% (file, Quefrency, Timbre, file_formanted)
|
||||
)
|
||||
print("formanted!")
|
||||
# filepraat = (os.path.abspath(os.getcwd()) + '\\' + file).replace('/','\\')
|
||||
# file_formantedpraat = ('"' + os.path.abspath(os.getcwd()) + '/' + 'formanted'.join(file_formanted) + '"').replace('/','\\')
|
||||
|
||||
|
||||
out, _ = (
|
||||
ffmpeg.input("%sFORMANTED%s" % (file_formanted, ".wav"), threads=0)
|
||||
.output("-", format="f32le", acodec="pcm_f32le", ac=1, ar=sr)
|
||||
|
||||
Reference in New Issue
Block a user