summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorHiroshiba Kazuyuki <kazuyuki_hiroshiba@dwango.co.jp>2018-01-25 20:10:01 +0900
committerHiroshiba Kazuyuki <kazuyuki_hiroshiba@dwango.co.jp>2018-01-25 20:10:01 +0900
commitc44e1ec9b24a70cc30de5682bf1855afe5eb0485 (patch)
treedea956f863f5d04a5206a43dbc8fc62eb6c90275 /scripts
parent3ecf878ec5f35c8242b0b5e488d8f8d1f50e9aaf (diff)
mypy & harvest追加
Diffstat (limited to 'scripts')
-rw-r--r--scripts/extract_acoustic_feature.py22
-rw-r--r--scripts/voice_conversion_test.py4
2 files changed, 21 insertions, 5 deletions
diff --git a/scripts/extract_acoustic_feature.py b/scripts/extract_acoustic_feature.py
index d6e7711..7015f2a 100644
--- a/scripts/extract_acoustic_feature.py
+++ b/scripts/extract_acoustic_feature.py
@@ -36,6 +36,11 @@ parser.add_argument('--pad_second', type=float, default=base_voice_param.pad_sec
parser.add_argument('--frame_period', type=int, default=base_acoustic_feature_param.frame_period)
parser.add_argument('--order', type=int, default=base_acoustic_feature_param.order)
parser.add_argument('--alpha', type=float, default=base_acoustic_feature_param.alpha)
+parser.add_argument('--f0_estimating_method', type=str, default=base_acoustic_feature_param.f0_estimating_method)
+parser.add_argument('--f0_floor1', type=float, default=71)
+parser.add_argument('--f0_ceil1', type=float, default=800)
+parser.add_argument('--f0_floor2', type=float, default=71)
+parser.add_argument('--f0_ceil2', type=float, default=800)
parser.add_argument('--ignore_feature', nargs='+', default=['spectrogram', 'aperiodicity'])
parser.add_argument('--disable_alignment', action='store_true')
parser.add_argument('--enable_overwrite', action='store_true')
@@ -67,13 +72,24 @@ def generate_feature(path1, path2):
wave2 = wave_file_load_process(path2, test=True)
# make acoustic feature
- acoustic_feature_process = AcousticFeatureProcess(
+ acoustic_feature_process1 = AcousticFeatureProcess(
frame_period=arguments.frame_period,
order=arguments.order,
alpha=arguments.alpha,
+ f0_estimating_method=arguments.f0_estimating_method,
+ f0_floor=arguments.f0_floor1,
+ f0_ceil=arguments.f0_ceil1,
)
- f1 = acoustic_feature_process(wave1, test=True).astype_only_float(numpy.float32)
- f2 = acoustic_feature_process(wave2, test=True).astype_only_float(numpy.float32)
+ acoustic_feature_process2 = AcousticFeatureProcess(
+ frame_period=arguments.frame_period,
+ order=arguments.order,
+ alpha=arguments.alpha,
+ f0_estimating_method=arguments.f0_estimating_method,
+ f0_floor=arguments.f0_floor2,
+ f0_ceil=arguments.f0_ceil2,
+ )
+ f1 = acoustic_feature_process1(wave1, test=True).astype_only_float(numpy.float32)
+ f2 = acoustic_feature_process2(wave2, test=True).astype_only_float(numpy.float32)
# pre convert
if pre_convert:
diff --git a/scripts/voice_conversion_test.py b/scripts/voice_conversion_test.py
index 43c66d5..d96d5ce 100644
--- a/scripts/voice_conversion_test.py
+++ b/scripts/voice_conversion_test.py
@@ -34,8 +34,8 @@ def extract_number(f):
def process(p: Path, acoustic_converter: AcousticConverter):
try:
if p.suffix in ['.npy', '.npz']:
- p = glob.glob(str(input_wave_directory / p.stem) + '.*')[0]
- p = Path(p)
+ fn = glob.glob(str(input_wave_directory / p.stem) + '.*')[0]
+ p = Path(fn)
wave = acoustic_converter(p)
librosa.output.write_wav(str(output / p.stem) + '.wav', wave.wave, wave.sampling_rate, norm=True)
except: