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 8504439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:01:54+00:00 2026-06-11T02:01:54+00:00

I have a program with about 2000 short mp3 files. I am now storing

  • 0

I have a program with about 2000 short mp3 files. I am now storing all those file into folder Supporting Files and when I want to play I call this function:

-(void)playSound:(NSString *)mySoundFileName{
    NSString *filePath = [[NSBundle mainBundle] pathForResource:mySoundFileName ofType:@"mp3"];  
    if ([NSData dataWithContentsOfFile:filePath]) {  
        url = [NSURL fileURLWithPath:filePath];
        audioPlayer = [[AVAudioPlayer alloc]
                           initWithContentsOfURL:url
                           error:nil];
        [audioPlayer play];  
    } 
}

However, the first time I play the sound, it always takes long time to search/load the file. More specifically, after pressing “play sound” button to play sound, I have to wait for at least 5 seconds until it plays. It is OK to play other sound after that, i.e, it play almost immediately when I press “play sound” button. Do you have any suggestion to store and play those many files more efficiently? Thank you very much

  • 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-11T02:01:56+00:00Added an answer on June 11, 2026 at 2:01 am

    It can sometimes take an undesirable amount of time for AVAudioPlayer to start playing initially. A good way to solve this is to make the initial alloc/init before you call play. This way the player is ready to play before the user presses the play button. Additionally, calling [player prepareToPlay]; before play will help improve performance slightly.

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

Sidebar

Related Questions

I have a program which saves it result files in a binary file. It
I have a file of about 2000 lines of text that i generate in
I have a text file of about 2000 lines of text wich are formated
I have a program with about 8 Activity classes, and 1 Application class. I
I have a Java program which is using WMIC to get certain information about
I have a C++ program which, during execution, will allocate about 3-8Gb of memory
I have a question about debugging a running C++ program in Linux. If a
Below I have written a sample program that I have written to learn about
I'm creating an about JFrame for my program. I have an icon which I
Everytime the program loads, I need a dictionary to have about 15 values. Right

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.