Skip to content

Instantly share code, notes, and snippets.

@wmmnola
Last active June 21, 2019 16:51
Show Gist options
  • Save wmmnola/f7fff72495f3fd5aec726af82ac5bd92 to your computer and use it in GitHub Desktop.
Save wmmnola/f7fff72495f3fd5aec726af82ac5bd92 to your computer and use it in GitHub Desktop.
Modeling distortion as a transfer function
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