Created
November 17, 2024 06:20
-
-
Save pushkarsingh019/bad0ae23bf8f2bfa30b1e6cc62571385 to your computer and use it in GitHub Desktop.
ITD CUES SOUND
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_angled_sound(angle, sound, externalise, frequency): | |
| """ | |
| This function takes in azimuth angle and monoaural sound and returns sound with the specified angle. | |
| Angle : azimuth angle. Where 0 is the center. So one posituve integer. | |
| Sound : the sound on which you want to get the angled sound. | |
| externalise : Boolean. If the function should externalise sound or not. | |
| frequency : Frequency of the sound to calculate ITD. | |
| head_size : Optional. In case you want calculate ITD specific to head sizes. | |
| Returns : Two slab.Binaural instances with left and right versions of the sound. | |
| """ | |
| # calculating ITD | |
| itd = sound.azimuth_to_itd(angle, frequency = frequency) | |
| # applying itd to sound | |
| right = sound.itd(duration = itd) | |
| left = sound.itd(duration = -itd) | |
| if externalise: | |
| right = right.externalize() | |
| left = left.externalize() | |
| right.level = level | |
| left.level = level | |
| return left, right | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment