I would like to play simple sounds that can be varied at runtime, for example being able to play sounds at different frequencies.
Basically, I would like to be able to produce a simple melody at runtime, and then play it. How do synthesizing apps do that? I'd imagine that there is a way to do it via CoreAudio.
Is there a way to do that using the SDK?
If you know how to create PCM samples of audio waveforms, you can create a waveform for your desired note duration at your desired frequency and volume, and feed that raw waveform data to either the Audio Queue API or the Audio Unit RemoteIO API.
Here's one slightly longer description of how to play a tone using these APIs.
http://atastypixel.com/blog/using-remoteio-audio-unit/
This is a most excellent resource, it will get you up and running with audio units.
This is great too: http://cocoawithlove.com/2010/10/ios-tone-generator-introduction-to.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With