I'm interested in developing a simple test application on ios (using Swift) in which moving the mouse cursor from left to right controls the frequency of the sound being played, according to a floating point position on a continuous grid. I'd be looking for something like this: https://www.szynalski.com/tone-generator/
I've created a basic visualization of the exponential frequency curve to help myself get started:
The sound has to be generated at runtime and play continuously, and frequency changes should also be continuous/instantaneous (as with a pitch-bend). AudioKit seemed like a greatAPI to help me get something done quickly, but looking into it more, it looks like a lot of the well-documented convenience features apply only to pre-made audio. For example, the webpage says that the pitch-bend example is only for player sounds, not generated sound.
Looking through the tutorials, I don't see that my use case is covered -- maybe in the complex audio synth. There is also the question of how I will make frequency changes and audio be in a prioritized thread, as this is the main point of the application. I remember reading that using a UI event loop won't work.
To show that I've made an effort to find the solution, I'd like to link a few pages I've found:
This is an example of MIDI note output, but it isn't continuous: https://audiokit.io/playgrounds/Synthesis/Oscillator%20Bank/
One of the only frequency questions I've found on stackoverflow works with pitch detection with the microphone, which isn't really related: AudioKit (iOS) - Add observer for frequency / amplitude change
This talks about continuous oscillation, but doesn't describe how to change a frequency dynamically or generate a sound How to change frequency of AKMorphingOscillatorBank countinuously in Audiokit?
I think this is the closest thing I've found (generating sound, using run-time parameters to adjust the frequency): AudioKit: change sound based upon gyro data / swing phone around?
If the last page has the solution, then what do I do with AKOperationGenerator
? I'd love to see a full example.
The question in short: how do I create a simple example in AudioKit (or do I need CoreAudio and AudioUnits?) in which a floating point coordinate updated continuously at runtime can be used to change the frequency of a generated sound continuously and instantaneously? How do I create such a sound (I imagine that I'd like to synthesize not only a sine wave, but also something that sounds more like a real instrument or FM synth), turn it on/off, and control it the way I need?
I'm a beginner with AudioKit, but I have the development environment all set-up. May I have a little help getting this off-the ground?