I’m preparing a work session with a percussionist, who for this project instead of his drumset will use a prepared table & piezo mic . I will use Flucoma’s kdtree classification ( which I explored already in the past ) to classify different materials he will hit, and objects he hit with. With already loads of creative possibilities.
Then I was asked if I could detect “where on the table the hit happens”, this could be an opportunity to explore regression, as I thought about training a model on a few zones with mlpregressor. Only then I wondered about what data to train on, with the intuition that using 2 or 3 contact microphones in the corners I could gather relevant signals about volume at least, @rodrigo.constanzo I bet you have some useful knowledge about this topic ?
Depending on the setup, you can probably get by with just training classes of a few different points. Or do a (simple) volume comparison and/or time-delay thing. This is much easier if you only have two contact mics as you can just compute it directly from the difference in arrival time (e.g. it arrives at the right contact mic first and then the left contact mic 150 samples later, would mean it was at a specific place on the table).
If you have 3 contact mics, then it becomes a more complex mathematical issue (this paper is a good place to start with this).
In terms of interpolating between trained classes, that’s been pretty tricky to do as well. There’s a bunch of info and examples in this thread here, with some working code I believe. I never got it working “well” but it worked alright.
I tried this after reading your answer (in puredata ),but sound in wood can go 5000 meter per second, so 0.2 millisecond per meter. With 64 samples per block at 44100 samples per second I can mesure a minimum difference of 1,45 milliseconds with the “timer” object ( pure data) . So I’d have to research how to measure smaller time intervals.
I’ll try volume comparison between 2 contact microphones.
Definitely have to count in samples. On a snare head, when I was doing triangulation stuff it was generally on the order of 40-80samples difference that I was working with. You can obviously work at higher sample rates for more resolution, but I find 44.1k was plenty.
Also, not sure how threading works in pd, but you want to be able to measure the differences sample-accurately (timer in Max is not sample accurate).
If you’re feeling fancy, cross-correlation can also help, but as @tremblap mentioned, comparing peaks works alright.
Another thing that I found decent success with (which I may talk about in that huge thread, don’t remember) is using the size of the first zero crossing, as outlined in this old Roland patent. Specifically this diagram:
This breaks down in a 3d space, but in a 2d space, you could probably even have just a single contact mic and use this approach to determine the distance to that single mic. Or two mics and then do this for both and take the mean of that.