Last active
June 21, 2019 16:51
-
-
Save wmmnola/f7fff72495f3fd5aec726af82ac5bd92 to your computer and use it in GitHub Desktop.
Modeling distortion as a transfer function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import scipy.signal as sig | |
def dist(s, H, G): | |
f = np.linspace(0, 1000, len(s)) | |
H_seq = [H(f),H(f)] | |
inv_fft = np.real(fft.ifft(H_seq)) | |
final = sig.convolve(s, inv_fft, method='auto') | |
return G * final |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment