TAAE2: Playing a sound file multiple times / not looping.

Thanks to the developers for a what so far seems like great audio engine!

I have an application with 91 wav files that need to be played at set times (roughly once a second) repeatedly but not looping. In AEAudioFilePlayerModule when I call playAtTime it can take quite a few ms to finish this call, in fact it often takes over half a second to schedule all 91 players. The part that seems to cause this issue is in schedulePlayRegionFromPosition, which seems to do a bunch of setup for playing - YET isn't required each playback as demonstrated when looping. (Note I am testing on an Ipod touch)

Is there a way to bypass this loading, e.g. by setting 'currentTIme' and 'playing' properties on the object? OR should I be more thinking about creating multiple AEAudioFilePlayerModules, for each wav file?

I am envisioning a similar class which behaves like a sampler, in which scheduling the time to playback is instantaneous with all setup done prior.


  • @jamesalvarez, could you please post a small sample of your proposed implementation? Have you thought about converting your audio into compressed m4a or caf files? That might help with the preloading. Also, will all 91 sounds have the same duration? Will any of the sounds need to overlap and play simultaneously, or will they be sequentially played from an array?

  • Ouch, 91 players! I think maybe AUSampler might be a better candidate - it's one of Apple's audio units, which you'd use through AEAudioUnitModule. Or, take a good look at AudioKit, an alternative and excellent audio engine framework which may better suit your needs.

  • @markjeschke it's a 7 by 13 array of sounds linked to a depth sensor with depth controlling volume. The sounds are less than a second in length and have different lengths, they would triggered once every second but in a particular order over the course of the second. They would definitely overlap. It is a strange project but there is a reason for these things ;) Probably as Michael is suggesting the AEAudioFilePlayerModule class is not the right tool for the job.

    @Michael Thanks for the suggestions, I have been looking at AudioKit too - but will try the AUSampler, as all I really need to do is play the waves at different volumes, with no other processing.

  • @jamesalvarez,

    Will the audio levels of each wav file need to be set dynamically as soon as they're triggered, or already set within the array?

Sign In or Register to comment.