Sunday 27 June 2010

Rotating Source

When considering a rotating observer, the change in velocity will be a reciprocal component generated from rotary motion and will vary the frequency, dependent on the source distance, revolutions per minute (rpm) and angular position.

(picture from http://www.daerospace.com/MechanicalSystems/DwellLinkFig1.png)


The system has a relationship similar to that of the crank and shaft mechanism pictured above and a mathematical representation similar to piston equations, describing rotary motion converted into reciprocal.

  • L = length of rod (distance between piston join and crank join)
  • r = crank radius
  • theta = angular velocity
  • x = reciprocal displacement
Angular velocity


to get the velocity with respect to angular position, we differentiate using chain rule:






to get the velocity with respect to time:


Plotting the relationship between angular position and change in reciprocating velocity, we find that when the source is far away, the relationship represents one that is sinusoidal in nature and as it gets closer, it converges on a tangential relationship.


Graph above is the reciprocating velocity relationship, head size 20cm and source distance 30cm.

Graph above is the reciprocating velocity relationship, head size 20cm and source distance 1 metre.


Rotating Binaural Dummy Head


Using the change in velocity from the above graph and putting it into the equation for doppler effect as a variable, the relationship for change in frequency can be found.


In the graph above, the line that is positive from 0 to (pi) and then negative between (pi) and 2(pi) is the left ear of the binaural microphones. The above equation in the graph describes this relationship. The other line on the graph corresponds to the lower equation and is the same as the upper equation, with a half-phase difference.

The change in frequency can be seen on the y-axis, only varying 6 Hz, changing from 503 - 497Hz and having a rest frequency of 500Hz.


Above image shows the effect of the rotating binaural dummy head at 500Hz.
Rotating at 84.5rpm

Thursday 17 June 2010

Doppler Effect

Doppler effect describes the frequency of a moving source past an observer, for example a siren on an emergency vehicle speeding past a stationary observer.


"Doppler effect from ambulance siren binaurally"

Ambulance Doppler Effect recorded using binaural microphones

(recorded in the meadows, edinburgh 17/06/2010)

From measuring the change in the ambulances pitch, you could effectively calculate the velocity that it is traveling. This is how speed guns work and how we are able to calculate the relative speed of distant astronomical objects using the Doppler effect.

The effect on the frequency that the observer hears, is one that begins high and gradually decreases before becoming the frequency that it produces at rest, directly in front of the observer. This is due to the sound being compressed by the vehicles motion, relative to the observer.

When the vehicle has passed and is moving away from the observer, the frequency decreases again, as the sound waves produced on the vehicle are being stretched by the vehicles motion, relate to the observer.

The same effect also happens for light relative to a stationary observer, positioned at (p4) in the diagram below (showing how light is shifted for a traveling observer). The below diagram shows that, for a stationary observer at position (p4) with sound travelling from left to right, the waves are compressed as they approach the observer and as they pass and travel away from the observer, they are expanded. Also, notice how the expansion and compression will be different for a source that passes in front, behind or at angles to the observer.

(image from http://archive.ncsa.illinois.edu/Cyberia/Bima/doppler.html, Eleni Adrian, NCSA.)

Copyright © 1995: Board of Trustees, University of Illinois





The change in frequency depends not only on the speed of the vehicle, the speed of sound and the sources rest frequency, but also on the angle between the source and the observer.

"The phenomenon is due to the fact that during approach of source and observer the apparent pitch of the source of sound is higher than its true pitch and during separation lower than its true pitch"(wood, 1940)

  • u0 = observer velocity
  • f0 = observer frequency
  • fs = source frequency
  • us = source velocity
  • v = speed of sound (~343m/s)


Above is the equation for the Doppler effect, when considering a source that is not along the wave vector (a connecting straight line between source, observer and beyond), we need an equation that expresses the observer and source at angles to one another.


(picture above shows both the source, observer and the angles that are important for our equations. Picture from Ma, Lianxi et al, Doppler Effect of Mechanical Waves and Light, 2009)


For this we need:


When the source is traveling parallel to the wave vector in front of the observer (or behind) and the observer is stationary, this part of the equation (located at the top right),

is equal to zero.

The equation then becomes:


Which will then be used to calculate the frequency at the observer, having the source velocity, angle from the wave vector to the line joining the source, the frequency of the source and the speed of sound traveling in air.


To help visualize how the frequency changes as the source moves past the observer, a graph of observer frequency over source frequency against angle had to be plotted. The trend shows a slow decrease in frequency until reaching 40 degrees where the change in frequency becomes one that is linear. After passing the position of the observer at 90 degrees, the frequency begins to drop below its rest value and decreases linearly with change in angle until around 140 degrees.

As the speed of the source is increased, the ratio of change increases too.


(mathematics referenced from doppler effect of mechanical waves and light found in my reference links)

Using this information the Doppler effect can be very easily simulated in Csound.


Csound code for Doppler Effect:

; Lewis Doppler effect
;Dopplereffectangle.orc

sr = 44100
kr = 11025
ksmps = 4
nchnls = 2

instr 2

;p4 = the speed of the source
;p5 = the frequency of the source at rest


idur = p3

k1 linseg 0.174532,idur,2.967 ;change of angle in radians
; radians = (pi/180)*degrees

ang = 1/(1-((p4*cos(k1))/343)) ;proportion of frequency compression and expansion

angle = ang*p5 ;proportion multiplied by frequency


k2 linseg 0,idur/2,10000,idur/2,0 ;Amplitude modulation
krat linseg 0,idur,1 ;Stereo
a2 oscil k2,angle,1
outs a2*krat,a2*(1-krat)

endin



; Lewis Doppler effect
;Dopplereffectangle.sco

f1 0 4096 10 1 ; use gen 10 to compute a sine wave


;instr strt dur Vs Freq(source)

i2 0 5 10 100
i2 7 5 20 500
i2 14 5 5 1000
i2 21 3 20 250
i2 27 5 25 4000

This example can be played in the link:

"Doppler effect in Csound using trigonometric frequency change"

Doppler Effect synthesized in Csound using trigonometric frequency relationship


Monday 7 June 2010

Synthesizing Rayleigh Duplex Theory

Using the binaural recording of a 1kHz source at 50 degrees from the dummy head, ITDs and ILDs were extracted from the waveform in audacity and synthesized using Csound.

Below is the waveform of a 1kHz pure tone recorded by the binaural system that used to interpret ILDs and ITDs. The ITD is shown clearly by the shaded area, it extends from the peak in the left channel, to the peak in the right channel that corresponds to the same peak of the original source. Due to the greater path difference that sound has to travel to reach the ear that is further from the source, a delay is created. This delay is then used in Csound between two separate channels to synthesize this effect.

The ILD is achieved in csound by setting the amplitude of the two channels at the same difference ratio as the binaural recording.




The programs used:

; 1000 Hz 50 degree ITD frequency tone
;ITD 50 degrees 1000Hz tone.orc
; Hz sine wave at amplitude 10000

sr = 44100
kr = 11025
ksmps = 4
nchnls = 2

instr 1
idur = p3
a1 oscil 10000,1000,1
krat linseg 0, 0.0000001,1
outs a1*krat,a1*(1-krat)
endin

instr 2
idur = p3
a2 oscil 6000,1000,1
krat linseg 0, 0.0000001,1
outs a2*(1-krat), a2*krat


endin

Score File

;Score file
;ITD 50 degrees 1000Hz tone.sco

f1 0 4096 10 1 ; use gen 10 to compute a sine wave
i1 0 5 ; play instr 1 for 5 secs starting at 0
i2 0.000494 5.000494 play instr 2 for 5 secs starting at 0.494ms
e ; end of score





The pictures above show the synthesized waveform recreated from the ITD and ILD of an 1kHz tone at 50 degrees from the listener.

The sound can be found in 'my videos' link on my home page.