[PD] Ultrasonic 'theremin' patch

Ico Doornekamp pd at zevv.nl
Thu Aug 7 21:16:37 CEST 2008


Hi all,

Yesterday I found out that modern audio cards can do much higher sample
rates then 48000, which allows for entertaining experiments with
ultrasound. 

I'm not sure if this has been done before, but I'm pretty happy with the
results so far.

I've created a patch running on a samplerate of 88200 Hz, which sends
out high-frequency chirps over two laptop speakers. The chirps are
reflected back to the bultin mic using both hands. The reflection is
correlated with the outgoing chirps to calculate the time the sound
waves needed to return to the mic, thus measuring the distance to the
hands or any objects hovering above the laptop.

This particular patch just drives two tone generators whose frequencies
depend on the measured distances, which are played back over the same
speakers as the high-frequency chirps. The result is a
two-tone-polyphonic theremin-like instrument. 

If only I could play this thing in tune...

A simple demonstration video and the patch can be found at
  
  http://zevv.nl/play/code/ultrasonic-theremin/

This patch just a first test using ultrasound, I'm sure much more
interesting things can be done using this technique.

The patch is not very well documented at this time, and I think getting
things to work needs a fair amount of tweaking for each different setup.
Things that need to be setup properly are output level of the soundcard,
a magic gain factor after the correlation, and the range that should be
inspected for echo peaks to avoid detecing of reflections from the
ceiling.  I think it would be possible to make the patch do some
auto-detection of some of the paremeters like ceiling height and gain
factors, which would make a nice addition for future versions.

Enjoy,

Ico

-- 
:wq
^X^Cy^K^X^C^C^C^C




More information about the Pd-list mailing list