Interaural Time Delay - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Math Apps : Engineering and Applications : applications/InterauralTimeDelay

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

SoundReadFileTools:-JoinPathaudio/ding.wav,base=datadir

Sound:= 1 .. 20191 ArrayData Type: float8Storage: rectangularOrder: C_order

(1)

SampleRate:=attributesSound1

SampleRate:=22050

(2)

BitRate:=attributesSound2

BitRate:=16

(3)

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:=SampleRateITDsoundAngle

TimeDelay:=5

(4)

zeroesArray1..TimeDelay,order=C_order:

if TimeDelay &equals; 0 then     M0Sound&semi;     M1Sound&semi; elif TimeDelay <0 then     M0Concatenate2&comma;Sound&comma;zeroes&semi;     M1Concatenate2&comma;zeroes&comma;Sound&semi; elif TimeDelay &gt; 0 then     M0:=Concatenate2&comma;zeroes&comma;Sound&semi;     M1Concatenate2&comma;Sound&comma;zeroes&semi; end if&colon;

DirectionalSound:=CreateTransposeConcatenate1&comma;M0&comma;M1*~1&sol;2&comma;channels&equals;2&comma;rate&equals;SampleRate&comma;order&equals;C_order&colon;

SignalProcessing:-SpectrogramDirectionalSound&comma;includesignal