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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:05:40+00:00 2026-05-25T15:05:40+00:00

I am using AVAssetReader to read ipod library asset audio data and render a

  • 0

I am using AVAssetReader to read ipod library asset audio data and render a waveform image. this takes place using code I have described in my answer to this question

this sometimes takes place while audio is being played by an instance of AVAudioPlayer.

regardless of wether the audio being played is the same asset that is being read, the moment i hit

[reader startReading];

the audio being played “fades out”. (as if the AVAudioPlayer has somehow been told to stop playback). This is odd, as I am not actually playing the audio, just reading it.

I did a search on SO and found this possible solution however i have found that this does not appear to solve the problem.

note – I am able to have several instances of AVAudioPlayer playing, and starting these do not seem to interfere with each other – however

[reader startReading];

will even kill multiple simultaneous instances of AVAudioPlayer, causing them all to synchronously fade out.

any ideas?

  • 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-05-25T15:05:41+00:00Added an answer on May 25, 2026 at 3:05 pm

    answering my own question….

    further searching on SO led me to implementing this alternate solution:

    - (void)setupAudio {
        [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: nil];
        UInt32 doSetProperty = 1;
        AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryMixWithOthers, sizeof(doSetProperty), &doSetProperty);
        [[AVAudioSession sharedInstance] setActive: YES error: nil];
    }
    

    this was gleaned from here

    **EDIT **UPDATED****

    I have since made this into a class that also pre-initialises the audio queue (useful in both simulator and device as it eliminates the startup lag from the playback of the first audio file.

    you can find the point1sec.mp3 here: http://www.xamuel.com/blank-mp3s/

    #import <AVFoundation/AVFoundation.h>
    #import "AudioToolbox/AudioServices.h"
    
    @interface sw_AVAudioPlayerSetup : NSObject
     <AVAudioPlayerDelegate> {
    
    }
    
    + (void)setupAudio ;
    + (void)setupSharedSession ;
    
    @end
    @implementation sw_AVAudioPlayerSetup
    
    + (void)setupSharedSession {
    
        static BOOL audioSessionSetup = NO;
        if (audioSessionSetup) {
            return;   
        }
        [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: nil];
        UInt32 doSetProperty = 1;
    
        AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryMixWithOthers, sizeof(doSetProperty), &doSetProperty);
    
        [[AVAudioSession sharedInstance] setActive: YES error: nil];
    
        audioSessionSetup = YES;
    
    }
    
    + (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag{
        // delegate callback to release player
        [player release];
    }
    
    + (void)setupAudio {
    
        [self setupSharedSession];
    
        NSString *filepath = [[NSBundle mainBundle]                                                                                                  
                              pathForResource:@"point1sec"                                                                                                 
                              ofType:@"mp3"];
    
        if ([[NSFileManager defaultManager] fileExistsAtPath:filepath]) {
    
            AVAudioPlayer* player = [[AVAudioPlayer alloc] 
                                     initWithContentsOfURL:
                                     [NSURL fileURLWithPath:filepath] 
                                     error:nil];
    
            player.delegate = (id <AVAudioPlayerDelegate>) self;
    
            [player play];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.