def resample(self, data, input_rate):
        """
        Microphone may not support our native processing sampling rate, so
        resample from input_rate to RATE_PROCESS here for webrtcvad and
        deepspeech

        Args:
            data (binary): Input audio stream
            input_rate (int): Input audio rate to resample from
        """
        data16 = np.fromstring(string=data, dtype=np.int16)
        resample_size = int(len(data16) / self.input_rate * self.RATE_PROCESS)
        resample = signal.resample(data16, resample_size)
        resample16 = np.array(resample, dtype=np.int16)
        return resample16.tostring()
def resample ( self , data , input_rate ) : data16 = np . fromstring ( string = data , dtype = np . int16 ) resample_size = int ( len ( data16 ) / self . input_rate * self . RATE_PROCESS ) resample = signal . resample ( data16 , resample_size ) resample16 = np . array ( resample , dtype = np . int16 ) return resample16 . tostring ( )
Microphone may not support our native processing sampling rate, so
        resample from input_rate to RATE_PROCESS here for webrtcvad and
        deepspeech

        Args:
            data (binary): Input audio stream
            input_rate (int): Input audio rate to resample from