def test_preemphasis(self): y = self.x yFilterd = transform.preemphasis(y, 0.97) tc.assert_equal(yFilterd.shape, y.shape) tc.assert_isreal(yFilterd) tc.assert_equal(yFilterd[0], y[0])
def test_mfcc(self): path = get_file_path("sample.wav") y = audioread(path)[0] y_filtered = transform.mfcc(y) tc.assert_equal(y_filtered.shape, (291, 13)) tc.assert_isreal(y_filtered)
def test_offcomp(self): y = self.x yFilterd = transform.offset_compensation(y) tc.assert_equal(yFilterd.shape, y.shape) tc.assert_isreal(yFilterd) tc.assert_array_not_equal(yFilterd[1:], y[1:]) tc.assert_equal(yFilterd[0], y[0])
def test_mfcc(self): path = get_file_path("sample.wav") y = audioread(path)[0] yFilterd = transform.ssc(y) tc.assert_equal(yFilterd.shape, (294, 26)) tc.assert_isreal(yFilterd)
def test_fbank(self): path = get_file_path("sample.wav") y = audioread(path)[0] feature = transform.fbank(y) tc.assert_equal(feature.shape, (240, 23)) tc.assert_isreal(feature) tc.assert_array_greater_equal(feature, 0)
def test_spectrogram_and_energy(self): x = self.x X = stft(x) spectrogram = stft_to_spectrogram(X) energy = spectrogram_to_energy_per_frame(spectrogram) tc.assert_equal(X.shape, (154, 513)) tc.assert_equal(spectrogram.shape, (154, 513)) tc.assert_isreal(spectrogram) tc.assert_array_greater_equal(spectrogram, 0) tc.assert_equal(energy.shape, (154, )) tc.assert_isreal(energy) tc.assert_array_greater_equal(energy, 0)