Skip to content

Instantly share code, notes, and snippets.

@r9y9
Last active July 14, 2020 01:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r9y9/cd27653e4c19c51add65c44439cc0a98 to your computer and use it in GitHub Desktop.
Save r9y9/cd27653e4c19c51add65c44439cc0a98 to your computer and use it in GitHub Desktop.
if self.use_harvest:
import amfm_decompy.pYAAPT as pYAAPT
import amfm_decompy.basic_tools as basic
signal = basic.SignalObj(wav_path)
print(min_f0, max_f0)
min_f0 = min(150, min_f0) # TODO: Fix this property
pitch = pYAAPT.yaapt(signal, f0_min=min_f0, f0_max=max_f0, frame_length=25, frame_space=5)
f0 = pitch.samp_values.astype(np.float64)
timeaxis = np.linspace(0, (pitch.samp_values.shape[0]-1) * 0.005, len(pitch.samp_values))
#f0, timeaxis = pyworld.harvest(x, fs, frame_period=self.frame_period,
#f0_floor=min_f0, f0_ceil=max_f0)
else:
f0, timeaxis = pyworld.dio(x, fs, frame_period=self.frame_period,
f0_floor=min_f0, f0_ceil=max_f0)
f0 = pyworld.stonemask(x, f0, timeaxis, fs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment