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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:48:11+00:00 2026-06-08T09:48:11+00:00

I’ve been working on this task for 12 days and i cant find any

  • 0

I’ve been working on this task for 12 days and i cant find any solution pleaaaaase help

i’m supposed to load about 80 m4a files and play some of them with augraph which contains mixer and remoteIO units thats how i load the files

OSStatus result;
for (int i = 0; i < [filePaths count]; i++) {
    NSMutableArray *linearr=[[NSMutableArray alloc] init];
    for (int j = 0; j < [[filePaths objectAtIndex:i] count]; j++) {
        NSString *str=[[filePaths objectAtIndex:i] objectAtIndex:j];

        CFURLRef audioFileURL = CFURLCreateFromFileSystemRepresentation (NULL, (const UInt8 *)[str cStringUsingEncoding:[NSString defaultCStringEncoding]] , strlen([str cStringUsingEncoding:[NSString defaultCStringEncoding]]), false);
        ExtAudioFileRef audiofile;
        ExtAudioFileOpenURL(audioFileURL, &audiofile);
        assert(audiofile);
        OSStatus err;
        AudioStreamBasicDescription fileFormat;
        UInt32 size = sizeof(fileFormat);
        err = ExtAudioFileGetProperty(audiofile, kExtAudioFileProperty_FileDataFormat, &size, &fileFormat);

        AudioFileID aFile;
        //size = sizeof(aFile);
        PropertySize =sizeof(PacketsToRead);
        err = ExtAudioFileGetProperty(audiofile, kExtAudioFileProperty_AudioFile, &PropertySize, &aFile);
        AudioFileTypeID fileType;
        PropertySize = sizeof(fileType);
        err = AudioFileGetProperty(aFile, kAudioFilePropertyFileFormat, &PropertySize, &fileType);
        AudioStreamBasicDescription clientFormat;
        bzero(&clientFormat, sizeof(clientFormat));
        clientFormat.mChannelsPerFrame = 2;
        clientFormat.mBytesPerFrame = 4;
        clientFormat.mBytesPerPacket = clientFormat.mBytesPerFrame;
        clientFormat.mFramesPerPacket = 1;
        clientFormat.mBitsPerChannel = 32;
        clientFormat.mFormatID = kAudioFormatLinearPCM;
        clientFormat.mSampleRate = 44100.00;
        clientFormat.mFormatFlags =kLinearPCMFormatFlagIsSignedInteger | kAudioFormatFlagIsNonInterleaved; //kLinearPCMFormatFlagIsFloat | kAudioFormatFlagIsNonInterleaved;

        err = ExtAudioFileSetProperty(audiofile, kExtAudioFileProperty_ClientDataFormat, sizeof(clientFormat), &clientFormat);

        SInt64 numFrames = 0;
        PropertySize = sizeof(numFrames);
        err = ExtAudioFileGetProperty(audiofile, kExtAudioFileProperty_FileLengthFrames, &PropertySize, &numFrames);
        NSNumber *pc = [NSNumber numberWithLongLong:numFrames];
        [[packetCount objectAtIndex:i] replaceObjectAtIndex:j withObject:pc];
        // create the buffers for reading in data
        bufferList = malloc(sizeof(AudioBufferList) + sizeof(AudioBuffer) * (clientFormat.mChannelsPerFrame - 1));
        bufferList->mNumberBuffers = clientFormat.mChannelsPerFrame;
        for (int ii=0; ii < bufferList->mNumberBuffers; ++ii) {
            bufferList->mBuffers[ii].mDataByteSize = sizeof(float) * numFrames;
            bufferList->mBuffers[ii].mNumberChannels = 2;
            bufferList->mBuffers[ii].mData = malloc(bufferList->mBuffers[ii].mDataByteSize);
        }

        UInt32 rFrames = 0;
        rFrames =(UInt32)numFrames;
        err = ExtAudioFileRead(audiofile, &rFrames, bufferList);
        [linearr addObject:[NSData dataWithBytes:bufferList->mBuffers[1].mData length:numFrames]];
        err = ExtAudioFileDispose(audiofile);

}
    [audioData addObject:linearr];
}

and that’s how i play it:

UInt32 *buslist;
buslist=( UInt32*)[[[audioData objectAtIndex:0] objectAtIndex:4]bytes ];

in rendercallback func:

for (int i = 0 ; i < ioData->mNumberBuffers; i++){
     UInt32 *au3=au->mBuffers[0].mData;
     AudioBuffer buffer = ioData->mBuffers[i];
     UInt32 *frameBuffer = buffer.mData;
     for (int j = 0; j < inNumberFrames; j++)
     {
         frameBuffer[j] = buflist[counter];
         if(counter>=529200)
             counter=0;
         else
             counter++;
     }}}

Now when i play the sound i get the first part played with double speed then the second part only distortion.

  • 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-08T09:48:13+00:00Added an answer on June 8, 2026 at 9:48 am

    I was having the exact same problem I think;

    The incoming sound was at a lower sample rate, so the array I allocated wasn’t big enough for the higher sample rate of the auGraph, and was too fast and short.

    make sure you allocate an array to read the file something like this:

    sarray->frames = totalFramesInFile * graphSampleRate / fileAudioFormat.mSampleRate;

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Seemingly simple, but I cannot find anything relevant on the web. What is the

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.