Some markup improvements
This commit is contained in:
parent
4e9f975aed
commit
e268a55680
@ -25,9 +25,10 @@ y[n] = 1/ba[3] * ( ba[0] * x[n] + ba[1] * x[n-1] + ba[2] * x[n-2] +
|
|||||||
__all__ = ['peaking', 'biquadTF', 'notch', 'lowpass', 'highpass',
|
__all__ = ['peaking', 'biquadTF', 'notch', 'lowpass', 'highpass',
|
||||||
'highshelve', 'lowshelve']
|
'highshelve', 'lowshelve']
|
||||||
|
|
||||||
from scipy.signal import sosfreqz
|
from numpy import array, cos, pi, sin, sqrt
|
||||||
from scipy.interpolate import interp1d
|
from scipy.interpolate import interp1d
|
||||||
from numpy import sin, cos, sqrt, pi, array
|
from scipy.signal import sosfreqz
|
||||||
|
|
||||||
|
|
||||||
def peaking(fs, f0, Q, gain):
|
def peaking(fs, f0, Q, gain):
|
||||||
"""
|
"""
|
||||||
@ -51,6 +52,7 @@ def peaking(fs, f0, Q, gain):
|
|||||||
|
|
||||||
return array([b0/a0, b1/a0, b2/a0, a0/a0, a1/a0, a2/a0])
|
return array([b0/a0, b1/a0, b2/a0, a0/a0, a1/a0, a2/a0])
|
||||||
|
|
||||||
|
|
||||||
def notch(fs, f0, Q):
|
def notch(fs, f0, Q):
|
||||||
"""
|
"""
|
||||||
Notch filter
|
Notch filter
|
||||||
@ -70,6 +72,7 @@ def notch(fs, f0, Q):
|
|||||||
a2 = 1 - alpha
|
a2 = 1 - alpha
|
||||||
return array([b0/a0, b1/a0, b2/a0, a0/a0, a1/a0, a2/a0])
|
return array([b0/a0, b1/a0, b2/a0, a0/a0, a1/a0, a2/a0])
|
||||||
|
|
||||||
|
|
||||||
def lowpass(fs, f0, Q):
|
def lowpass(fs, f0, Q):
|
||||||
"""
|
"""
|
||||||
Second order low pass filter
|
Second order low pass filter
|
||||||
@ -89,6 +92,7 @@ def lowpass(fs, f0, Q):
|
|||||||
a2 = 1 - alpha
|
a2 = 1 - alpha
|
||||||
return array([b0/a0, b1/a0, b2/a0, a0/a0, a1/a0, a2/a0])
|
return array([b0/a0, b1/a0, b2/a0, a0/a0, a1/a0, a2/a0])
|
||||||
|
|
||||||
|
|
||||||
def highpass(fs, f0, Q):
|
def highpass(fs, f0, Q):
|
||||||
"""
|
"""
|
||||||
Second order high pass filter
|
Second order high pass filter
|
||||||
@ -131,6 +135,7 @@ def highshelve(fs, f0, Q, gain):
|
|||||||
a2 = (A+1) - (A-1)*cos(w0) - 2*sqrt(A)*alpha
|
a2 = (A+1) - (A-1)*cos(w0) - 2*sqrt(A)*alpha
|
||||||
return array([b0/a0, b1/a0, b2/a0, a0/a0, a1/a0, a2/a0])
|
return array([b0/a0, b1/a0, b2/a0, a0/a0, a1/a0, a2/a0])
|
||||||
|
|
||||||
|
|
||||||
def lowshelve(fs, f0, Q, gain):
|
def lowshelve(fs, f0, Q, gain):
|
||||||
"""
|
"""
|
||||||
Low shelving filter
|
Low shelving filter
|
||||||
@ -152,6 +157,7 @@ def lowshelve(fs, f0, Q, gain):
|
|||||||
a2 = (A+1) + (A-1)*cos(w0) - 2*sqrt(A)*alpha
|
a2 = (A+1) + (A-1)*cos(w0) - 2*sqrt(A)*alpha
|
||||||
return array([b0/a0, b1/a0, b2/a0, a0/a0, a1/a0, a2/a0])
|
return array([b0/a0, b1/a0, b2/a0, a0/a0, a1/a0, a2/a0])
|
||||||
|
|
||||||
|
|
||||||
def biquadTF(fs, freq, ba):
|
def biquadTF(fs, freq, ba):
|
||||||
"""
|
"""
|
||||||
Computes the transfer function of the biquad.
|
Computes the transfer function of the biquad.
|
||||||
@ -168,5 +174,3 @@ def biquadTF(fs, freq, ba):
|
|||||||
freq2, h = sosfreqz(ba, worN=freq, fs=fs)
|
freq2, h = sosfreqz(ba, worN=freq, fs=fs)
|
||||||
interpolator = interp1d(freq2, h, kind='quadratic')
|
interpolator = interp1d(freq2, h, kind='quadratic')
|
||||||
return interpolator(freq)
|
return interpolator(freq)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user