def test_from_matrix(self): world = World(self.samplingrate) _, spec, _ = world.analyze(self.signal) mcepmat = spec2mcep_from_matrix(spec, 20, self.alpha) mcep = spec2mcep(spec[300], 20, self.alpha) assert (mcep == mcepmat[300]).all() specmat = mcep2spec_from_matrix(mcepmat, self.alpha, self.windowsize) spec = mcep2spec(mcep, self.alpha, self.windowsize) assert (spec == specmat[300]).all()
def test_spec2mcep(self): mcep = spec2mcep(self.pspec, 20, self.alpha) spec = mcep2spec(mcep, self.alpha, self.windowsize) sqerr = np.sqrt( (np.log(self.pspec) - np.log(spec))**2).sum() / self.pspec.size assert sqerr < 1.2, sqerr
def test_spec2mcep(self): mcep = spec2mcep(self.pspec, 20, self.alpha) spec = mcep2spec(mcep, self.alpha, self.windowsize) sqerr = np.sqrt((np.log(self.pspec) - np.log(spec)) ** 2).sum() / self.pspec.size assert sqerr < 1.2, sqerr