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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:57:34+00:00 2026-05-25T23:57:34+00:00

I’m having a problem playing back audio data after appending extra recording to it.

  • 0

I’m having a problem playing back audio data after appending extra recording to it. Here’s the general sequence of events, which don’t return any errors:

AudioQueueNewInput       // Start audio queue
AudioFileCreateWithURL   // Create audio file
AudioFileSetProperty     // Set magic cookie

AudioQueueAllocateBuffer // Allocate buffers
AudioQueueEnqueueBuffer  // Prime buffer
AudioQueueStart          // Start the audio queue

// Record some audio in the audio queue callback...
AudioQueueWritePackets
AudioQueueEnqueueBuffer

AudioQueueStop           // Stop the queue
AudioQueueFlush          // Flush remaining buffers in the queue
AudioFileSetProperty     // Set magic cookie again (needed for some formats?)
AudioQueueDispose        // Dispose queue
AudioFileClose           // Close the file

I can start and stop the queue to append recording and it works great. The audio appends perfectly and I can play back as I expect. The problem comes when I re-open the file, and try to append:

AudioQueueNewInput       // Start audio queue
AudioFileOpenURL         // Re-open audio file
AudioFileGetProperty     // Get packet count and resume recording at last packet
AudioFileOptimize        // "Optimize" the file for appending
AudioFileSetProperty     // Set magic cookie

AudioQueueAllocateBuffer // Allocate buffers
AudioQueueEnqueueBuffer  // Prime buffer
AudioQueueStart          // Start the audio queue

// Record some audio in the audio queue callback...
AudioQueueWritePackets
AudioQueueEnqueueBuffer

AudioQueueStop           // Stop the queue
AudioQueueFlush          // Flush remaining buffers in the queue

I take care to resume recording from the last packet of audio, and indeed, data is being appended to the file because I can see the file size grow. However, when I play back the file, I do not hear the appended audio. It plays back the original audio, but stops before I expect to hear the additional audio.

I’ve tried different combinations moving around AudioFileOptimize and resetting the magic cookie to no avail.

The audio format I’m using is as follows:

static const AudioStreamBasicDescription kMyAudioFormat = {
    .mFormatID = kAudioFormatAppleIMA4,
    .mSampleRate = 44100.0,
    .mChannelsPerFrame = 2,
    .mBitsPerChannel = 0,
    .mBytesPerPacket = 68,
    .mBytesPerFrame = 0,
    .mFramesPerPacket = 64,
    .mFormatFlags = 0
};

What is going on here? Why won’t the appended audio play back after I re-open the AudioFileID?

  • 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-25T23:57:35+00:00Added an answer on May 25, 2026 at 11:57 pm

    Needed to call AudioFileClose. For more info see: http://lists.apple.com/archives/Coreaudio-api/2011/Oct/msg00014.html

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am currently running into a problem where an element is coming back from
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want to construct a data frame in an Rcpp function, but when I
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have some data like this: 1 2 3 4 5 9 2 6

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.