Fwd: [PD] measuring distance between speaker and microphon

Miikka Tikander miikka.tikander at hut.fi
Wed Feb 14 16:15:05 CET 2007


I made some externals for binaural acoustic positioning for my work  
some time ago and it also included some externals for acoustic  
distance measurements. I was supposed to polish them up to be  
published on my website but  I never got that far... Anyway, here's  
one  simple patch with one of the distance measurement externals.

The external is an OSX version but I know I have a linux version  
somewhere as well. If needed I can try to find it and send it as  
well, or maybe I'll send the source so people can compile it  
themselves if interested. It should be compilable WIN and Linux as well.

As there's no documentation in the patch, here's a brief  
documentation for the patch and the external.

The DIST_HP~ external sends high-passed (> 17 kHz) impulses from the  
loudspeaker and then measures the fly-time of these impulses to two  
microphones (here input channels 1 and 2). The slider on the upper  
right hand corner (Impuse interval) sets the time interval (in 64  
sample blocks) of the impulses, that is, how often the distance is  

The last two outlets of the DIST_HP gives out the distance of the  
microphones to the loudspeaker in meters. I put a mean and a median  
filter on there as well to smooth the data but you may use whatever  
is appropriate. The distance is computed in sample accuracy.

The 'free_distance_in_meters'  -outlet transforms the impulse time  
interval to a physical distance. This, in principal, should be  
greater than the longest microphone-loudspeaker distance you will use.

The calibration is done by using the calibration_latency  -number on  
the left. Place a microphone to a known distance from the loudspeaker  
and then tune the calibration_latency so that the measured distance  
is correct. Increasing the latency  increases the measured distance.  
The measured distance cycles from 0 to the free_distance_in_meters.  
So, when increase the calibration_latency and the measured distance  
reaches the free_distance_in_meters it will go back to zero and  
continue from there.

The volume slider sets the output volume of the impulses. Note, that  
the impulses are high passed above 17 kHz so actually not everybody  
will here them! Be cautious with the volume. The whole idea of using  
higher frequency range was to make the impulses inaudible, and to  
avoid interference from room reflection and from other sounds as  
well. I have a version which uses full band impulses as well, but  
then the reflections start to worsen things..

You must use 44,1 kHz sampling frequency.

Hope, it works and is usable. Once I get little extra time, I'll try  
to get the rest of the stuff organized and documented so I can  
publish them here as well. Any feedback or criticism is always welcome.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: dist_hp~.pd_darwin
Type: application/octet-stream
Size: 18388 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20070214/a171d8cc/attachment.obj>
-------------- next part --------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: positio_demo_1ch.pd
Type: application/octet-stream
Size: 1431 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20070214/a171d8cc/attachment-0001.obj>

More information about the Pd-list mailing list