def test_synthfiltbank(self): wav_path = str( Path(os.environ['MAIN_ROOT']).joinpath('delta/layers/ops/data/sm1_cln.wav')) with self.session(): read_wav = ReadWav.params().instantiate() input_data, sample_rate = read_wav(wav_path) analyfiltbank = Analyfiltbank.params().instantiate() power_spc, phase_spc = analyfiltbank(input_data.eval(), sample_rate.eval()) synthfiltbank = Synthfiltbank.params().instantiate() audio_data =synthfiltbank(power_spc, phase_spc, sample_rate.eval()) self.assertAllClose(audio_data.eval().flatten()[500:550], input_data.eval().flatten()[500:550], rtol=1e-4, atol=1e-4)
def test_synthfiltbank(self): wav_path = str(Path(PACKAGE_OPS_DIR).joinpath('data/sm1_cln.wav')) with self.cached_session(use_gpu=False, force_gpu=False): read_wav = ReadWav.params().instantiate() input_data, sample_rate = read_wav(wav_path) input_data = input_data / 32768 analyfiltbank = Analyfiltbank.params().instantiate() power_spc, phase_spc = analyfiltbank(input_data.eval(), sample_rate.eval()) synthfiltbank = Synthfiltbank.params().instantiate() audio_data = synthfiltbank(power_spc, phase_spc, sample_rate.eval()) self.assertAllClose(audio_data.eval().flatten()[500:550], input_data.eval().flatten()[500:550], rtol=1e-4, atol=1e-4)