This repository has been archived by the owner on Nov 22, 2023. It is now read-only.
forked from openvpi/DiffSinger
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add WORLD pitch estimators and F0 range as hyperparameters (openvpi#149)
* Added WORLD pitch estimators i also removed hardcoded F0 ranges because what the heck is that 800 Hz max pitch in parselmouth that is way too low * Update README.md okay maybe don't add ur own flare in the readme if u actually want to create a pull req * Apply dtype change i saw it in the parselmouth thing might as well put it in to make sure * Update pw.py oops * fix dtype mismatch for some reason pyworld only likes float64? * add f0 range as a hyperparameter why isn't it a hyperparameter in the first place * move pad_frames to pw i think world is p accurate with the frames stuff but it's just to ensure * change padding algorithm it's just to be similar to the parselmouth one.. it makes sense to not center the F0 after all * remove duplicate line yeah * Remove DIO, change default range, add docs * Add notice for F0 range
- Loading branch information
1 parent
fbff2e8
commit 931df27
Showing
5 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from basics.base_pe import BasePE | ||
import numpy as np | ||
import pyworld as pw | ||
from utils.pitch_utils import interp_f0 | ||
|
||
class HarvestPE(BasePE): | ||
def get_pitch(self, waveform, length, hparams, interp_uv=False, speed=1): | ||
hop_size = int(np.round(hparams['hop_size'] * speed)) | ||
|
||
time_step = 1000 * hop_size / hparams['audio_sample_rate'] | ||
f0_floor = hparams['f0_min'] | ||
f0_ceil = hparams['f0_max'] | ||
|
||
f0, _ = pw.harvest(waveform.astype(np.float64), hparams['audio_sample_rate'], f0_floor=f0_floor, f0_ceil=f0_ceil, frame_period=time_step) | ||
f0 = f0.astype(np.float32) | ||
|
||
if f0.size < length: | ||
f0 = np.pad(f0, (0, length - f0.size)) | ||
f0 = f0[:length] | ||
uv = f0 == 0 | ||
|
||
if interp_uv: | ||
f0, uv = interp_f0(f0, uv) | ||
return f0, uv | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters