def test_Recorder_Deco_rewind_and_read(self): ads = ADSFactory.ads(audio_source=self.audio_source, record=True, block_size=320) ads.open() for i in range(10): ads.read() ads.rewind() # read all available data after rewind ads_data = [] while True: block = ads.read() if block is None: break ads_data.append(block) ads.close() ads_data = b''.join(ads_data) audio_source = WaveAudioSource( filename=dataset.one_to_six_arabic_16000_mono_bc_noise) audio_source.open() audio_source_data = audio_source.read(320 * 10) audio_source.close() self.assertEqual(ads_data, audio_source_data, "Unexpected data read from RecorderADS")
def test_Recorder_Deco_rewind_and_read(self): ads = ADSFactory.ads(audio_source=self.audio_source, record=True, block_size = 320) ads.open() for i in range(10): ads.read() ads.rewind() # read all available data after rewind ads_data = [] while True: block = ads.read() if block is None: break ads_data.append(block) ads.close() ads_data = b''.join(ads_data) audio_source = WaveAudioSource(filename=dataset.one_to_six_arabic_16000_mono_bc_noise) audio_source.open() audio_source_data = audio_source.read(320 * 10) audio_source.close() self.assertEqual(ads_data, audio_source_data, "Unexpected data read from RecorderADS")
def test_read(self): ads = ADSFactory.ads(audio_source=self.audio_source, block_size=256) ads.open() ads_data = ads.read() ads.close() audio_source = WaveAudioSource( filename=dataset.one_to_six_arabic_16000_mono_bc_noise) audio_source.open() audio_source_data = audio_source.read(256) audio_source.close() self.assertEqual(ads_data, audio_source_data, "Unexpected data read from ads")
def test_read(self): ads = ADSFactory.ads(audio_source=self.audio_source, block_size = 256) ads.open() ads_data = ads.read() ads.close() audio_source = WaveAudioSource(filename=dataset.one_to_six_arabic_16000_mono_bc_noise) audio_source.open() audio_source_data = audio_source.read(256) audio_source.close() self.assertEqual(ads_data, audio_source_data, "Unexpected data read from ads")
def test_Limiter_Deco_read(self): # read a maximum of 0.75 seconds from audio source ads = ADSFactory.ads(audio_source=self.audio_source, max_time=0.75) ads_data = [] ads.open() while True: block = ads.read() if block is None: break ads_data.append(block) ads.close() ads_data = b''.join(ads_data) audio_source = WaveAudioSource( filename=dataset.one_to_six_arabic_16000_mono_bc_noise) audio_source.open() audio_source_data = audio_source.read(int(16000 * 0.75)) audio_source.close() self.assertEqual(ads_data, audio_source_data, "Unexpected data read from LimiterADS")
def test_Limiter_Deco_read(self): # read a maximum of 0.75 seconds from audio source ads = ADSFactory.ads(audio_source=self.audio_source, max_time=0.75) ads_data = [] ads.open() while True: block = ads.read() if block is None: break ads_data.append(block) ads.close() ads_data = b''.join(ads_data) audio_source = WaveAudioSource(filename=dataset.one_to_six_arabic_16000_mono_bc_noise) audio_source.open() audio_source_data = audio_source.read(int(16000 * 0.75)) audio_source.close() self.assertEqual(ads_data, audio_source_data, "Unexpected data read from LimiterADS")
def setUp(self): self.audio_source = WaveAudioSource( filename=dataset.one_to_six_arabic_16000_mono_bc_noise)