Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

neil.b

macrumors member
Original poster
Nov 20, 2008
65
0
I've been playing around with the AudioQueue stuff for a few days and it's all working fine.
I was trying to build a low-latency playback system by making the streaming buffers the same size as the audio file and pre-loading the buffers (which works fine) but I've hit a snag.

I've been trying to get the streaming to work at different sample rates so that I can play back the same sample at different pitches. I managed to do it by modifying the sample rate in the AudioStreamBasicDescription structure but in order to actually make the stream playback at the new rate it seems you have to create a new output, reload the audio file into the buffers and re-enqueue the output queue before starting playback again, otherwise the sample rate change has no effect.

There is a method to set queue properties; AudoQueueSetProperty() but unfortunately the sample rate Property (kAudioQueueDeviceProperty_SampleRate) is read-only :(

Can anyone suggest a way to achieve this with AudioQueue or do I need to move over to OpenAL?

Thanks,

Neil
 

firewood

macrumors G3
Jul 29, 2003
8,106
1,343
Silicon Valley
Over the top? Not at all. The ARM CPU in the iPhone can easily create and mix many channels of multi-rate synthesized and DSP filtered audio. Why do you think they added all those MAC and VFP instructions?

.
 

neil.b

macrumors member
Original poster
Nov 20, 2008
65
0
OK, what I should've said is "A bit over the top to have to learn about and write DSP code, considering I just want to play an audio file at different pitches".

:)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.