mirror of
https://github.com/romanz/amodem.git
synced 2026-05-09 21:13:04 +08:00
sampling: remove extra function call
This commit is contained in:
@@ -47,11 +47,6 @@ class Sampler(object):
|
|||||||
return self
|
return self
|
||||||
|
|
||||||
def next(self):
|
def next(self):
|
||||||
return self._sample() * self.gain
|
|
||||||
|
|
||||||
__next__ = next
|
|
||||||
|
|
||||||
def _sample(self):
|
|
||||||
offset = self.offset
|
offset = self.offset
|
||||||
# offset = k + (j / self.resolution)
|
# offset = k + (j / self.resolution)
|
||||||
k = int(offset) # integer part
|
k = int(offset) # integer part
|
||||||
@@ -64,7 +59,10 @@ class Sampler(object):
|
|||||||
self.index += 1
|
self.index += 1
|
||||||
|
|
||||||
self.offset += self.freq
|
self.offset += self.freq
|
||||||
return np.dot(coeffs, self.buff)
|
return np.dot(coeffs, self.buff) * self.gain
|
||||||
|
|
||||||
|
__next__ = next
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import common
|
import common
|
||||||
|
|||||||
Reference in New Issue
Block a user