tags:

views:

21

answers:

2

Hi,

I'm using AudioServices to play a sound in my app:

AudioServicesCreateSystemSoundID (soundFileURLRef,&soundFileObject );

and then

AudioServicesPlaySystemSound (soundFileObject);

The sound plays but because I need to play it frequently (its 0.24 seconds long) I get a strange unnatural sounding repetition.

You can hear it at http://testing.lukem.co.uk/Simulator/Simulator.html

The other noise is me adjusting the volume - oops.

Thanks!

A: 

If you want the most precise control over timing of a sound's repetition, use Audio Queues or Audio Unit RemoteIO, and count samples between where you start filling the callback buffers with your sound's raw/PCM sample array.

hotpaw2
Here's a link to some RemoteIO sample code: http://sites.google.com/site/iphonecoreaudiodevelopment/remoteio-playback
morgancodes
That seems like serious overkill. Will a system sound play to completion if it is triggered again before it finishes? Would AVPlayer perform any differently?
codecowboy
A: 

I went with open source openAL library Finch.

codecowboy