Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8kHz audio #54

Open
patrickltobing opened this issue Sep 24, 2020 · 2 comments
Open

8kHz audio #54

patrickltobing opened this issue Sep 24, 2020 · 2 comments

Comments

@patrickltobing
Copy link

Hi @JeremyCCHsu,

Could you successfully perform analysis-synthesis with WORLD on 8kHz audio?

@patrickltobing
Copy link
Author

patrickltobing commented Sep 24, 2020

I have found the problem and quick solution.

The aperiodicity spectrum is failed if extracted from 8kHz.

The analysis-synthesis of 8kHz will still be working fine if the aperiodicity is extracted with 16kHz waveform,
the rests, spectral envelope and f0 are extracted from 8kHz.

@JeremyCCHsu
Copy link
Owner

Issue 1:

Hey @patrickltobing , thanks for the issue and the workaround. I confirmed it on my side, too. I'll consult the author of WORLD and get back to you.

Workaround:

wav_8k = librosa.resample(wav16k, fs_16k, fs_8k)

_, _, ap = pw.wav2world(wav16k, fs_16k)
f0, sp, _ = pw.wav2world(wav_8k, fs_8k)
ap = ap[:, :sp.shape[1]].copy(order="C")
y = pw.synthesize(f0, sp, ap, fs_8k)
sf.write(f"case2-using-16k-ap.wav", y, fs_8k)

Issue 2:

In addition to the issue you mentioned, I also found that DIO could sometimes yield suboptimal pitch contour with 16 kHz speech. In case you also have this issue use, pw.harvest instead of pw.dio should solve it. Again, I'm consulting the author for further information.

Workaround

_f0, t = pw.harvest(x, target_fs)    # raw pitch extractor
f0 = pw.stonemask(x, _f0, t, target_fs)  # pitch refinement
sp = pw.cheaptrick(x, f0, t, target_fs)  # extract smoothed spectrogram
ap = pw.d4c(x, f0, t, target_fs)         # extract aperiodicity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants