Reputation: 1654
I'm building a small game prototype, and I'd like to be able to play simple sounds whose length/tone/pitch will vary based on what the user is doing.
This is surprisingly hard to do. Closest resource I found was:
http://www.tmroyal.com/playing-sounds-in-swift-audioengine.html
But this does not actually generate any sound on my device or on the iOS simulator.
Does anyone know of any working code to play ANY procedurally generated audio? Simple Sine Wave would do.
Upvotes: 7
Views: 8088
Reputation: 1229
You can try AudioKit.
It's an audio framework built on top of Core Audio
.
In their Continuous Control example they use a simple FM oscillator with controlled parameters.
Upvotes: 9
Reputation: 1654
https://gist.github.com/rgcottrell/5b876d9c5eea4c9e411c
This code on the other hand works, and it's beautifully written...
Success!
Upvotes: 15