def get_sine_half_freq(sig, fs, filter_freq, filter_ord):
    y = get_square_half_freq(sig)

    eq = adsp.EQ(fs)
    Qs = adsp.butter_Qs(filter_ord)
    for n in range(int(filter_ord / 2)):
        eq.add_LPF(filter_freq, Qs[n])
    return eq.process_block(y)
Exemple #2
0
    def test_eq_highshelf(self):
        eq = adsp.EQ(_fs_)
        eq.add_highshelf(1000, 0.707, 2)
        y = eq.process_block(self.h)

        w, H = signal.freqz(y, [1], worN=self.worN, fs=_fs_)
        check_freq_point(self, 1000, 1, w, H)
        check_freq_point(self, 20, 1, w, H)
        check_freq_point(self, 20000, 2, w, H)
Exemple #3
0
    def test_reset(self):
        eq = adsp.EQ(_fs_)
        eq.add_notch(1000, 0.707)
        eq.add_lowshelf(1000, 0.707, 2)
        eq.process_block(self.h)
        eq.reset()

        for f in eq.filters:
            self.assertTrue(f.has_been_reset(),
                            'Not all EQ filters have been reset!')
Exemple #4
0
import audio_dspy as adsp

# %%
N = 500
fs = 44100
freq = 2000
x = np.sin(2 * np.pi * freq / fs * np.arange(N))

plt.plot(x)

# %%
X = 20 * np.log10(adsp.normalize(np.abs(np.fft.rfft(x))))
plt.plot(X)

# %%
eq = adsp.EQ(fs)
Qs = adsp.butter_Qs(6)
print(Qs)
eq.add_LPF(1500, Qs[0])
eq.add_LPF(1500, Qs[1])
eq.add_LPF(1500, Qs[2])


def get_square_half_freq(sig):
    y = np.copy(sig)

    rising = True
    last_x = 0
    output = 1
    switch_count = 0
    for n, x in enumerate(sig):