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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:46:49+00:00 2026-06-15T16:46:49+00:00

I am developing an iPad application that uses the AUSampler AudioUnit, in conjunction with

  • 0

I am developing an iPad application that uses the AUSampler AudioUnit, in conjunction with other AudioUnits, to play audio. The AUSampler loads a preset from a SoundFont2 file.

When too many notes are played at once or notes are played too quickly, the audio starts dropping out briefly before dropping out completely. The sampler is then unusable until the preset is reloaded from the SoundFont. This only happens with some instruments (specifically presets 88, 90, and 94, which in General MIDI are Pad 1 (new age), Pad 3 (polysynth), and Pad 7 (halo), respectively)

By turning on the All Exceptions breakpoint in XCode, I can see that the issue occurs when AudioToolbox attempts to create a new VoiceZone for the note being played. However, this exception is caught somewhere lower in the call stack below my code, and AudioUnitRender doesn’t return any error.

My best guess is that the “pad” instruments use longer samples, and so playing many notes quickly/in conjunction uses more memory than available for AudioToolbox.

Has anyone encountered this issue before, and if so, is there a way to avoid the audio drop-outs, or to at least detect them so as to gracefully handle them?

Some details:

  • The SoundFont is ~150 MB and contains many different presets/instruments that conform to General MIDI
  • the AUSampler is at the head of a chain of effect units, which connect into a AUMultiChannelMixer (me.masterMixerUnit). The audioOutputCallback is set as the input callback of the output element of the RemoteIO unit

Backtrace (on the `AURemoteIO::IOThread):

* thread #14: tid = 0x3203, 0x368c8498 libc++abi.dylib`__cxa_throw, stop reason = breakpoint 1.2
frame #0: 0x368c8498 libc++abi.dylib`__cxa_throw
frame #1: 0x35d46a60 AudioToolbox`VoiceZone::operator new(unsigned long) + 340
frame #2: 0x35d46b6a AudioToolbox`VoiceZone::NewVoiceZone(SamplerNote*, ZoneState*, float, float, unsigned long) + 86
frame #3: 0x35d3f846 AudioToolbox`SamplerNote::Configure(InstrumentState*) + 1106
frame #4: 0x35d3ff2c AudioToolbox`non-virtual thunk to SamplerNote::Attack(MusicDeviceNoteParams const&) + 24
frame #5: 0x35d551ea AudioToolbox`SynthNote::AttackNote(SynthPartElement*, SynthGroupElement*, unsigned long, unsigned long long, unsigned long, MusicDeviceNoteParams const&) + 58
frame #6: 0x35d5485a AudioToolbox`SynthGroupElement::NoteOn(SynthNote*, SynthPartElement*, unsigned long, unsigned long, MusicDeviceNoteParams const&) + 70
frame #7: 0x35d3d220 AudioToolbox`SamplerElement::StartNote(SynthPartElement*, unsigned long, unsigned long, MusicDeviceNoteParams const&) + 344
frame #8: 0x35d3c4fa AudioToolbox`Sampler::RealTimeStartNote(SynthGroupElement*, unsigned long, unsigned long, MusicDeviceNoteParams const&) + 94
frame #9: 0x35d530a0 AudioToolbox`AUInstrumentBase::PerformEvents(AudioTimeStamp const&) + 164
frame #10: 0x35d5313c AudioToolbox`AUInstrumentBase::Render(unsigned long&, AudioTimeStamp const&, unsigned long) + 20
frame #11: 0x35d3c564 AudioToolbox`Sampler::Render(unsigned long&, AudioTimeStamp const&, unsigned long) + 68
frame #12: 0x35c2435a AudioToolbox`AUBase::DoRenderBus(unsigned long&, AudioTimeStamp const&, unsigned long, AUOutputElement*, unsigned long, AudioBufferList&) + 210
frame #13: 0x35c24184 AudioToolbox`AUBase::DoRender(unsigned long&, AudioTimeStamp const&, unsigned long, unsigned long, AudioBufferList&) + 496
frame #14: 0x35c23f8a AudioToolbox`AUMethodRender(void*, unsigned long*, AudioTimeStamp const*, unsigned long, unsigned long, AudioBufferList*) + 50

... render methods of other AudioUnits in chain ...

frame #32: 0x00081aaa SoundBrush 2`audioOutputCallback + 194 at SoundEngine.mm:1375

The exception is being thrown during the call to AudioUnitRender in my callback below:

static OSStatus audioOutputCallback(void                       *inRefCon,
                                    AudioUnitRenderActionFlags *ioActionFlags,
                                    const AudioTimeStamp       *inTimeStamp,
                                    UInt32                      inBusNumber,
                                    UInt32                      inNumberFrames,
                                    AudioBufferList            *ioData)
{
    //get a reference to the SoundEngine
    SoundEngine *me = (__bridge SoundEngine *)inRefCon;

    // render the sound
    OSStatus err = AudioUnitRender(me.masterMixerUnit,
                                   ioActionFlags,
                                   inTimeStamp,
                                   kAudioUnitBus_Output,
                                   inNumberFrames,
                                   ioData);
    if (err != noErr) NSLog(@"AudioUnitRender failed [%ld]", err);

    // ... do some processing ...

    return err;
}
  • 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-15T16:46:50+00:00Added an answer on June 15, 2026 at 4:46 pm

    If the sound quality is good under normal conditions, I would guess that the dropouts are not caused by a programming error in your AU chain, but rather from the OS not being able to process the block fast enough.

    The easiest way to detect audio dropouts is to get the system time in microseconds before you start processing, and then measure it again after you have completed. By looking at the sample rate and buffer size, you should be able to determine if you were able to deliver the samples in the given amount of time.

    If you find that you are indeed having dropouts caused by performance, the first thing you should do is to increase the buffer size. Following that, you should try to optimize your code in a few basic ways. Run the algorithm through Instruments (the profiler, that is) and look for any obvious bottlenecks. Avoid object allocation inside of the render callback; this will cause extra strain on the system.

    Also I would suggest running the processing code on a desktop computer just to make sure that the issue is indeed caused by the iPad’s performance.

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

Sidebar

Related Questions

I have a PhoneGap application I am developing for iPad that uses video extensively,
I've been developing an iPad application that uses UIWebView to display some text and
I'm currently developing an iOS application (iPad and iPhone) that uses OpenGL ES 1.0
I'm developing an iPad application that has a navigation menu similar to a web
I'm developing an iPad application. I have been provided with a PNG image that
I'm currently developing an iPad application that integrates MapKit. But I have a small
Hi I am developing an iPad app that application needs to take screenshots automatically
In an iPad application I'm developing, I want to show a UITableView that does
I am currently developing an iPad application that has a Pause button. The entire
I'm developing one application in IPad.In that application i want to add 2 buttons

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.