Example #1
0
    def test_write_wave(self):
        wav_file = os.path.join(self.test_dir, 'sample.wav')
        x, fs1 = fileio.read(wav_file)

        tmp = tempfile.NamedTemporaryFile(suffix='.wav')
        fileio.write(tmp.name, x, fs1)
        y, fs2 = fileio.read(tmp.name)
        np.testing.assert_array_almost_equal(x, y)
        assert fs1 == fs2
Example #2
0
def test_read_empty_wav():
    sfile = os.path.join(os.path.dirname(__file__), 'empty.wav')
    signal, samplerate = fileio.read(sfile)
    assert len(signal) == 0
    assert samplerate
Example #3
0
 def test_read_real_aiff(self):
     aiff_file = os.path.join(self.test_dir, 'sample.aiff')
     signal, samplerate = fileio.read(aiff_file)
     assert len(signal)
     assert samplerate
Example #4
0
 def test_read_real_wave(self):
     wav_file = os.path.join(self.test_dir, 'sample.wav')
     signal, samplerate = fileio.read(wav_file)
     assert len(signal)
     assert samplerate