Add test for sampling

This commit is contained in:
Roman Zeyde
2014-07-05 09:40:09 +03:00
parent c9d7f8e2f2
commit 63fbee8bfc
2 changed files with 14 additions and 2 deletions

View File

@@ -25,10 +25,10 @@ class Interpolator(object):
return coeffs, k - self.width
class Sampler(object):
def __init__(self, src, interp):
def __init__(self, src, interp=None):
self.src = iter(src)
self.freq = 1.0
self.interp = interp
self.interp = interp if (interp is not None) else Interpolator()
coeffs, begin = self.interp.get(0)
self.offset = -begin # should fill samples buffer
self.buff = np.zeros(len(coeffs))