def callAttack(filepath, attack, **kargs): """ """ mono = kargs.get('mono', True) x, sr = librosa.load(filepath, sr=44100, mono=False) if attack == 'transcode': dest_format = kargs.get('dest_format', 'mp3') y = atk.transcode(filepath, dest_format, mono) status = 'transcode' + dest_format elif attack == 'noise': snr = kargs.get('snr', 10) y = atk.noise(x, snr) status = 'noise' + str(snr) + 'dB' elif attack == 'cropping': duration = kargs.get('duration', 5) start = kargs.get('start', 0) sr = kargs.get('sr', 44100) y = atk.cropping(x, duration, start, sr) status = 'cropping-' + 'start-' + str(start) + '-duration-' + str(duration) elif attack == 'amplitude': magnification = kargs.get('magnification', 2) y = atk.amplitude(x, magnification) status = 'amplitude' + str(magnification) else: y = x status = 'None' return y, sr, status