Changeset 6937842
 Timestamp:
 Apr 28, 2016, 7:32:48 PM (3 years ago)
 Branches:
 feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
 Children:
 98e9d69
 Parents:
 92a8800
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

python/tests/test_phasevoc.py
r92a8800 r6937842 40 40 assert_equal ( r, 0) 41 41 42 def test_resynth_8_steps_sine(self): 43 """ check the resynthesis of is correct with 87.5% overlap """ 44 hop_s = 1024 45 ratio = 8 46 freq = 445; samplerate = 22050 47 sigin = np.sin( 2. * np.pi * np.arange(hop_s).astype(float_type) * freq / samplerate) 48 r2 = self.reconstruction( sigin, hop_s, ratio) 49 error = ((r2  sigin)**2).mean() 50 self.assertLessEqual(error , 1.e3) 51 42 52 def test_resynth_8_steps(self): 43 53 """ check the resynthesis of is correct with 87.5% overlap """ 44 hop_s = 25654 hop_s = 1024 45 55 ratio = 8 46 56 sigin = np.random.rand(hop_s).astype(float_type) * 2.  1. 57 r2 = self.reconstruction( sigin, hop_s, ratio) 58 error = ((r2  sigin)**2).mean() 59 self.assertLessEqual(error , 1.e2) 60 61 def test_resynth_4_steps(self): 62 """ check the resynthesis of is correct with 75% overlap """ 63 hop_s = 1024 64 ratio = 4 65 sigin = np.random.rand(hop_s).astype(float_type) * 2.  1. 66 r2 = self.reconstruction( sigin, hop_s, ratio) 67 error = ((r2  sigin)**2).mean() 68 self.assertLessEqual(error , 1.e2) 69 70 def reconstruction(self, sigin, hop_s, ratio): 47 71 buf_s = hop_s * ratio 48 72 f = pvoc(buf_s, hop_s) … … 51 75 for i in range(1, ratio): 52 76 r2 = f.rdo( f(zeros) ) 53 r2 *= .5 54 assert_almost_equal ( r2  sigin, 0., decimal = precision ) 77 return r2 55 78 56 def test_resynth_4_steps(self):57 """ check the resynthesis of is correct with 75% overlap """58 hop_s = 25659 ratio = 460 sigin = np.random.rand(hop_s).astype(float_type) * 2.  1.61 buf_s = hop_s * ratio62 f = pvoc(buf_s, hop_s)63 zeros = fvec(hop_s)64 r2 = f.rdo( f(sigin) )65 for i in range(1, ratio):66 r2 = f.rdo( f(zeros) )67 assert_almost_equal ( r2  sigin, 0., decimal = precision )68 69 79 def plot_this( self, this ): 70 80 from pylab import semilogy, show
Note: See TracChangeset
for help on using the changeset viewer.