Ejemplo n.º 1
0
 def combine_silent(self, effective: numpy.ndarray, feature: AcousticFeature):
     sizes = AcousticFeature.get_sizes(
         sampling_rate=self._param.sampling_rate,
         order=self._param.order,
     )
     silent_feature = AcousticFeature.silent(len(effective), sizes=sizes, keys=('mc', 'ap', 'f0', 'voiced'))
     silent_feature.indexing_set(effective, feature)
     return silent_feature
Ejemplo n.º 2
0
    def post_convert(self, start_time: float, time_length: float):
        sizes = AcousticFeature.get_sizes(sampling_rate=self.sampling_rate, order=self.order)
        keys = ['f0', 'ap', 'sp', 'voiced']
        out_feature = self.fetch(
            start_time=start_time,
            time_length=time_length,
            data_stream=self._out_feature_stream,
            rate=1000 / self.frame_period,
            pad_function=lambda length: AcousticFeature.silent(length, sizes=sizes, keys=keys),
            pick_function=lambda segment, first, last: segment.feature.pick(first, last, keys=keys),
            concat_function=lambda buffers: AcousticFeature.concatenate(buffers, keys=keys),
        )

        out_wave = self.vocoder.decode(
            acoustic_feature=out_feature,
        )

        w = out_wave.wave
        w[numpy.isnan(w)] = 0
        out_wave = Wave(wave=w, sampling_rate=out_wave.sampling_rate)
        return out_wave
Ejemplo n.º 3
0
 def pad(self, width: int):
     sizes = AcousticFeature.get_sizes(
         sampling_rate=self.wave_sampling_rate, order=self.order)
     return AcousticFeature.silent(width, sizes=sizes, keys=self._keys)