from__future__importabsolute_importfrom__future__importdivisionfrom__future__importprint_functionfrom.importbaseclassResamplerAugmentor(base.AugmentorBase):""" Instantiates a resampler module. :param new_sample_rate: New sample rate in Hz :type new_sample_rate: func[int->scalar] :param rng: Random generator object. :type rng: random.Random """def__init__(self,rng,new_sample_rate):self.new_sample_rate=new_sample_rateself._rng=rngdeftransform_audio(self,audio_segment):""" Resamples the input audio to the target sample rate. Note that this is an in-place transformation. :param audio: input audio :type audio: SpeechDLSegment """new_sample_rate=self.new_sample_rateaudio.resample(new_sample_rate)