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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:48:20+00:00 2026-06-01T23:48:20+00:00

i am trying to capture raw buffer data into an audio file. Like this:

  • 0

i am trying to capture raw buffer data into an audio file. Like this:

dstFormat.mSampleRate = 224000; 
dstFormat.mFormatID = kAudioFormatMPEG4AAC;
dstFormat.mChannelsPerFrame = 1;
dstFormat.mBitsPerChannel = 16;
dstFormat.mBytesPerPacket = dstFormat.mBytesPerFrame = 2 * dstFormat.mChannelsPerFrame;
dstFormat.mFramesPerPacket = 1;
dstFormat.mFormatFlags = kLinearPCMFormatFlagIsPacked | kLinearPCMFormatFlagIsSignedInteger;      
OSStatus result = ExtAudioFileCreateWithURL((CFURLRef) inURL,
                                            kAudioFileM4AType,
                                            &dstFormat,
                                            0,
                                            kAudioFileFlags_EraseFile,
                                            &audioFileRef)

I am hooked into a function with the following parameters:
AudioUnit inUnit, AudioUnitRenderActionFlags * ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inOutputBusNumber, UInt32 inNumberFrames, AudioBufferList * ioData

Inside it I am trying to write the data into file, but a bad parameter -50 error occurs.
result = ExtAudioFileWrite(audioFileRef, inNumberFrames, ioData);

If I replace ioData parameter with my own:

 AudioBufferList *bufferList = (AudioBufferList*) malloc(sizeof(AudioBufferList));
    bufferList->mNumberBuffers = 1;// ioData->mNumberBuffers;
    for(UInt32 i=0;i<bufferList->mNumberBuffers;i++)
    {
        bufferList->mBuffers[i].mNumberChannels = 1; 
        bufferList->mBuffers[i].mDataByteSize = ioData->mBuffers[i].mDataByteSize; //ioData->mBuffers[i].mDataByteSize; // (1024*2) * dstFormat.mBytesPerFrame;
        bufferList->mBuffers[i].mData = ioData->mBuffers[i].mData;
    }

.. i get file around 260MB for the first second. What is wrong here?

  • 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-01T23:48:21+00:00Added an answer on June 1, 2026 at 11:48 pm

    I’m surprised that the iPhone will even create an audio file with those parameters, though I suspect that’s because you have only tested it so far in the simulator and not on hardware. Anyways, your stream format is the problem here.

    If you are capturing raw data, then why set the format ID to m4a, but then set the format flags to use linear PCM? I’m also not sure how you arrived at a sample rate of 224kHz, but it’s going to get you into trouble and at least partially explains why the output file size is so big.

    I’d suggest googling around a bit to see some examples of the stream description structure, as it is a bit complicated. This question might also help you get on the right track:

    CoreAudio – kAudioFileUnsupportedDataFormatError

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

Sidebar

Related Questions

I'm trying to capture audio, using the method in this question ; with AVCaptureSession
I'm trying to capture standard output of a command to a file-like object in
I'm trying to capture the ENTER event of a TextInput like so: a_txt.addEventListener(fl.events.ComponentEvent.ENTER, aEnter);
I am using Python 2.6.5 and I am trying to capture the raw http
I am trying to put some logging to capture the raw http request coming
I'm trying to capture the following pattern everything except data-extra Here is the search
I'm trying to capture a url like the following in an intent: https://example.com/apple/orange?key=value I've
I'm trying to capture some statistics like number of 302's and 200 Oks or
I was wondering whether it is possible to capture audio data from other sources
I'm trying to capture the last digits in this line in a regex group:

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.