[PD] measuring distance between speaker and microphon

Roman Haefeli reduzierer at yahoo.de
Mon Feb 19 16:46:07 CET 2007

hi mikka

thank you very much for all that detailed information and sorry for my
late reply. i didn't have too much time and i really wanted to have a
closer look at this before answering. 

i am on linux, so i couldn't test your external. but from what you
describe in your mail, it follows a similar approach i tried as well,
the only difference is that yours obviously works, whereas i've had bad
luck yet with my tests ;-). maybe i am wrong, but i believe that the
method you describe could be implemented in plain pd without using
externals (this is at least what i hope). 

am i right in thinking that the analysis part of your external also high
pass filters the incoming signal from the mic and the measures the time,
until a certain amplitude of the signal is triggered? i have many
problems implement this nicely. the main problem is i think is, that i
maybe should do the trigger mechanism adaptively, so that it works on
changing levels. how is that done in your external?

if you don't mind, it would be nice to have the source code of your
external, so that i could at least try to compile it, though i am not a
programmer myself and maybe i fail without a ready-made makefile. but
it's sure worth a try.

thank you again for sharing all that information about this topic.


On Wed, 2007-02-14 at 16:51 +0200, Miikka Tikander wrote: 
> Hi,
> 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  
> measured.
> 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.
> -miikka
> On Feb 14, 2007, at 2:18 PM, Roman Haefeli wrote:
> > hi all
> >
> > i'd like to create a patch, that measures the distance between the
> > speaker and the microphone. my first problem is, that i don't know  
> > which
> > kind of signal would be suitable for that purpose. the simplest is to
> > use a dirac impulse. but on the receiver-side it's hard to separate
> > unwanted artefacts from the impulse itself. also it would be nice,  
> > if it
> > would be possible to detect the signal reliably at different  
> > amplitudes,
> > since the amplitude heavily changes when moving the mic closer to and
> > farer from the speaker. i am looking for a method, that allows higher
> > precision than the usual block-size (which introduces a grid of  
> > ~0.5m @
> > 44100Hz, which is not very accurate). also should it be possible to
> > detect the signal correctly, when there was reverberation added from a
> > room. i know, there are ultrasonic-bases devices to measure a distance
> > to a wall, but i don't have clue how they work, but it makes me hope,
> > that something similar is possible with pd. any hints are much
> > appreciated.
> >
> > roman
> >
> >
> >
> >
> > 	
> > 		
> > ___________________________________________________________
> > Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo!  
> > Mail: http://mail.yahoo.de
> >
> >
> > _______________________________________________
> > PD-list at iem.at mailing list
> > UNSUBSCRIBE and account-management -> http://lists.puredata.info/ 
> > listinfo/pd-list

Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de

More information about the Pd-list mailing list