Piezo Triangulation

synnys's icon

Hi!

This is my situation:

A circle with a diameter of approximately 6m with 6 monitor speakers on the ceiling. It's not a surround system, but i will be used for spatial sound positioning, that part's working fine.

This is my problem:

I want to be able to detect the exact location of the people entering the circle. I know this can quite easily be done using motion tracking / camera's. I even considered LIDAR (laser tracking system). But i wanna solve this using piezo sensors. As i not only want the location of the people, but also wanna use the 'rhythm' of the footsteps of the people.

Can somebody help me on my way? Maybe a example patch?

I'm aware that this can be done (http://tangible.media.mit.edu/projects/pingpongplus/) which is more or less the same thing. But I can't seem to figure out HOW to program this in Max/Msp as I'm quite new to programming.

Any help or suggestion would be much appreciated!

seejayjames's icon

At first glance I think this would be very tricky if you want to track more than one person---how would you be able to distinguish between them? To ensure that your three distances are referring to the same person? Not sure that could be done.

If it's just one person, you might be able to do it with triangulation. Each distance is a radius of an imaginary circle around the piezo, where they intersect is your person. Or something like that... :)

brendan mccloskey's icon

..and would force-sensing resistors be a better application? You could easily cobble together an [expr] with preset conditions, maybe using [split] as well, to determine proximity to sensor X, Y or Z. Three incoming values, if X > Y+Z; if Y > X+Z; if Z > X+Y. I'm not in front of Max right now, so this is just off the top of my head.
Brendan

andrewakko's icon

I'm also making some research about this, I found a interesting project dealing with the arduino directly and check position in the space.
https://coolarduino.wordpress.com/2012/10/01/sound-localization/#comment-494

I start making some sketchs in Max, but already got stuck in how to calculate the delay value between 2 mics. I know from the amount of amplitude in which side the source is coming but could not figure how the system can work exactly.

gavspav's icon

Depending on the accuracy you need you may need to use Gen~. As I understand it you need to calculate the time it takes for the sound to get to each piezo and then do some maths! Depending on your audio setup Max receives the audio data in packets equal to your buffer size.

So if your sampling rate is 44,100 and your buffer size is 256 you get approx 172 packets a second. So your time resolution is about 6ms.
This might sound quite fine but the speed of sound is quite fast. 3,500 m/s through wood or 343 m/s through the air.
So depending on if your piezos are surface mounted or not in 6ms sound can travel 18m through wood or 1.8m through the air.
Clearly in a 6m space this isn't accurate enough. So you need to work at a sub buffer rate.

Gen allows you to do this, allows you to work with the individual samples within the buffer so you can theoretically make the above 256 times more accurate. A sampling rate of 44,100 could give you accuracy to within 8cm through wood or about 0.8cm through the air!

All this could well be wrong but I look forward to being corrected!

I'm sorry to say I never followed this up (not yet anyway) but maybe these will help:

https://cycling74.com/forums/gen-useful-for-time-difference-of-arrival
http://pppp.media.mit.edu/ - I couldn't find the code though - although it says its open source. If you find it please let me know!

leafcutter's icon

I did some quick preliminary experiments using gen~ to measure position between 2 mics in air, it looked quite promising and was fairly accurate.

Steven Miller's icon

Leafcutter, got any code worth sharing at this point? Given the significant difference in sound transmission speed between gases and solids, this may not be a good indicator for the original poster, unfortunately. I'll be interested to see what comes of this, hoewver...it could be very useful.

On the other hand, perhaps the OP can divide the original problem into two solutions: one for position tracking and one for getting the walking rhythms.

Edwin van der Heide's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Here follows a patch that calculates the time difference between two received signals coming from an identical source. I've used it with a stereo microphone setup (AB not XY!) but it could be extended to a setup with three or four microphones to calculate the exact xyz position of a sound source in space.
The patch calculates the correlation function between two signals and looks for the peak in the function.
The patch only works when the direct signal is louder then the reverb.
I've originally made the patch in max 4 and did the peak detection in max. Nowadays it makes more sense to do this with gen~.