コード例 #1
0
ファイル: dataset.py プロジェクト: sony/nnabla-examples
    def _get_spectrograms(self, index):
        r""" Return the corresponding spectrogram and waveform."""
        file = self._waves[index]

        # get hyper-parameters
        hp = self.hparams

        w, _ = lr.load(file, sr=hp.sr)
        w, _ = lr.effects.trim(w)  # triming

        linear = audio.wave2spec(w, hp)

        return linear, w
コード例 #2
0
    def _get_spectrograms(self, index):
        r"""Return the corresponding spectrogram and waveform."""
        file = self._waves[index]

        # get hyper-parameters
        hp = self.hparams

        w, _ = lr.load(file, sr=hp.sr)
        w, _ = lr.effects.trim(w)  # triming

        if hasattr(hp, "preemphasis"):
            # apply a pre-emphasis filter to amplify the high frequencies
            w = audio.preemphasis(w, factor=hp.preemphasis)
        linear = audio.wave2spec(w, hp)

        return linear, w