From cbf9ff439f69cf27a02aafca4e3be6a2adb0c4ac Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 27 Sep 2020 14:02:51 +0800 Subject: [PATCH] LinearPhaseFilter, Delay: fix complex number issues --- noptica.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/noptica.py b/noptica.py index a3fe8fb..5587a00 100644 --- a/noptica.py +++ b/noptica.py @@ -195,7 +195,7 @@ class LinearPhaseFilter: def __init__(self, numtaps, *args, **kwargs): self.numtaps = numtaps self.coef = signal.firwin(numtaps, *args, **kwargs) - self.state = np.zeros(self.numtaps - 1) + self.state = np.zeros(self.numtaps - 1, dtype="complex64") def input(self, block): output, self.state = signal.lfilter(self.coef, [1.0], block, zi=self.state) @@ -210,8 +210,8 @@ class Delay: def __init__(self, block_size, delay_amount): self.block_size = block_size self.delay_amount = delay_amount - self.output = np.zeros(block_size) - self.next = np.zeros(delay_amount) + self.output = np.zeros(block_size, dtype="complex64") + self.next = np.zeros(delay_amount, dtype="complex64") def input(self, block): assert(len(block) == self.block_size)