def test_vad_warning(self):
        """vad should throw a warning if input dimension is greater than 2"""
        sample_rate = 41100

        data = torch.rand(5, 5, sample_rate)
        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter("always")
            T.Vad(sample_rate)(data)
        assert len(w) == 1

        data = torch.rand(5, sample_rate)
        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter("always")
            T.Vad(sample_rate)(data)
        assert len(w) == 0

        data = torch.rand(sample_rate)
        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter("always")
            T.Vad(sample_rate)(data)
        assert len(w) == 0
Esempio n. 2
0
 def test_Vad(self):
     filepath = common_utils.get_asset_path("vad-go-mono-32000.wav")
     common_utils.set_audio_backend('default')
     waveform, sample_rate = torchaudio.load(filepath)
     self._assert_consistency(T.Vad(sample_rate=sample_rate), waveform)
 def test_Vad(self):
     filepath = common_utils.get_asset_path("vad-go-mono-32000.wav")
     waveform, sample_rate = common_utils.load_wav(filepath)
     self._assert_consistency(T.Vad(sample_rate=sample_rate), waveform)
Esempio n. 4
0
 def test_vad(self, filename):
     path = get_asset_path(filename)
     data, sample_rate = load_wav(path)
     result = T.Vad(sample_rate)(data)
     self.assert_sox_effect(result, path, ['vad'])