Skip to content

Instantly share code, notes, and snippets.

@pushkarsingh019
Created October 21, 2024 13:15
Show Gist options
  • Select an option

  • Save pushkarsingh019/1f73dbb2b840f1b2c38e87ff82c6f370 to your computer and use it in GitHub Desktop.

Select an option

Save pushkarsingh019/1f73dbb2b840f1b2c38e87ff82c6f370 to your computer and use it in GitHub Desktop.
Creating Sounds with HRTF
import slab
import slab.sound
slab.set_default_samplerate(44100)
hrtf = slab.HRTF.kemar()
white_noise = slab.Sound.whitenoise(duration = 2.0)
white_noise_binaural = slab.Binaural(white_noise)
angle = 80
filter = hrtf[angle]
right_80 = filter.apply(white_noise_binaural)
left_80 = slab.Binaural([right_80.right, right_80.left])
right_80.write('right_80.wav')
left_80.write('left_80.wav')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment