Esempio n. 1
0
def apply_filt (x, fs, freq, Q, gain):
    filt = adsp.Filter(2, fs)
    y = np.zeros_like(x)

    b, a = adsp.design_bell(freq, Q, 10**(-60/20), fs)
    filt.set_coefs(b, a)

    for n in range(len(x)):
        curGain = gain**n
        y[n] = filt.process_sample(x[n]) * (1.0 - curGain) + x[n] * curGain
    return y
Esempio n. 2
0
    def add_notch(self, fc, Q):
        """
        Add a notch filter to the EQ

        Parameters
        ----------
        fc : float
            Cutoff frequency
        Q : float
            Q factor
        """
        string = 'Notch, Freq: {}, Q: {}'.format(fc, Q)
        filter = adsp.Filter(2, self.fs, type=string)
        b, a = adsp.design_notch(fc, Q, self.fs)
        filter.set_coefs(b, a)
        self.add_filter(filter)
Esempio n. 3
0
    def add_lowshelf(self, fc, Q, gain):
        """
        Add a lowshelf filter to the EQ

        Parameters
        ----------
        fc : float
            Cutoff frequency
        Q : float
            Q factor
        gain : float
            gain in linear units
        """
        string = 'Low Shelf, Freq: {}, Q: {}, gain: {}'.format(fc, Q, gain)
        filter = adsp.Filter(2, self.fs, type=string)
        b, a = adsp.design_lowshelf(fc, Q, gain, self.fs)
        filter.set_coefs(b, a)
        self.add_filter(filter)
Esempio n. 4
0
taus = sixteenth_full[40:80].astype(float) * 1.8
amps = sixteenth_full[80:]

FS = 48000
N = int(3 * FS)
# x = adsp.generate_modal_signal(amps, freqs, taus, len(amps), int(3 * FS), FS)

# %%
imp = adsp.impulse(N)
x = np.zeros(N)

for n in range(len(amps)):
    if n < 5:
        freq_osc = freqs[n] * 0.1 * np.sin(
            2 * np.pi * 1.5 * np.arange(N) / FS) * 0.99996**np.arange(N)
        filt = adsp.Filter(2, FS)

        for k in range(N):
            b, a = adsp.design_modal_filter(amps[n],
                                            freqs[n] + freq_osc[k],
                                            taus[n],
                                            FS,
                                            fs_measure=FS)
            filt.set_coefs(b, a)
            x[k] += filt.process_sample(imp[k])

    else:
        b, a = adsp.design_modal_filter(amps[n],
                                        freqs[n],
                                        taus[n],
                                        FS,