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

I am writing an application needs to use large audio multi-samples, usually around 50
I am writing an application needs to use large audio multi-samples, usually around 50
Can someone explain how we can use Audio Queue services to record sound from
I'd like to use C# to implement an application that can play multiple audio
Currently I am working on the application for which I have to use audio
From my understanding Audio Queue Services are a higher level API than Audio Units,
Can I use a <video> or <audio> tag to play a playlist, and to
I'm just wondering how, and which audio player I should use to allow my
I have certain initializing functions that I use to set up audit logging on
Use case: 3rd party application wants to programatically monitor a text file being generated

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.