diff options
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/process.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/scripts/process.py b/scripts/process.py index 60c8e16..46c4ca8 100644 --- a/scripts/process.py +++ b/scripts/process.py @@ -34,6 +34,14 @@ gpu = args.gpu conv_config = create_conv_config(conv_model / 'config.json') sr_config = create_sr_config(sr_model / 'config.json') +param = sr_config.dataset.param +acoustic_feature_process = AcousticFeatureProcess( + frame_period=param.acoustic_feature_param.frame_period, + order=param.acoustic_feature_param.order, + alpha=param.acoustic_feature_param.alpha, + f0_estimating_method=param.acoustic_feature_param.f0_estimating_method, +) + def extract_number(f): s = re.findall("\d+", str(f)) return int(s[-1]) if s else -1 @@ -57,15 +65,12 @@ def process(p: Path, acoustic_converter: AcousticConverter, super_resolution: Su print(str(p)) input = acoustic_converter(p) - param = sr_config.dataset.param - acoustic_feature_process = AcousticFeatureProcess( - frame_period=param.acoustic_feature_param.frame_period, - order=param.acoustic_feature_param.order, - alpha=param.acoustic_feature_param.alpha, - f0_estimating_method=param.acoustic_feature_param.f0_estimating_method, - ) + input_wave = acoustic_converter._wave_process(str(p), test=True) + input_feature = acoustic_converter._feature_process(input_wave, test=True) + converted_feature = acoustic_converter.convert_to_feature(input=input_wav, out_sampling_rate=param.voice_param.sample_rate) + # converted_feature.f0 = input_feature.f0 - wave = super_resolution(acoustic_feature_process(input).spectrogram, acoustic_feature=input, sampling_rate=param.voice_param.sample_rate) + wave = super_resolution(converted_feature.spectrogram, acoustic_feature=converted_feature, sampling_rate=param.voice_param.sample_rate) librosa.output.write_wav(str(output / p.stem) + '.wav', wave.wave, wave.sampling_rate, norm=True) except: import traceback |
