# Algorithmic approach of the Doppler effect

A nice approach on how physics and computing together are fun

### Motivation

I’ve been studying a little bit about a pretty interesting use of the doppler effect as an interpreter of “natural gestures” based on sound waves “reflex” and a pretty nice algorithm. Take a look on this funny, but useful, explanation below.

### What exactly is the Doppler Effect?

By definition, the doppler effect is:

The apparent change in the frequency of a wave caused by relative motion between the source of the wave and the observer…

So, the right question should be:

#### What does the motion do to waves?

Perhaps isn’t so simple to understand without an example, so let’s picture the most common used example to visualize. Imagine that you stand on the street and an ambulance passes by with the sirens turned on. While it is getting closer to you, you’ll hear the tune is in a higher frequency because of ambulance movement effect on the sound wave.

Soon as the ambulance starts to move away from you, you’ll start to hear the tune getting “slower”, now the frequency is getting lower, again because of the movement effect on the sound wave.

More technically the Doppler effect is observed whenever the source of waves is moving with respect to an observer, it can be described as the effect produced by a moving source of waves in which there is an apparent upward shift in frequency for observers towards whom the source is approaching and an apparent downward shift in frequency for observer’s from whom the source is receding. It is important to note that the effect does not result because of an actual change in the frequency of the source.

The effect is noticed not only on sound waves but actually on every kind of wave.

To get a better “picture”, take a look at this:

## Applications

If you think on a nice way to manage and measure this changes of frequency in order to quantify them, you could make your computer acts as an interpreter and create something nice, like the guys at Unicomp have made.

They’ve created a pretty nice research based on the use of doppler effect on sound waves to interpret gestures around the computer, check out their paper here.

#### How does it work?

In order to measure the doppler effect for motion detection on a conventional computer, what you can do is send out a sinusoid at some known (human-inaudible) frequency, say, 20 kHz. If something is moving in the room, then, after the sinusoid has bounced around on the walls and into the microphone, the sound will shift in frequency. This can be measured by looking at the frequency spectrum in the nearby region of the 20 kHz tone. One of the cool things is that you don’t need a special equipment to make it work, but only a speaker and a microphone, already present on your notebook.

Take a look at a video exemplifying it:

Here you can find pretty nice JavaScript approach, and cool effect on webpages by scrolling with gestures.