summaryrefslogtreecommitdiff
path: root/become_yukarin/dataset
diff options
context:
space:
mode:
authorHiroshiba Kazuyuki <hihokaruta@gmail.com>2017-11-14 10:03:59 +0900
committerHiroshiba Kazuyuki <hihokaruta@gmail.com>2017-11-14 10:03:59 +0900
commit75799e105c3d36648b29f02c6db9b4b8dd7e5e49 (patch)
tree9ddae33c874597bd0f6f2f1a97c56ff874d03487 /become_yukarin/dataset
parent1fa00683cd815a6e05290dd48a502dad2cc8426e (diff)
add voiced flug
Diffstat (limited to 'become_yukarin/dataset')
-rw-r--r--become_yukarin/dataset/dataset.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/become_yukarin/dataset/dataset.py b/become_yukarin/dataset/dataset.py
index 7a6ce08..93619e3 100644
--- a/become_yukarin/dataset/dataset.py
+++ b/become_yukarin/dataset/dataset.py
@@ -88,11 +88,13 @@ class AcousticFeatureProcess(BaseDataProcess):
spectrogram = pyworld.cheaptrick(x, f0, t, fs)
aperiodicity = pyworld.d4c(x, f0, t, fs)
mfcc = pysptk.sp2mc(spectrogram, order=self._order, alpha=self._alpha)
+ voiced = ~(f0 == 0) # type: numpy.ndarray
return AcousticFeature(
f0=f0.astype(self._dtype),
spectrogram=spectrogram.astype(self._dtype),
aperiodicity=aperiodicity.astype(self._dtype),
mfcc=mfcc.astype(self._dtype),
+ voiced=voiced.astype(self._dtype),
)
@@ -107,6 +109,7 @@ class AcousticFeatureLoadProcess(BaseDataProcess):
spectrogram=d['spectrogram'],
aperiodicity=d['aperiodicity'],
mfcc=d['mfcc'],
+ voiced=d['voiced'],
)
@@ -121,6 +124,7 @@ class AcousticFeatureNormalizeProcess(BaseDataProcess):
spectrogram=(data.spectrogram - self._mean.spectrogram) / numpy.sqrt(self._var.spectrogram),
aperiodicity=(data.aperiodicity - self._mean.aperiodicity) / numpy.sqrt(self._var.aperiodicity),
mfcc=(data.mfcc - self._mean.mfcc) / numpy.sqrt(self._var.mfcc),
+ voiced=data.voiced,
)
@@ -135,6 +139,7 @@ class AcousticFeatureDenormalizeProcess(BaseDataProcess):
spectrogram=data.spectrogram * numpy.sqrt(self._var.spectrogram) + self._mean.spectrogram,
aperiodicity=data.aperiodicity * numpy.sqrt(self._var.aperiodicity) + self._mean.aperiodicity,
mfcc=data.mfcc * numpy.sqrt(self._var.mfcc) + self._mean.mfcc,
+ voiced=data.voiced,
)
@@ -160,6 +165,7 @@ class DecodeFeatureProcess(BaseDataProcess):
spectrogram=numpy.nan,
aperiodicity=numpy.nan,
mfcc=data,
+ voiced=numpy.nan,
)