Beispiel #1
0
    def test_bass(self):
        central_freq = 1000
        q = 0.707
        gain = 40
        sample_rate = 8000

        data, path = self.get_whitenoise(sample_rate)
        result = F.bass_biquad(data, sample_rate, gain, central_freq, q)
        self.assert_sox_effect(result, path, ['bass', gain, central_freq, f'{q}q'], atol=1.5e-4)
Beispiel #2
0
    def test_bass(self):
        """
        Test biquad bass filter, compare to SoX implementation
        """

        central_freq = 1000
        q = 0.707
        gain = 40

        noise_filepath = common_utils.get_asset_path('whitenoise.wav')
        E = torchaudio.sox_effects.SoxEffectsChain()
        E.set_input_file(noise_filepath)
        E.append_effect_to_chain("bass", [gain, central_freq, str(q) + 'q'])
        sox_output_waveform, sr = E.sox_build_flow_effects()

        waveform, sample_rate = torchaudio.load(noise_filepath, normalization=True)
        output_waveform = F.bass_biquad(waveform, sample_rate, gain, central_freq, q)

        self.assertEqual(output_waveform, sox_output_waveform, atol=1.5e-4, rtol=1e-5)
    def test_bass(self):
        """
        Test biquad bass filter, compare to SoX implementation
        """

        central_freq = 1000
        q = 0.707
        gain = 40

        E = torchaudio.sox_effects.SoxEffectsChain()
        E.set_input_file(self.noise_filepath)
        E.append_effect_to_chain("bass", [gain, central_freq, str(q) + 'q'])
        sox_output_waveform, sr = E.sox_build_flow_effects()

        output_waveform = F.bass_biquad(self.noise_waveform,
                                        self.NOISE_SAMPLE_RATE, gain,
                                        central_freq, q)

        self.assertEqual(output_waveform,
                         sox_output_waveform,
                         atol=1.5e-4,
                         rtol=1e-5)
 def func(tensor):
     sample_rate = 44100
     gain = 40.
     central_freq = 1000.
     q = 0.707
     return F.bass_biquad(tensor, sample_rate, gain, central_freq, q)