Skip to content

Instantly share code, notes, and snippets.

@rkmaddox
Created April 17, 2017 17:32
Show Gist options
  • Save rkmaddox/f40b53beb21092a8b50243baec1d70d4 to your computer and use it in GitHub Desktop.
Save rkmaddox/f40b53beb21092a8b50243baec1d70d4 to your computer and use it in GitHub Desktop.
import numpy as np
from expyfun.stimuli import convolve_hrtf
import scipy.signal as sig
import matplotlib.pyplot as plt
plt.ion
fs = 44100 * 4
plt.figure()
plt.subplot(211)
h = np.array([convolve_hrtf([1], fs, a, 'cipic', interp=False)[0] for
a in np.arange(-90, 90 + 1e-12, 5)])
kw_args = dict(aspect='auto', interpolation='none', cmap='RdBu',
clim=np.array([-1, 1]) * np.max(np.abs(h)),
extent=[0, h.shape[-1] / float(fs) * 1e3, -90, 90])
plt.imshow(h, **kw_args)
plt.title('Left ear BRIR')
plt.ylabel('Azimuth (degrees)')
plt.subplot(212)
hi = np.array([convolve_hrtf([1], fs, a, 'cipic', interp=True)[0] for
a in np.arange(-90, 90 + 1e-12, 0.1)])
plt.imshow(hi, **kw_args)
plt.ylabel('Azimuth (degrees)')
plt.xlabel('Time (ms)')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment