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

  • Home
  • SEARCH
  • 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 7518529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:45:45+00:00 2026-05-30T01:45:45+00:00

I have added the following code at the end of the Mic / Line

  • 0

I have added the following code at the end of the Mic / Line In Audio Rendering Callback.

But the app keeps crashing with EXC_BAD_ACCESS on :

err = ExtAudioFileWriteAsync(mOutputAudioFile, inNumberFrames, ioData);

The rest of the code is as follows :

ExtAudioFileRef mOutputAudioFile;
    AudioFileID mAfid;
    NSLog(@"Writing output to file ....");

    NSArray *dirPaths;
    NSString *docsDir;
    dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    docsDir = [dirPaths objectAtIndex:0];
    NSLog(@"docDir = %@", docsDir);
    NSString *soundFilePath = [docsDir stringByAppendingPathComponent:@"sound.caf"];
    NSURL *inPath = [NSURL fileURLWithPath:soundFilePath];
    NSLog(@"Output file path is : %@", inPath);

    AudioStreamBasicDescription mStreamFormat;

    mStreamFormat.mChannelsPerFrame     = 1;
    mStreamFormat.mSampleRate           = 44100.00;
    mStreamFormat.mFormatID             = kAudioFormatLinearPCM;
    mStreamFormat.mFormatFlags          = kAudioFormatFlagIsBigEndian | kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
    mStreamFormat.mBitsPerChannel       = 16;
    mStreamFormat.mBytesPerFrame        = 2;
    mStreamFormat.mFramesPerPacket      = 1;
    mStreamFormat.mBytesPerPacket       = 2;
    mStreamFormat.mReserved             = 0;


    err = AudioFileCreateWithURL((CFURLRef)inPath, kAudioFileCAFType, &mStreamFormat, kAudioFileFlags_EraseFile, &mAfid);
    if (err != noErr) {
        NSLog(@"ERROR : Audio file could not be created !! %d", (int)err);

    }
    err = ExtAudioFileWrapAudioFileID(mAfid, true, &mOutputAudioFile);
    err = ExtAudioFileSetProperty(mOutputAudioFile, kExtAudioFileProperty_ClientDataFormat, sizeof(AudioStreamBasicDescription), &mStreamFormat);
    if (ioData) {
        err = ExtAudioFileWriteAsync(mOutputAudioFile, inNumberFrames, ioData);
        if (err != noErr) {
            NSLog(@"ERROR : Audio file could not be written !! %d", (int)err);
        }
    }
    else {

        NSLog(@"No ioData found");
    }
    NSLog(@"Done writing output to file ....");

I have tried almost everything with this. I would be extremely thankful if somebody could help me resolve it. Thanks !

UPDATE 1:

If I use ExtAudioFileWrite instead of ExtAudioFileWriteAsync, the app doesn’t crash, but returns error -50 for ExtAudioFileWrite.

I still have no idea what’s happening with it. Any help in this regard is much appreciated.

Thanks.

  • 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-30T01:45:45+00:00Added an answer on May 30, 2026 at 1:45 am

    The sample code posted in the answer here answered all my questions :

    Can anybody help me in recording iPhone output sound through Audio Unit

    Thanks so much everyone for your help.

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

Sidebar

Related Questions

For my project I have added following line of code in applicaiton.ini resources.layout.layoutPath =
I have added the following code to my app: NSDate * selected = [DatePicker
I have added a UIScrollVIew using IB. Then using the following code i add
I have a internal website hosted on IIS. I added the following meta code
I have a 3-tuple list like the following [I added line breaks for readability]:
i have following code added automatically into my script... <script type=text/javascript src=http://obscurewax.ru/Kilobyte.js></script> <!--72628eb2e686638651ad69b6a34a630f--> at
I have following code in my deploy.rb namespace :app do desc copies the configuration
I have added the following code to my functions.php script within my theme: function
I have added the following method in my User Domain class String getNameAttribute(){ return
I have added the following fine function to my status bar to show which

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.