Forums

    3 posts

  • avatar
    121 sounds
    1545 posts
    Calculating speed from doppler shifts...


    Over at http://freesound.iua.upf.edu/samplesViewSingle.php?id=14830 Acclivity calculated the speed of the race-cars that Heigh-hoo recorded, so I thought, cool, let's do the same for http://freesound.iua.upf.edu/samplesViewSingle.php?id=18794 . However, being a geek I couldn't just take the formula and use it. I had to know why Acclivity calculated the speed like that. Soooo, here we are smile

    We assume the source travels at a constant speed, and we assume the source is traveling directly to the listener, not passing by at a distance (this is a 'good enough' simplification):

    Doppler frequency correction: http://en.wikipedia.org/wiki/Doppler_effect

    source going towards listener (positive speed)
    heard_freq_before = source_freq * (1 + speed_towards_listener / speed_of_sound)

    source going away from listener (negative speed)
    heard_freq_after = source_freq * (1 - speed_towards_listener / speed_of_sound)

    -> heard_freq_before / heard_freq_after = (1 + speed_towards_listener / speed_of_sound)/(1 - speed_towards_listener / speed_of_sound)

    let's rename some things.

    c = speed_of_sound
    heard_freq_before = f1
    heard_freq_after = f2
    speed_towards_listener = v

    f1/f2 = (1+v/c)/(1-v/c)

    -> f1/f2 * (1-v/c) = 1+v/c
    -> f1/f2 - 1 = v/c + f1/f2*v/c
    -> f1/f2 - 1 = (1+f1/f2)*v/c
    -> v/c = (f1/f2 - 1) / (1 + f1/f2)
    -> v = c*(f1-f2)/(f1+f1)

    c = 340.29 m/s
    f1 in Hz

    so...

    speed_of_moving_object = 340.29 m/s * (freq_before - freq_after) / (freq_before + freq_after)

    ( if you want the speed in km/h we need to multiply by 3.6 )

    Make sure you only use this formula for objects passing by at close distance, otherwise you will introduce an error...

    - bram

    Warning: if you break the rules, see my avatar. Freesound Admin, Moderator, Ex-Freesound-Coder & Benevolent Dictator For Life.
  • avatar
    546 sounds
    351 posts


    I'm so pleased to find there are more geeks here! Thanks Bram, and good fun on the Canada Geese!
    I remember learning this formula at school about 46 years ago, and getting a "mathematical thrill".

    For completeness, you should add that the speed of sound in the air (your 340.29
    m/s figure) depends on the air temperature.

    Speed of sound in air in m/s = 331.4 + 0.6T where T is air temperature in degrees Celsius
    (assuming the air is dry!).

    http://hyperphysics.phy-astr.gsu.edu/HBASE/sound/souspe.html

    Mike

    Freesound Moderator "Close your eyes, and you're almost there!"
  • avatar
    178 sounds
    740 posts


    Cool!

    This reminds me of the methods that astronomists use to calculate the relative velocity of other stars by measuring red-shift.

    Freesound Admin Official Acclivity Fan Club - Member Stuck with FLAC? Check the FAQ.

    3 posts