AKPWMOscillator

open class AKPWMOscillator: AKNode, AKToggleable, AKComponent

Pulse-Width Modulating Oscillator

  • Four letter unique description of the node

    Declaration

    Swift

    public static let ComponentDescription = AudioComponentDescription(generator: "pwmo")
  • Ramp Time represents the speed at which parameters are allowed to change

    Declaration

    Swift

    open dynamic var rampTime: Double = AKSettings.rampTime
  • In cycles per second, or Hz.

    Declaration

    Swift

    open dynamic var frequency: Double = 440
  • Output amplitude

    Declaration

    Swift

    open dynamic var amplitude: Double = 1.0
  • Frequency offset in Hz.

    Declaration

    Swift

    open dynamic var detuningOffset: Double = 0
  • Frequency detuning multiplier

    Declaration

    Swift

    open dynamic var detuningMultiplier: Double = 1
  • Duty cycle width (range 0-1).

    Declaration

    Swift

    open dynamic var pulseWidth: Double = 0.5
  • Tells whether the node is processing (ie. started, playing, or active)

    Declaration

    Swift

    open dynamic var isStarted: Bool
  • Initialize the oscillator with defaults

    Declaration

    Swift

    public convenience override init()

    Parameters

    frequency

    In cycles per second, or Hz.

  • Initialize this oscillator node

    • Parameters:
      • frequency: In cycles per second, or Hz.
      • amplitude: Output amplitude
      • pulseWidth: Duty cycle width (range 0-1).
      • detuningOffset: Frequency offset in Hz.
      • detuningMultiplier: Frequency detuning multiplier

    Declaration

    Swift

    public init(
            frequency: Double,
            amplitude: Double = 1.0,
            pulseWidth: Double = 0.5,
            detuningOffset: Double = 0,
            detuningMultiplier: Double = 1)

    Parameters

    frequency

    In cycles per second, or Hz.

    amplitude

    Output amplitude

    pulseWidth

    Duty cycle width (range 0-1).

    detuningOffset

    Frequency offset in Hz.

    detuningMultiplier

    Frequency detuning multiplier

  • Function to start, play, or activate the node, all do the same thing

    Declaration

    Swift

    open func start()
  • Function to stop or bypass the node, both are equivalent

    Declaration

    Swift

    open func stop()