Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8077895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:37:21+00:00 2026-06-05T15:37:21+00:00

I have a 30 second audio file and I would like to get callbacks

  • 0

I have a 30 second audio file and I would like to get callbacks at 12 different points during playback so I can start some animations. For example, at 1.3, 3.2, 4.8, 9.8, 12.3, 15.5, 18.1, 20.4, 22.5, 24.5, 27, and 29 seconds. How would I do this on iOS?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:37:22+00:00Added an answer on June 5, 2026 at 3:37 pm

    There are many, many ways to do this in iOS/Objective-C. I’m assuming you don’t want a callback from the actual audio player guaranteeing the audio has been played. The mechanism you’re using to play the audio may have a callback for when the audio actually starts playing though (to help you sync things better).

    A very common one is

    [self performSelector:@selector(myMethod:) withObject:someArgumentOrNil afterDelay:3.2];
    

    or you can lookup NSTimer to see how to use that,

    or the new fangled Grand Central Dispatch version

    double delayInSeconds = 3.2;
    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
    dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
      NSLog(@"later");
    });
    

    If your using newer OS and multi-core devices, GCD is a good way to go.

    If you’re using an animation package (cocos2d, for example), they often have timing hooks as well.


    Added for expanded question:

    If all the animations are different, then that’s the amount of work you have to do. If they’re all the same (or some are the same), you can have an NSTimer call you every .1 (for example) seconds, then test the actual amount of time passed, when you hit the next threshold you trigger the action. (Things aren’t guaranteed to run on time – if your app is a CPU hog it could be running late.)

    if (currentTime >= thresholdTime) {
      [self doAnim]; 
      thresholdTime = nextOneInLine;
    }
    

    Yes, if it’s going to get more complicated, you likely want to build some classes to handle it. Build an array in time order and treat it like a queue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to know how I can synchronize an mp3 file, a text
I have some Android code to stream an audio file from the internet and
I have both a 20 second audio file and a 60 second video file.
I have a very huge WAV file, about 100MB in size. I would like
I have an audio file. I want to segment into 10 seconds each using
I have a second .nib file that is a localized version of the main
In the following code how can I still have the second and third statement
I have a batch file that installs WinVNC in about 1 second and starts
I'm new to working with video. I would like to put some tiny video
Alright I have two problems. I'm using AVAudioPlayer to play a simple audio file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.