4

When I want to build an Oscillator with AudioKit there are different ways to go. For example you can create an AKOperation within an AKOperationGenerator like

var osc = AKOperationGenerator { parameters in
       returnAKOperation.sawtoothWave(frequency: GeneratorSource.frequency)
)

but you could also create one with

var oscillator = AKOscillator(waveform: AKTable(.sawtooth))

What's the difference and when to choose what? Thnx!

headkit
  • 3,307
  • 4
  • 53
  • 99

1 Answers1

5

If you just want one oscillator, it makes sense just to use the AKOscillator node, but if you want to do more than one thing dynamically, operations get you a lot flexibility. For instance, in your operation you can create two operation oscillators - one to oscillator the frequency and a low rate (LFO) and the other to actually oscillate the audio rate signal. There a few playgrounds that highlight when to use operations like this one:

http://audiokit.io/playgrounds/Synthesis/FM%20Oscillator%20Operation/

and the others listed in the Operations section of

http://audiokit.io/playgrounds/Synthesis/

Aurelius Prochazka
  • 4,510
  • 2
  • 11
  • 34
  • 1
    cool. the I went the right way. and can you tell me the best point to start if I want to add f.e. a triangleWave-Table to the .morphingOscillator Operation by myself? Or if I want ot make an .squareWave() Operation FM-able or add new functionality like syncable oscillators? (this might all be new own questions though) – headkit Mar 17 '18 at 16:32
  • 1
    Ah - and is it correct that for best performance I better put all calculations into one OperationGenerator? If so, 14 parameters seem to me not enough - how could I expand the number of parameters? – headkit Mar 17 '18 at 20:41