Interaural Time Delay
Humans locate the origin of a sound with several cues. One technique employs the small difference in the time taken for the sound to reach either ear; this is known as the interaural time delay (ITD).
Lord Rayleigh investigated this phenomenon, assuming a spherical head with radius a, and sound waves arriving at an azimuth angle θ.
Sound has to travel a distance a θ +a sinθ further to reach the left ear than the right ear. Hence, if the speed of the sound is c, then the interaural sound delay is
ITD = ac θ+sinθ
where c is the speed of sound.
For c = 343 m s-1, a = 0.11 m and θ = 0.5 π (that is, a sound hitting a typical-sized head from the side), the sound delay is about 0.8 ms.
This application modifies a single-channel audio file so that the sound appears to originate at an angle from the observer. It does this by introducing an extra channel of sound. The new channel is equivalent to the old channel, but is padded with zeroes.
Despite both channels having the same amplitude, the sound appears to come from an angle simply by delaying one channel.
restart: withAudioTools: withArrayTools:withLinearAlgebra:
Speed of sound in m s-1
c:=343:
Radius of head in m
a:=0.08:
Angle of sound
soundAngle:=30⁢π180:
Read sound file and calculate statistics
Example Sound
Optional: Record a Custom Sound
Sound≔ReadFileTools:-JoinPath⁡audio/ding.wav,base=datadir
SampleRate:=attributes⁡Sound1
SampleRate:=22050
BitRate:=attributes⁡Sound2
BitRate:=16
SoundDuration ≔ 5s:
Click on the microphone to begin recording:
Interaural time delay
ITD:=θ→a⁢θ+sin⁡θc:
Hence we need to delay one channel by this number of samples
TimeDelay:=SampleRate⋅ITDsoundAngle
TimeDelay:=5
zeroes≔Array1..TimeDelay,order=C_order:
if TimeDelay = 0 then M0≔Sound; M1≔Sound; elif TimeDelay <0 then M0≔Concatenate2,Sound,zeroes; M1≔Concatenate2,zeroes,Sound; elif TimeDelay > 0 then M0:=Concatenate2,zeroes,Sound; M1≔Concatenate2,Sound,zeroes; end if:
DirectionalSound:=CreateTransposeConcatenate1,M0,M1*~1/2,channels=2,rate=SampleRate,order=C_order:
SignalProcessing:-SpectrogramDirectionalSound,includesignal
Download Help Document