def test_shift_time(test_file, tshift, direction): shift_time(test_file, tshift, direction) # check result fname = "%s_augmented_%s_%s_shifted.wav" % (test_file.split(".wav")[0], direction, tshift) assert_file_exists(fname)
def test_speed(test_file, coefficient): speed(test_file, coefficient=1.2) # check result fname = "%s_augmented_speeded.wav" % (test_file.split(".wav")[0]) time.sleep(1) assert_file_exists(fname)
def test_random_cropping(test_file, min_len): random_cropping(test_file, min_len) # check result fname = "%s_augmented_randomly_cropped_%s.wav" % ( test_file.split(".wav")[0], str(min_len)) assert_file_exists(fname)
def test_slow_down(test_file, coefficient): slow_down(test_file, coefficient=0.8) # check result fname = "%s_augmented_slowed.wav" % (test_file.split(".wav")[0]) time.sleep(1) assert_file_exists(fname)
def test_reverse(test_file): """ Test function for the reversing function. """ reverse(test_file) # check result fname = "{0}_augmented_reversed.wav".format(test_file.split(".wav")[0]) time.sleep(1) assert_file_exists(fname)
def test_eliminate_silence(test_file): """ Test function for the silence removal. """ eliminate_silence(test_file) # check result fname = test_file.split(".wav")[0] + "_augmented_without_silence.wav" time.sleep(1) assert_file_exists(fname)
def test_fade_in_and_out(test_file): """ Test function for adding a fade in and fade out effect. """ fade_in_and_out(test_file) # check result fname = "%s_augmented_fade_in_out.wav" % (test_file.split(".wav")[0]) time.sleep(1) assert_file_exists(fname)
def test_resample_audio(test_file, sr): """ Test function for the resampling function. """ resample_audio(test_file, sr) # check result fname = "{0}_augmented_resampled_to_{1}.wav".format( test_file.split(".wav")[0], sr) time.sleep(1) assert_file_exists(fname)
def test_normalize(test_file, normalization_technique, rms_level): """ Test function for the normalization function. """ normalize(test_file, normalization_technique, rms_level) # check result fname = "{0}_augmented_{1}_normalized.wav".format( test_file.split(".wav")[0], normalization_technique) time.sleep(1) assert_file_exists(fname)
def test_add_noise(test_file, snr): """ Test adding noise function. """ add_noise(test_file, snr) # check result fname = "%s_augmented_%s_noisy.wav" % (test_file.split(".wav")[0], str(snr)) time.sleep(1) assert_file_exists(fname)
def test_apply_gain(test_file, gain): """ Test apply gain function. """ apply_gain(infile=test_file, gain=gain) # check result fname = "%s_augmented_with_%s_gain.wav" % (test_file.split(".wav")[0], str(gain)) time.sleep(1) assert_file_exists(fname)
def test_change_tone(test_file, tone): """ Test the tone changing function. """ # change audio file tone change_tone(infile=test_file, tone=tone) # check result fname = "%s_augmented_%s_toned.wav" % (test_file.split(".wav")[0], str(tone)) time.sleep(5) assert_file_exists(fname)
def test_convolve(test_file, ir_fname, level): """ Test the convolution function. """ # apply a convolution between the audio input file and a predefined file. convolve(infile=test_file, ir_fname=ir_fname, level=level) # check result fname = "{0}_augmented_{1}_convolved_with_level_{2}.wav".format( test_file.split(".wav")[0], os.path.basename(ir_fname.split(".")[0]), level) time.sleep(1) assert_file_exists(fname)
def test_apply_filter(test_file, filter_type, low_cutoff_freq, high_cutoff_freq, order): """ Test the Buttenworth filters. """ # apply filter apply_filter(test_file, filter_type, low_cutoff_freq, high_cutoff_freq, order) # check result fname = "{0}_augmented_{1}_pass_filtered.wav".format( test_file.split(".wav")[0], filter_type) time.sleep(3) assert_file_exists(fname)