Skip to content

Instantly share code, notes, and snippets.

@mitallast
Created February 14, 2016 08:57
Show Gist options
  • Select an option

  • Save mitallast/9938f2572ef42a762889 to your computer and use it in GitHub Desktop.

Select an option

Save mitallast/9938f2572ef42a762889 to your computer and use it in GitHub Desktop.
Prints impulse response from wav file format (like a reverb or guitar cab IR)
from scikits.audiolab import Sndfile
import numpy as np
import matplotlib.pyplot as plt
import scipy.signal
f = Sndfile('impulse.wav', 'r')
data = np.array(f.read_frames(f.nframes), dtype=np.float64)
f.close()
fs = f.samplerate
N = int(f.nframes)
w, h = scipy.signal.freqz(data, a=1, worN=N)
plt.semilogx((fs * 0.5 / np.pi) * w, abs(h))
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment