mirror of
https://github.com/romanz/amodem.git
synced 2026-02-25 00:31:08 +08:00
sampling: fix off-by-one padding error
This commit is contained in:
@@ -34,7 +34,7 @@ class Sampler(object):
|
||||
self.width = self.interp.width
|
||||
|
||||
# TODO: explain indices arithmetic
|
||||
padding = [0.0] * (self.interp.width - 1)
|
||||
padding = [0.0] * self.interp.width
|
||||
self.src = itertools.chain(padding, src)
|
||||
self.offset = self.interp.width + 1
|
||||
self.buff = np.zeros(self.interp.coeff_len)
|
||||
|
||||
@@ -11,7 +11,7 @@ def test_resample():
|
||||
dst = BytesIO()
|
||||
sampling.resample(src=src, dst=dst, df=0.0)
|
||||
y = common.loads(dst.getvalue())
|
||||
err = x[1:len(y)+1] - y
|
||||
err = x[:len(y)] - y
|
||||
assert np.max(np.abs(err)) < 1e-4
|
||||
|
||||
dst = BytesIO()
|
||||
|
||||
Reference in New Issue
Block a user