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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:47:54+00:00 2026-05-25T12:47:54+00:00

I use Audio Queue Services in my application. When allocating the buffer, I set

  • 0

I use Audio Queue Services in my application. When allocating the buffer, I set the buffer size to 30000 samples:

AudioQueueAllocateBuffer(mQueue, 30000, &mBuffers[i]);

But the subsequent calls of the callback are made with the following inNumberPacketDescriptions:

30000
30000
30000
26928
30000
30000

They aren’t always equal to 30000. Why?

Record format configuration (using CAStreamBasicDescription):

mRecordFormat.mSampleRate = kSampleRate;    
mRecordFormat.mChannelsPerFrame = 1;
mRecordFormat.mFormatID = kAudioFormatLinearPCM;
mRecordFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
mRecordFormat.mBitsPerChannel = 16;
mRecordFormat.mBytesPerPacket = mRecordFormat.mBytesPerFrame = (mRecordFormat.mBitsPerChannel / 8) * mRecordFormat.mChannelsPerFrame;
mRecordFormat.mFramesPerPacket = 1;

3 buffers are used.

  • 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-25T12:47:55+00:00Added an answer on May 25, 2026 at 12:47 pm

    Edit: I’ve seen iOS freak out and spontaneously change buffer sizes when presented with a non-power-of-two audio buffer. (Another SO question references this) Anyway,

    30000 is

    (a) a HUGE buffer size, and

    (b) a weird number to use for a buffer. Usually they’re in powers of 2— i.e. *=2 from 64, i.e. 64, 128, 256, 512, 1024, 2048, 4096. I’ve never seen one higher than 4096, and I do a lot of audio work.

    If you have a specialized reason to use unusually-large buffers, you could use a nextPowerOfTwo convenience function or just hard-code the math yourself.

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

Sidebar

Related Questions

Can someone explain how we can use Audio Queue services to record sound from
Use case: 3rd party application wants to programatically monitor a text file being generated
Can someone help me use the AudioQueue services on the iPhone to play a
In my project i have to use youtube api and play only audio of
Can any one tell me how to use Silverlight to play audio from local
can u give me advice, which java lib i should use for playing video(H.264)/audio(mp3,
I make a distributed embedded application that will make use of several micro-controllers. The
I'm writing an audio application that has multiple threads producing sound and one thread
Would it be possible to use the audio controls in the multitasking tray for
I try to use tag audio. Convert mp3 to ogg use ffmpeg -i 123.mp3

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.