Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def getNearestUCDpulse(azimuth, elevation, h3D):
- """
- retrieves the impulse response from h3D that is closest to the specified
- azimuth and elevation (in degrees)
- h3D is the array containing all HRTFs for a given subject (left or right)
- """
- elmax = 50
- elindices = np.arange(elmax)
- elevations = -45 + 5.625 * (elindices-1)
- azimuths = np.concatenate(([-80, -65, -55], np.arange(-45, 45+1, 5), [55, 65, 80]))
- # el est est l'indice du plus proche de l'indicie elevation entré
- el = round ((elevation + 45) / 5.625 + 1)
- el = np.maximum(el, 1)
- el = np.minimum(el, elmax)
- elerr = el - (elevation + 45) / 5.625 + 1
- # azim est l'indice du plus proche de l'indice azimuth entr�
- daz = abs(azimuths - azimuth)
- azim = np.argmin(daz)
- azerr = daz[azim]
- print('les paramètres utilisés pour la HRTF sont:')
- print('\t azimuth: %i degrés' % azimuths[azim])
- print('\t élevation: %6.3f degrés' % (-45 + 5.625 * (el - 1)))
- print('les indices sont:')
- print('\t azim: %i' % azim)
- print('\t el: %d ' % el)
- pulse = np.squeeze(h3D[azim,el,:])
- return pulse, azerr, elerr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement