An App I'm working on is kinda like an appear-as-you-touch piano.

Using AudioKit and the gesture recognizing I have my app set up to:

  • make a new button appear when the user touches the screen

(Essentially, I have my ViewController.swift which makes new CircularKeys every time the user taps.)

  • turn on an oscillator and get it going in the ViewController via a UIButton

Now I'm trying to get some more dynamic functionality: I want to start an oscillator for each new key that exists on the screen, and I'm wondering how I can keep track of them. AudioKit wants to know all the outputs before it will feed them out with AudioKit.start() and I am thinking about using NSMutableSet to keep track of the oscillators.

Basically: I want to couple together Oscillators and CircularKeys. What are some design strategies that play nice with iOS philosophy?

1 Answer 1


What you probably want to do is use an AKPolyphonicInstrument. This will allow you to play as many simultaneous notes as you like* using the same oscillator type.

If you need separate oscillator types for each note, then you will have to decide how many oscillators you want to set up ahead of time, and limit the number of notes played simultaneously to the number of oscillators you have running.

*Note that most polyphonic instruments actually have some limit on the number of notes that can play simultaneously.

  • thanks for your input, do you know of any good tutorials or explanations that show how the AK nodes and stuff link together? I'm not sure how I'd tie a bunch of frequencies into one AKPolyphonicInstr.
    – sova
    Apr 19, 2016 at 0:38
  • All of the good stuff appears to be on audiokit.io -- Check out the Playgrounds. Apr 19, 2016 at 1:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.