• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: understanding AudioTimeStamp
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: understanding AudioTimeStamp


  • Subject: Re: understanding AudioTimeStamp
  • From: Tusi Chowdhury <email@hidden>
  • Date: Tue, 07 Jan 2014 09:22:32 -0500

Hi,

Thanks for your reply. I needed to sync audio time with motion sensor time, so couldn't use mSampleTime. 

I actually  figured out what I needed from audioTimeStamp. If anyone needs, here it is:

I wanted to get audio time in "number of seconds since the device booted", because that's the unit core motion's timestamp from CMLogItem gives.

So I took the mHostTime, which from my understanding is in number of ticks since device booted, and converted into number of seconds since device booted using the mach time base info.

#include <mach/mach_time.h>

// evaluate the timeStamp in secods
    static mach_timebase_info_data_t timeBaseInfo;
    if (timeBaseInfo.denom == 0) {
        (void) mach_timebase_info(&timeBaseInfo);
    }
    double time2nsFactor = (double) timeBaseInfo.numer / timeBaseInfo.denom;
    double timeStamp = (audioTimeStamp->mHostTime * time2nsFactor)/pow(10,9); //because origin mHostTime*factor gives in nanoseconds


Regards,

Tusi

On Jan 7, 2014, at 9:08 AM, Robert Carroll <email@hidden> wrote:

My impression is that normally the mSampleTime is the timing information you should need, unless you have a specific reason to convert to mach_absolute_time.
The timebase using information from the machine that the code is running on, ie. the clock frequency etc.

There is some older sample code from Doug Wyatt that covers this. Take a look at CAHostTimebase.h,  & cpp in Core Audio/Public Utilities.

Others on this list can probably be more helpful.

regards,

Robert Carroll
RSM Records
Toronto
http://www.rsmrecords.com



On Jan 6, 2014, at 3:00 PM, email@hidden wrote:

Hi,

I am confused about how to extract current audio data timestamp from audioTimeStamp struct.

I want the current audio data buffer’s data timestamps handed to me from core audio input unit through callback function.

the audioTimeStamp struct include following:

 mHostTime
                       The host machine's time base, mach_absolute_time.

what is the “base”?

How do I use this to get the audio sample timestamp in mach_absolute_time?


Thanks for the help.


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >understanding AudioTimeStamp (From: Robert Carroll <email@hidden>)

  • Prev by Date: audiograph 5ms fade
  • Next by Date: Using AudioQueues with AudioConverterFillComplexBuffer....
  • Previous by thread: understanding AudioTimeStamp
  • Next by thread: audiograph 5ms fade
  • Index(es):
    • Date
    • Thread