Ejemplo n.º 1
0
 def test_upsample(self):
     # For those freq, _downsample2 should be almost decimation
     for freq in [8, 16, 20, 28, 32]:
         x = pure_tone(freq, sr=64)
         y_gt = pure_tone(freq, sr=128)
         y = resample._upsample2(x)
         self.assertSimilar(y, y_gt, x, f"freq={freq}")
Ejemplo n.º 2
0
 def test_ref(self):
     # Compare to _upsample2 and _downsample2
     for freq in [8, 16, 20, 28, 32, 36, 40, 56, 64]:
         x = pure_tone(freq, sr=128)
         y_gt_down = resample._downsample2(x)
         y_down = resample.resample_frac(x, 2, 1, rolloff=1)
         self.assertSimilar(y_down, y_gt_down, x, f"freq={freq} down")
         y_gt_up = resample._upsample2(x)
         y_up = resample.resample_frac(x, 1, 2, rolloff=1)
         self.assertSimilar(y_up, y_gt_up, x, f"freq={freq} up")