示例#1
0
    def __init__(self, model, filter_length, sample_rate, framesize,
                 frameshift, usehamming, preemcoef, numchans, ceplifter,
                 numceps, enormalise, zmeansource, usepower, usec0, usecmn,
                 usedelta, useacc, n_last_frames, n_prev_frames, lofreq,
                 hifreq, mel_banks_only):
        self.audio_recorded_in = []

        self.ffnn = TheanoFFNN()
        self.ffnn.load(model)

        self.log_probs_speech = deque(maxlen=filter_length)
        self.log_probs_sil = deque(maxlen=filter_length)

        self.last_decision = 0.0

        self.front_end = MFCCFrontEnd(sample_rate, framesize, usehamming,
                                      preemcoef, numchans, ceplifter, numceps,
                                      enormalise, zmeansource, usepower, usec0,
                                      usecmn, usedelta, useacc,
                                      n_last_frames + n_prev_frames, lofreq,
                                      hifreq, mel_banks_only)

        self.samplerate = sample_rate
        self.framesize = framesize
        self.frameshift = frameshift
示例#2
0
    def __init__(self, cfg):
        self.cfg = cfg

        self.audio_recorded_in = []

        self.ffnn = TheanoFFNN()
        self.ffnn.load(self.cfg['model'])

        self.log_probs_speech = deque(maxlen=self.cfg['filter_length'])
        self.log_probs_sil = deque(maxlen=self.cfg['filter_length'])

        self.last_decision = 0.0

        if self.cfg['frontend'] == 'MFCC':
            self.front_end = MFCCFrontEnd(
                self.cfg['sample_rate'], self.cfg['framesize'],
                self.cfg['usehamming'], self.cfg['preemcoef'],
                self.cfg['numchans'], self.cfg['ceplifter'],
                self.cfg['numceps'], self.cfg['enormalise'],
                self.cfg['zmeansource'], self.cfg['usepower'],
                self.cfg['usec0'], self.cfg['usecmn'], self.cfg['usedelta'],
                self.cfg['useacc'],
                self.cfg['n_last_frames'] + self.cfg['n_prev_frames'],
                self.cfg['lofreq'], self.cfg['hifreq'],
                self.cfg['mel_banks_only'])
        else:
            raise ASRException('Unsupported frontend: %s' %
                               (self.cfg['frontend'], ))