• 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: Calculating precise time in audio apps
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calculating precise time in audio apps


  • Subject: Re: Calculating precise time in audio apps
  • From: Pier <email@hidden>
  • Date: Tue, 06 Nov 2012 10:15:11 +0800

Hi TJ, 

That's similar to what I did, I think it serves my purposes - thank you!

Pier. 


On Mon, Nov 5, 2012 at 8:08 PM, T.J. Usiyan <email@hidden> wrote:
Hello,
I think mach_absolute_time() is going to be your best bet. You will
have to convert from host ticks to seconds/samples.


This is how I did that before (I am somewhat new to all of this, so
maybe I am doing it incorrectly.)

`    kern_return_t lError;

    mach_timebase_info_data_t lTimeInfo;



    lError = mach_timebase_info(&lTimeInfo);

    if (lError != KERN_SUCCESS) {

        NSLog(@"Error getting mach_timebase_info");

        return;

    }



    mHostToNanoseconds = (double)lTimeInfo.numer / lTimeInfo.denom;

    mNanoToHostTicks = (double)lTimeInfo.denom / lTimeInfo.numer;



    NSLog(@"mToNanoseconds %f", mHostToNanoseconds);

    NSLog(@"mToHostTicks %f", mNanoToHostTicks

`


On Sun, Nov 4, 2012 at 10:37 PM, Pier <email@hidden> wrote:
>
> Hi all,
>
> I'm doing an audio app where I need to manipulate audio buffers in real time for different sounds. I need a asynchronous clock running in the background that i can pull the time in various callbacks good to the millisecond for various audio manipulation purposes like the stop and start times of my audio playback, and when it records and stops recording.
>
> I need it to be so such that the precision allows me to determine latency caused by the various processes and compensate for it in my code.
>
> Any suggestions how one would implement such a clock in iOS? I have a feeling NSTimer won't cut it.
>
> Thank you.
>
> Pier.
>
>
>  _______________________________________________
> 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
>

 _______________________________________________
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: 
 >Calculating precise time in audio apps (From: Pier <email@hidden>)
 >Re: Calculating precise time in audio apps (From: "T.J. Usiyan" <email@hidden>)

  • Prev by Date: Re: GarageBand mouse clicks dragging our entire windows!
  • Next by Date: RemoteIO Question
  • Previous by thread: Re: Calculating precise time in audio apps
  • Next by thread: libPD AudioUnit in AUGraph
  • Index(es):
    • Date
    • Thread