def comp_feat(self, sig, rate): ''' compute the features Args: sig: the audio signal as a 1-D numpy array rate: the sampling rate Returns: the features as a [seq_length x feature_dim] numpy array ''' #snip the edges sig = snip(sig, rate, float(self.conf['winlen']), float(self.conf['winstep'])) feat, energy = base.mfcc(sig, rate, self.conf) if self.conf['include_energy'] == 'True': feat = np.append(feat, energy[:, np.newaxis], 1) if self.conf['dynamic'] == 'delta': feat = base.delta(feat) elif self.conf['dynamic'] == 'ddelta': feat = base.ddelta(feat) elif self.conf['dynamic'] != 'nodelta': raise Exception('unknown dynamic type') return feat
def comp_feat(self, sig, rate): """ compute the features Args: sig: the audio signal as a 1-D numpy array rate: the sampling rate Returns: the features as a [seq_length x feature_dim] numpy array """ # snip the edges sig = snip(sig, rate, float(self.conf['winlen']), float(self.conf['winstep'])) if 'scipy' in self.conf and self.conf['scipy'] == 'True': feat = base.angspec_scipy(sig, rate, self.conf) else: feat = base.angspec(sig, rate, self.conf) if self.conf['include_energy'] == 'True': if 'scipy' in self.conf and self.conf['scipy'] == 'True': _, energy = base.fbank_scipy(sig, rate, self.conf) else: _, energy = base.fbank(sig, rate, self.conf) feat = np.append(feat, energy[:, np.newaxis], 1) return feat
def __call__(self, sig, rate): ''' compute the features Args: sig: the audio signal as a 1-D numpy array rate: the sampling rate Returns: the features as a [seq_length x feature_dim] numpy array ''' #snip the edges sig = sigproc.snip(sig, rate, float(self.conf['winlen']), float(self.conf['winstep'])) #compute the features feats = self.comp_feat(sig, rate) #apply vad if self.conf['vad'] == 'True': speechframes = vad(sig, rate, float(self.conf['winlen']), float(self.conf['winstep'])) feats = feats[speechframes, :] return feats
def comp_feat(self, sig, rate): ''' compute the features Args: sig: the audio signal as a 1-D numpy array rate: the sampling rate Returns: the features as a [seq_length x feature_dim] numpy array ''' #snip the edges sig = snip(sig, rate, float(self.conf['winlen']), float(self.conf['winstep'])) feat = base.raw(sig) return feat
def comp_feat(self, sig, rate): """ compute the features Args: sig: the audio signal as a 1-D numpy array rate: the sampling rate Returns: the features as a [seq_length x feature_dim] numpy array """ # snip the edges sig = snip(sig, rate, float(self.conf['winlen']), float(self.conf['winstep'])) if 'scipy' in self.conf and self.conf['scipy'] == 'True': feat = base.frames_scipy(sig, rate, self.conf) else: feat = base.frames(sig, rate, self.conf) return feat