title: ios: how to get the current sample rate when an action happens
body: <p>I refer to the pitch detector project</p>
  
  <p>(<a href="http://demetrimiller.com/2011/01/25/pitch-detection-in-ios-4-x/" rel="nofollow">http://demetrimiller.com/2011/01/25/pitch-detection-in-ios-4-x/</a>)</p>
  
  <p>The sample rate is set as 44100.</p>
  
  <p>My question is that if I have an action in time A, how can I get the current number of sample rate it is in?
  I mean, the action A happens in the Ath frame.
  How can I get the date?</p>
  
  <p>Thanks very much!</p>
  
  <p>+</p>
  
  <p>My project is to measure the distance between two cellular phone using ultrasound.</p>
  
  <p>Device A sends a 18kHZ sound to device B, and once B detects a frequency higher than 18kHZ, B sends back the same sound to A.</p>
  
  <p>I cannot just get the local time to calculate the distance because there's a huge error. Hence I try to work on sample rate.</p>
  
  <p>Since the sample rate is 44100, there are 44100 samples, from the first to the 44100th. </p>
  
  <p>So I am wondering how can I know which sample it is when the device detects the 18kHZ sound.</p>