コード例 #1
0
ファイル: ljspeech.py プロジェクト: gkbxs/Parakeet
 def __call__(self, examples):
     batch_size = len(examples)
     mels = [example[0] for example in examples]
     wavs = [example[1] for example in examples]
     mels = batch_spec(mels, pad_value=self.padding_value)
     wavs = batch_wav(wavs, pad_value=self.padding_value)
     audio_starts = np.zeros((batch_size, ), dtype=np.int64)
     return mels, wavs, audio_starts
コード例 #2
0
ファイル: ljspeech.py プロジェクト: gkbxs/Parakeet
    def __call__(self, samples):
        # transform them first
        if self.valid:
            samples = [(audio, mel_spectrogram, 0)
                       for audio, mel_spectrogram in samples]
        else:
            samples = [self.random_crop(sample) for sample in samples]
        # batch them
        audios = [sample[0] for sample in samples]
        audio_starts = [sample[2] for sample in samples]
        mels = [sample[1] for sample in samples]

        mels = batch_spec(mels)

        if self.valid:
            audios = batch_wav(audios, dtype=np.float32)
        else:
            audios = np.array(audios, dtype=np.float32)
        audio_starts = np.array(audio_starts, dtype=np.int64)
        return audios, mels, audio_starts
コード例 #3
0
 def __call__(self, examples):
     mels = [example[0] for example in examples]
     wavs = [example[1] for example in examples]
     mels = batch_spec(mels, pad_value=self.padding_value)
     wavs = batch_wav(wavs, pad_value=self.padding_value)
     return mels, wavs