Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Playing notes or simple sounds on iOS?

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?

like image 494
Kristina Brooks Avatar asked May 29 '26 13:05

Kristina Brooks


2 Answers

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.

like image 94
hotpaw2 Avatar answered Jun 01 '26 02:06

hotpaw2


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

like image 45
P i Avatar answered Jun 01 '26 03:06

P i



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!