Greatest Possible Timing Precision


    Mar 29 2006 | 4:55 pm
    This is related to my motion tracking using piezos post(below) but is really a new topic.
    I am attempting to track where a ping pong ball hits a table during a game using an array of microphones.
    I need to ask if it is possible with a standard audio interface (in my case m-audio firewire audiophile).
    I know that sound travels at 340m/s and I am estimating that it travels at 600m/s through the table.
    I think that to detect the position of impact within 5cm I need to be able to access data from the microphones to within 1/12 of a millisecond.
    I understand that it is possible to sync Max to an external clock or to change the length of (what it thinks is a) millisecond to get at the timing data.
    I understand that I can sample audio at a frequency of 44,100.
    But.....and this is the question
    Is it possible to analyse the signals accurately at these sub-millisecond levels?
    Anyone any thoughts?
    Gav

    • Mar 29 2006 | 5:41 pm
    • Mar 29 2006 | 5:53 pm
      Hi Gavin, My suspicion is that you are using max objects, when you actually need the precision of MSP signal-based objects. I suggest using a signal based timer, as demonstrated in the patch below. This will give you far greater accuracy than using the timer object. Hope this helps get you started.
      Cheers, Andrew B.
    • Apr 01 2006 | 10:46 pm
      I've been experimenting with MSP and I'm getting there but could really use a hand!
      I now have a patch which detects the incoming signal (at 96000 hz)and outputs the time if the level goes above a threshold value.
      The main problem is that either the count~ or the snapshot~ objects are jumping in steps of 512 (or whatever value I set the hardware buffer to).
      I need to detect where the amplitude rises to within a sample or 2. 512 is not precise enough.
      I've been playing around with recording the input into a named buffer. I can see the wave forms in each channel, the information is there but I don't know how to get it.
      I have been trying to search through the buffer using count~ and index~ but getting a bit stuck.
      Anyone know what I'm on about?
      Gav
    • Apr 02 2006 | 4:10 pm
      On 2-Apr-2006, at 0:46, gavin wrote:
      > The main problem is that either the count~ or the snapshot~ objects > are jumping in steps of 512 (or whatever value I set the hardware > buffer to).
      Yeah. Max messages (ie, anything going through plain-vanilla patch cords) are only triggered between signal vectors. You could set your signal vector size to 2 samples (you can even set it to single- samples by using a ;max message), but for what you want you would be better off to do everything the MSP-domain.
      Hope this gets you going in the right direction. Someone else may feel inclined to try to amend your patch.
      -- Peter
      -------------- http://www.bek.no/~pcastine/Litter/ ------------- Peter Castine +--> Litter Power & Litter Bundle for Jitter
      iCE: Sequencing, Recording & |home | chez nous| Interface Building for |bei uns | i nostri| Max/MSP Extremely cool http://www.castine.de http://www.dspaudio.com/
    • Apr 02 2006 | 7:28 pm
      > Is it possible to analyse the signals accurately at these sub-millisecond levels?
      do the math ... 1/12th milisecond at 44.100 Hz is humh ..possible, yet its all but precise.
      any chance to repeat the experiment with a bigger ball in a bigger room ? :)
    • Apr 02 2006 | 7:36 pm
      Quote: gavspav wrote on Sat, 01 April 2006 15:46 ---------------------------------------------------- > I've been experimenting with MSP and I'm getting there but could really use a hand! > > I now have a patch which detects the incoming signal (at 96000 hz)and outputs the time if the level goes above a threshold value. > > > The main problem is that either the count~ or the snapshot~ objects are jumping in steps of 512 (or whatever value I set the hardware buffer to). > > I need to detect where the amplitude rises to within a sample or 2. 512 is not precise enough. > > I've been playing around with recording the input into a named buffer. I can see the wave forms in each channel, the information is there but I don't know how to get it. > > I have been trying to search through the buffer using count~ and index~ but getting a bit stuck. > > Anyone know what I'm on about?
      havent been looking at the patch but maybe its simpler than you thought. there is, for example, the [>~] object to split signals and so detect certain values. or why not substract -0.9 from the input and then use [zerox~] to find the most peaks of the ping pong sounds.
      use signals only or you can forget it.
      whats your aim, what do you want to do with the "sequence" data?
    • Apr 03 2006 | 11:27 am
      Hello,
      thanks for your suggestions.
      Peter when you say Max messages are the ones with the plain/vanilla patch cords do these signify messages from MSP to Max?
      Also I am trying to keep it in the MSP domain but am I right in thinking that:
      MSP threads running at signal rate operate once every time a chunk of sound is brought in which for me at the mo is 512 samples (My hardware buffer is set to 512 samples)
      But within the objects there are operations going on at the sample rate i.e 96000 hz
      If MSP processes the data in chunks, then how can I find out information relating to individual samples? The only way I have found to do it so far is by using an onject like peak~ which seems to force me to use max objects.
      I wish to pinpoint when events happen to within a sample but it is not imperative that I process the data immediately. I am thinking that as long as I record the events I have a few ms to detect when they actually occur, so I could possibly use max objects as well.
      Thanks,
      Gavin
    • Apr 03 2006 | 7:10 pm
      Hi Gavin,
      If you haven't already, you may wish to investigate a network that uses the sah~ object in conjunction with snapshot~ and edge~. Even with these objects it can be problematic to isolate exactly the data you want from a signal stream; some work has been done in this area and a future version of Max may include a more precise tool to move from the signal to event world.
      Ben
    • Apr 03 2006 | 8:39 pm
      > some work has been done in this area > and a future version of Max may include a more precise tool to move > from the signal to event world.
      One of the reasons I love cycling so frickin much is that you guys are transparent. I don't want to get off on a leftist rant here(take that dennis miller), but when we ask you things, you respond honestly and openly. It was a passing comment but its not to be taken lightly. I don't see this happening in many places. and its worth an extra couple bucks and should be an example.
      got that choir?! -matt
    • Apr 03 2006 | 8:43 pm
      Hi Ben,
      when you say some work has been done in this area, is there any links where I might be able to learn about this stuff.
      I have experimented with sah~, edge~, snapshot~. I'm a bit in the dark though to be honest.
      Gav
    • Apr 05 2006 | 8:53 am
      Ben Nevile wrote: > a future version of Max may include a more precise tool to move > from the signal to event world.
      To measure sample accurate timing I'd use mxj~ to do the timing and then pull the result out to the event world.
      Thats probably the way to go. Counting samples in Java shouldn't be too hard even for a Java newbie. All the documentation and the examples are there.
      That means (as mostly) already the recent version of Max could do it...
      Stefan
      --
      [][] [][][] [][] [][][] [][][][][][][][][][][][][][][]
      Stefan Tiedje Klanggestalter Electronic Composition & Improvisation
      /~~~~~ \ /|() ()| ))))) )| | |( \ /// _/)/ ))))) ___/ ///
      -------------------------x---- --_____-----------|----------- --(_|_ ----|-----|-----()---- -- _|_)----|-----()----------- ----------()------------x-----
      14, Av. Pr. Franklin Roosevelt, 94320 Thiais, France Phone at CCMIX +33-1-57 42 91 09
    • Apr 13 2006 | 8:54 am
      Thanks for the tip.
      I'm back on the case now after a short break. Looking at the Javascript documentation now.
      Stefan wrote: Counting samples in Java shouldn't be too hard even for a Java newbie. All the documentation and the examples are there.
      Stefan, are you referring to the javascript documentation within the MaxMSP folders or something else?
      Gavin
    • Apr 13 2006 | 1:14 pm
      gavin wrote: > Stefan wrote: Counting samples in Java shouldn't be too hard even for > a Java newbie. All the documentation and the examples are there. > > Stefan, are you referring to the javascript documentation within the > MaxMSP folders or something else?
      Don't mix Javascript with Java, I am reffering to Java and the mxj~ object. You should get started with the mxj~ helpfile and the WritingMaxExternalsInJava.pdf especially page 43, dealing with mxj~ and audio.
      Stefan
      --
      [][] [][][] [][] [][][] [][][][][][][][][][][][][][][]
      Stefan Tiedje Klanggestalter Electronic Composition & Improvisation
      /~~~~~ \ /|() ()| ))))) )| | |( \ /// _/)/ ))))) ___/ ///
      -------------------------x---- --_____-----------|----------- --(_|_ ----|-----|-----()---- -- _|_)----|-----()----------- ----------()------------x-----
      14, Av. Pr. Franklin Roosevelt, 94320 Thiais, France Phone at CCMIX +33-1-57 42 91 09
    • Apr 13 2006 | 1:19 pm
      Oops my mistake! Ok thanks I'll get stuck in,
      Gav