Back to Audiokit

Migration Guide

Sources/AudioKit/AudioKit.docc/MigrationGuide.md

5.7.264.5 KB
Original Source

Migration Guide

AudioKit 5.4 to 5.5

Some taps were changed to use async/await which bumped the minimum requirement operating system.

AudioKit 5.3 to 5.4

The interface to AppleSampler was update to be more safe.

AudioKit 5.2 to 5.3

AudioKit 5.3 is a Swift-only package, so it should be usable on iPad's Swift Playgrounds app. To allow for this, AudioKitEX has been moved to its own package, so you will likely have to update your package dependencies to also include AudioKitEX.

AudioKit 5.1 to 5.2

This version update involves separating AudioKit into separate Sub-AudioKits which are included as separate Swift Packages. This way, developers do not have to compile code that their apps don't require. Most users will probably have to include the SoundpipeAudioKit package since that is the one that contained many of the oscillators, effects, and filters. In addition to including the packages, developers may also have to update their files to import the correct frameworks.

Also, please note that some types that did not move into a new package still moved into a new module. For example, Sequencer lives in the base AudioKit package, but code that references it will need to import the AudioKitEX module that is included in that package.

Here is a list of types that moved into a new package, and where they live now.

ClassNew Framework
CallbackInstrumentAudioKitEX
FaderAudioKitEX
StereoFieldLimiterAudioKitEX
DynaRageCompressorDevoloopAudioKit
RhinoGuitarProcessorDevoloopAudioKit
FlangerDunneAudioKit
ChorusDunneAudioKit
SamplerDunneAudioKit
StereoDelayDunneAudioKit
SynthDunneAudioKit
TransientShaperDunneAudioKit
DryWetMixerSoundpipeAudioKit
BrownianNoiseSoundpipeAudioKit
DripSoundpipeAudioKit
DynamicOscillatorSoundpipeAudioKit
FMOscillatorSoundpipeAudioKit
MetalBarSoundpipeAudioKit
MorphingOscillatorSoundpipeAudioKit
OscillatorSoundpipeAudioKit
PWMOscillatorSoundpipeAudioKit
PhaseDistortionOscillatorSoundpipeAudioKit
PhaseLockedVocoderSoundpipeAudioKit
PinkNoiseSoundpipeAudioKit
PluckedStringSoundpipeAudioKit
WhiteNoiseSoundpipeAudioKit
VocalTractSoundpipeAudioKit
AmplitudeEnvelopeSoundpipeAudioKit
AutoPannerSoundpipeAudioKit
AutoWahSoundpipeAudioKit
BalancerSoundpipeAudioKit
BandPassButterworthFilterSoundpipeAudioKit
BandRejectButterworthFilterSoundpipeAudioKit
BitCrusherSoundpipeAudioKit
ChowningReverbSoundpipeAudioKit
ClipperSoundpipeAudioKit
CombFilterReverbSoundpipeAudioKit
ConvolutionSoundpipeAudioKit
CostelloReverbSoundpipeAudioKit
DCBlockSoundpipeAudioKit
DynamicRangeCompressorSoundpipeAudioKit
EqualizerFilterSoundpipeAudioKit
FlatFrequencyResponseReverbSoundpipeAudioKit
FormantFilterSoundpipeAudioKit
HighPassButterworthFilterSoundpipeAudioKit
HighShelfParametricEqualizerFilterSoundpipeAudioKit
KorgLowPassFilterSoundpipeAudioKit
LowPassButterworthFilterSoundpipeAudioKit
LowShelfParametricEqualizerFilterSoundpipeAudioKit
ModalResonanceFilterSoundpipeAudioKit
MoogLadderSoundpipeAudioKit
PannerSoundpipeAudioKit
PeakingParametricEqualizerFilterSoundpipeAudioKit
PhaserSoundpipeAudioKit
PitchShifterSoundpipeAudioKit
PitchTapSoundpipeAudioKit
ResonantFilterSoundpipeAudioKit
RolandTB303FilterSoundpipeAudioKit
StringResonatorSoundpipeAudioKit
TanhDistortionSoundpipeAudioKit
ThreePoleLowpassFilterSoundpipeAudioKit
ToneComplementFilterSoundpipeAudioKit
ToneFilterSoundpipeAudioKit
TremoloSoundpipeAudioKit
VariableDelaySoundpipeAudioKit
ZitaReverbSoundpipeAudioKit
OperationEffectSporthAudioKit
OperationGeneratorSporthAudioKit
ClarinetSTKAudioKit
FluteSTKAudioKit
MandolinStringSTKAudioKit
RhodesPianoSTKAudioKit
ShakerSTKAudioKit
TubularBellsSTKAudioKit

AudioKit 5.0 to 5.1

The major change in AudioKit 5.1 is that the Node class was changed to be a Node protocol. The parameters and parameter definition system was cleaned up as well. While these are big changes that warrant the version change, they shouldn't affect most users.

AudioKit 4.x to 5.0

In order to ensure high quality for AudioKit 5, some parts of AudioKit 4 have been removed, so the first step in migrating to AudioKit 5 is to determine whether what you used in AudioKit 4 is still available.

Removed from v5

So, first we'll start out with a list of things that are just not in AudioKit 5 in any form:

  1. AudioKit 5 has an AudioPlayer but doesn't include the AudioKit's 4's other players AKDiskStreamer , AKWaveTable, or AKClipPlayer. Some of these classes had utility and could/should be brought back to AudioKit 5.

  2. The oscillator banks such as AKOscillatorBank have all been removed. They were coded in a way that we have since outgrown. The only polyphonic node left is Synth but we intend on bringing back polyphonic instruments in a well-coded way as soon as possible.

  3. Inter-App Audio support has been removed. Apple has deprecated it and Audiobus now supports Apple's AUv3 format, which should work even better than Inter-App Audio.

  4. AKAudioUnitManager was removed. A project to demonstrate this functionality has been started here.

  5. AKMetronome has been removed. Its easy enough to create a metronome with Sequencer and one track. This will be demonstrated in the Cookbook examples project.

Significantly Changed in v5

The following items have been very significantly changed, even if their names are similar:

  1. AudioKit 4's file managing class AKAudioFile has been removed. We have found Apple's AVAudioFile sufficient for this purpose now. Format conversion is now handled by AudioKit 5's FormatConverter.

  2. AudioKit' 4's audio player AKPlayer and its associated AKDynamicPlayer and AKAbstractPlayer have all been removed. In its place we have AudioPlayer which is simpler.

  3. The following taps have been removed: AKLazyTap, AKRenderTap and AKTimelineTap. Instead, we have traditional AVAudioEngine style taps: AmplitudeTap, PitchTap, and RawDataTap.

Minor Changes in v5

Next we have things that are different but rather trivial to reimplement (and very worthwhile to do so).

  1. The best way to use AudioKit 5 is to use Swift Package Manager. If you're hooked on Cocoapods, we still plan to provide Cocoapod versions, but we strongly encourage you to move to SPM. We have, and we do not regret it.

  2. AudioKitUI is now a separate package that has AudioKit as a dependency.

  3. The AudioKit singleton no longer exists so instead of writing

AudioKit.output = something
AudioKit.start()
AudioKit.stop()

you'll need to create an instance of an AudioKit Engine:

let engine = AudioEngine()
engine.output = something
engine.start()
engine.stop()
  1. AudioKit 5 drops the AK prefix from class names.

If you get errors like Cannot find AKOscillator in scope try Oscillator instead. If you already have defined an Oscillator class in your project, you can access AudioKit's oscillator with AudioKit.Oscillator.

  1. AudioKit 5 effects no longer take optional nodes on initialization.

In AudioKit 4 you could write AKReverb() but now you will have to write Reverb(nodeYouWantToReverberate). One of the main reasons for this is that our audio engine is keeping track of the connections and now tightly enforces that you're not making any mistakes with dangling nodes not properly connected.

A side effect of this change is that the syntactical sugar of setting up your chain after initialization with the syntax oscillator >>> reverb is gone. To change your signal chain, even while the engine is running, use a Mixer and its addInput and removeInput methods.

  1. Ramp duration is no longer a property of AudioKit or even on AudioKit nodes. Instead, ramping parameters is much more flexible. What used to be:
oscillator.rampDuration = 0.2
oscillator.amplitude = 0.9 // ramp to 0.9 over 0.2 seconds
oscillator.frequency = 880 // ramp to 880 over 0.2 seconds

is much more flexible:

oscillator.$amplitude.ramp(to: 0.9, duration: 1.2)
oscillator.$frequency.ramp(to: 880, duration: 1.7)

Notice how ramping duration is independent for each parameter. And notice the parameter is a property wrapper in this case, so it is prefixed by the dollar sign. Setting parameters like in the first code still works, but the changes are immediate, not ramped.

  1. In addition to all parameters on AudioKit nodes (except for the ones based off of Apple DSP) being rampable, they are also automatable. By generating piecewise linear curves, you can approximate all kinds of ramp curves or other time varying changes to the parameters.

  2. Microphone access has changed. There is no more AKMicrophone and instead you create a microphone as an AudioEngine.InputNode and instantiate on an engine you create:

let engine = AudioEngine()
let mic: AudioEngine.InputNode

init() {
    mic = engine.input
}

Also, AKMicrophoneTracker was removed. Using an AudioEngine's InputNode along with a PitchTap is a better solution.

  1. All of the projects in the Examples for have been moved out of this repository. See the Examples documentary for links to the new repositories.

v4-v5 Class Name Changes

Old NameNew NameNotes
">>>(::)"-This syntactical sugar for connecting nodes has been removed.
AK3DPanner-This class was never tested and seemed to not work well.
AKADSRViewADSRView
AKAbstractPlayer-This was a part of the AKPlayer. Use AudioPlayer instead.
AKAmplitudeEnvelopeAmplitudeEnvelope
AKAmplitudeTapAmplitudeTap
AKAmplitudeTracker-Use AmplitudeTap instead.
AKAppleSamplerAppleSampler
AKAppleSequencerAppleSequencer
AKAudioFile-Everything has been updated to use Apple's AVAudioFile. Use FormatConverter to change the format of an AVAudioFile.
AKAudioPlayerAudioPlayer
AKAutoPannerAutoPanner
AKAutoWahAutoWahAll effects need an input. ie. no more empty initialzers with connections defined later.
AKBalancerBalancer
AKBandPassButterworthFilterBandPassButterworthFilterAll effects need an input. ie. no more empty initialzers with connections defined later.
AKBandRejectButterworthFilterBandRejectButterworthFilterAll effects need an input. ie. no more empty initialzers with connections defined later.
AKBitCrusherBitCrusherAll effects need an input. ie. no more empty initialzers with connections defined later.
AKBluetoothMIDIButtonBluetoothMIDIButton
AKBoosterFaderAll effects need an input. ie. no more empty initialzers with connections defined later.
AKBrownianNoiseBrownianNoise
AKButton-We have removed most of UI elements that were not specific to audio.
AKBypassButton-
AKCallbackInstrumentCallbackInstrument
AKChorusChorusAll effects need an input. ie. no more empty initialzers with connections defined later.
AKChowningReverbChowningReverbAll effects need an input. ie. no more empty initialzers with connections defined later.
AKClarinetClarinet
AKClip-
AKClipMerger-
AKClipPlayer-
AKClipRecorder-
AKClipperClipperAll effects need an input. ie. no more empty initialzers with connections defined later.
AKCombFilterReverbCombFilterReverbAll effects need an input. ie. no more empty initialzers with connections defined later.
AKComponent-
AKCompressorCompressorAll effects need an input. ie. no more empty initialzers with connections defined later.
AKComputedParameterComputedParameter
AKConvolutionConvolutionAll effects need an input. ie. no more empty initialzers with connections defined later.
AKCostelloReverbCostelloReverbAll effects need an input. ie. no more empty initialzers with connections defined later.
AKCustomUgen-Custom Ugen support has been removed from operations.
AKDCBlockDCBlockAll effects need an input. ie. no more empty initialzers with connections defined later.
AKDecimatorDecimatorAll effects need an input. ie. no more empty initialzers with connections defined later.
AKDelayDelayAll effects need an input. ie. no more empty initialzers with connections defined later.
AKDeviceDevice
AKDiskStreamer-This used a lot of AudioKit internals that were removed, but we'd love to port it to AudioKit 5 soon.
AKDistortionDistortionAll effects need an input. ie. no more empty initialzers with connections defined later.
AKDripDrip
AKDryWetMixerDryWetMixer
AKDurationDuration
AKDynaRageCompressorDynaRageCompressorAll effects need an input. ie. no more empty initialzers with connections defined later.
AKDynamicPlayer-This was a part of the AKPlayer. Use AudioPlayer instead.
AKDynamicRangeCompressorDynamicRangeCompressorAll effects need an input. ie. no more empty initialzers with connections defined later.
AKDynamicsProcessorDynamicsProcessorAll effects need an input. ie. no more empty initialzers with connections defined later.
AKEqualizerFilterEqualizerFilterAll effects need an input. ie. no more empty initialzers with connections defined later.
AKExpanderExpanderAll effects need an input. ie. no more empty initialzers with connections defined later.
AKFFTTapFFTTap
AKFMOscillatorFMOscillator
AKFMOscillatorBank-This used a lot of AudioKit internals that were removed. You can use Synth for polyphonic sounds, and we hope to reintroduce polyphonic banks into AK5 soon.
AKFMOscillatorFilterSynth-This used a lot of AudioKit internals that were removed. You can use Synth for polyphonic sounds, and we hope to reintroduce polyphonic banks into AK5 soon.
AKFaderFaderAll effects need an input. ie. no more empty initialzers with connections defined later.
AKFileClip-
AKFileClipSequence-
AKFlangerFlangerAll effects need an input. ie. no more empty initialzers with connections defined later.
AKFlatFrequencyResponseReverbFlatFrequencyResponseReverb
AKFluteFlute
AKFormantFilterFormantFilterAll effects need an input. ie. no more empty initialzers with connections defined later.
AKFrequencyTracker-Use a PitchTap instead.
AKHighPassButterworthFilterHighPassButterworthFilterAll effects need an input. ie. no more empty initialzers with connections defined later.
AKHighPassFilterHighPassFilterAll effects need an input. ie. no more empty initialzers with connections defined later.
AKHighShelfFilterHighShelfFilterAll effects need an input. ie. no more empty initialzers with connections defined later.
AKHighShelfParametricEqualizerFilterHighShelfParametricEqualizerFilterAll effects need an input. ie. no more empty initialzers with connections defined later.
AKInput-No longer necessary.
AKKeyboardDelegateKeyboardDelegate
AKKeyboardViewKeyboardView
AKKorgLowPassFilterKorgLowPassFilterAll effects need an input. ie. no more empty initialzers with connections defined later.
AKLazyTap-
AKLog(fullname:file:line:_:)Log(fullname:file:line:_:)
AKLowPassButterworthFilterLowPassButterworthFilterAll effects need an input. ie. no more empty initialzers with connections defined later.
AKLowPassFilterLowPassFilterAll effects need an input. ie. no more empty initialzers with connections defined later.
AKLowShelfFilterLowShelfFilterAll effects need an input. ie. no more empty initialzers with connections defined later.
AKLowShelfParametricEqualizerFilterLowShelfParametricEqualizerFilterAll effects need an input. ie. no more empty initialzers with connections defined later.
AKMIDIMIDI
AKMIDICallbackMIDICallback
AKMIDICallbackInstrumentMIDICallbackInstrument
AKMIDIClockListenerMIDIClockListener
AKMIDIControlMIDIControl
AKMIDIEventMIDIEvent
AKMIDIFileMIDIFile
AKMIDIFileChunkEventMIDIFileChunkEvent
AKMIDIFileTrackMIDIFileTrack
AKMIDIInstrumentMIDIInstrument
AKMIDIListenerMIDIListener
AKMIDIMetaEventMIDIMetaEvent
AKMIDIMetaEventTypeMIDIMetaEventType
AKMIDIMonoPolyListenerMIDIMonoPolyListener
AKMIDINodeMIDINode
AKMIDINoteDataMIDINoteData
AKMIDIOMNIListenerMIDIOMNIListener
AKMIDISamplerMIDISampler
AKMIDIStatusMIDIStatus
AKMIDIStatusTypeMIDIStatusType
AKMIDISystemCommandMIDISystemCommand
AKMIDISystemCommandTypeMIDISystemCommandType
AKMIDISystemRealTimeListenerMIDISystemRealTimeListener
AKMIDITempoListenerMIDITempoListener
AKMIDITimeOutMIDITimeOut
AKMIDITransformerMIDITransformer
AKManager-This was a global singleton, instead create an instance of AudioEngine.
AKMandolinMandolinStringThis no longer simulataes for 4 sets of 2 strings, but rather just one string. Combine as necessary in your own code.
AKMetalBarMetalBar
AKMetronome-Use a Sequencer with a metronome track instead.
AKMicrophone-Use AudioEngine.InputNode, or engine.input.
AKMicrophoneTracker-Use AmplitudeTap and Pitch Tap instead.
AKMixerMixerMixer now has addInput and removeInput which can be used to dynamically change the signal chain while the engine is running.
AKModalResonanceFilterModalResonanceFilterAll effects need an input. ie. no more empty initialzers with connections defined later.
AKMoogLadderMoogLadderAll effects need an input. ie. no more empty initialzers with connections defined later.
AKMorphingOscillatorMorphingOscillator
AKMorphingOscillatorBank-This used a lot of AudioKit internals that were removed. You can use Synth for polyphonic sounds, and we hope to reintroduce polyphonic banks into AK5 soon.
AKMorphingOscillatorFilterSynth-This used a lot of AudioKit internals that were removed. You can use Synth for polyphonic sounds, and we hope to reintroduce polyphonic banks into AK5 soon.
AKMusicTrackMusicTrackManager
AKNodeNode
AKNodeFFTPlotNodeFFTPlot
AKNodeOutputPlotNodeOutputPlot
AKNodeRecorderNodeRecorder
AKOperationOperation
AKOperationEffectOperationEffect
AKOperationGeneratorOperationGenerator
AKOscillatorOscillator
AKOscillatorBank-This used a lot of AudioKit internals that were removed. You can use Synth for polyphonic sounds, and we hope to reintroduce polyphonic banks into AK5 soon.
AKOscillatorFilterSynth-This used a lot of AudioKit internals that were removed. You can use Synth for polyphonic sounds, and we hope to reintroduce polyphonic banks into AK5 soon.
AKOutput-No longer necessary.
AKOutputWaveformPlot-Use a plot attached to a node.
AKPWMOscillatorPWMOscillator
AKPWMOscillatorBank-This used a lot of AudioKit internals that were removed. You can use Synth for polyphonic sounds, and we hope to reintroduce polyphonic banks into AK5 soon.
AKPWMOscillatorFilterSynth-This used a lot of AudioKit internals that were removed. You can use Synth for polyphonic sounds, and we hope to reintroduce polyphonic banks into AK5 soon.
AKPannerPanner
AKParameterParameter
AKPeakLimiterPeakLimiter
AKPeakingParametricEqualizerFilterPeakingParametricEqualizerFilter
AKPeriodicFunction-Can use a Callback Loop or a Timer instead.
AKPhaseDistortionOscillatorPhaseDistortionOscillator
AKPhaseDistortionOscillatorBank-This used a lot of AudioKit internals that were removed. You can use Synth for polyphonic sounds, and we hope to reintroduce polyphonic banks into AK5 soon.
AKPhaseDistortionOscillatorFilterSynth-This used a lot of AudioKit internals that were removed. You can use Synth for polyphonic sounds, and we hope to reintroduce polyphonic banks into AK5 soon.
AKPhaseLockedVocoderPhaseLockedVocoderAll effects need an input. ie. no more empty initialzers with connections defined later.
AKPhaserPhaserAll effects need an input. ie. no more empty initialzers with connections defined later.
AKPinkNoisePinkNoise
AKPitchShifterPitchShifterAll effects need an input. ie. no more empty initialzers with connections defined later.
AKPlayerAudioPlayerAudioPlayer is a major simplification of AKPlayer and is currently much more restrictive on what you can do with it.
AKPlaygroundLoopCallbackLoop
AKPlaygroundView-We have removed most of UI elements that were not specific to audio.
AKPluckedStringPluckedString
AKPolyphonicPolyphonic
AKPolyphonicNodePolyphonicNode
AKPresetLoaderView-We have removed most of UI elements that were not specific to audio.
AKPropertySlider-We have removed most of UI elements that were not specific to audio.
AKRawMIDIPacketRawMIDIPacket
AKRecordingResult-
AKRenderTap-
AKResonantFilterResonantFilterAll effects need an input. ie. no more empty initialzers with connections defined later.
AKResourcesAudioFileLoaderView-We have removed most of UI elements that were not specific to audio.
AKReverbReverbAll effects need an input. ie. no more empty initialzers with connections defined later.
AKReverb2-Errored in AudioKit 5 on initialization. Could be resurrected by someone interested in doing so.
AKRhinoGuitarProcessorRhinoGuitarProcessorAll effects need an input. ie. no more empty initialzers with connections defined later.
AKRhodesPianoRhodesPiano
AKRingModulatorRingModulatorAll effects need an input. ie. no more empty initialzers with connections defined later.
AKRolandTB303FilterRolandTB303FilterAll effects need an input. ie. no more empty initialzers with connections defined later.
AKRollingOutputPlot-Use a plot attached to a node.
AKSamplePlayerSamplePlayer
AKSamplerSampler
AKSequencerSequencer
AKSequencerTrackSequencerTrack
AKSettingsSettings
AKShakerShaker
AKShakerTypeShakerType
AKStepper-We have removed most of UI elements that were not specific to audio.
AKStereoDelayStereoDelay
AKStereoFieldLimiterStereoFieldLimiter
AKStereoInputStereoInput
AKStereoOperationStereoOperation
AKStringResonatorStringResonatorAll effects need an input. ie. no more empty initialzers with connections defined later.
AKSynthSynth
AKSynthKickSynthKick
AKSynthSnareSynthSnare
AKTableTable
AKTableTypeTableType
AKTanhDistortionTanhDistortionAll effects need an input. ie. no more empty initialzers with connections defined later.
AKTelephoneView-We have removed most of UI elements that were not specific to audio.
AKTester-AudioEngine now has the testing functionality
AKThreePoleLowpassFilterThreePoleLowpassFilter
AKTimePitchTimePitchAll effects need an input. ie. no more empty initialzers with connections defined later.
AKTimelineTap-
AKTiming-
AKToggleableToggleable
AKToneComplementFilterToneComplementFilterAll effects need an input. ie. no more empty initialzers with connections defined later.
AKToneFilterToneFilterAll effects need an input. ie. no more empty initialzers with connections defined later.
AKTremoloTremolo
AKTry(_:)ExceptionCatcher(_:)
AKTubularBellsTubularBells
AKTuningTableTuningTable
AKTuningTableBaseTuningTableBase
AKTuningTableDelta12ETTuningTableDelta12ET
AKTuningTableETNNTuningTableETNN
AKVariSpeedVariSpeedAll effects need an input. ie. no more empty initialzers with connections defined later.
AKVariableDelayVariableDelayAll effects need an input. ie. no more empty initialzers with connections defined later.
AKVocalTractVocalTract
AKWaveTable-This used a lot of AudioKit internals that were removed, but we'd love to port it to AudioKit 5 soon.
AKWhiteNoiseWhiteNoise
AKZitaReverbZitaReverbAll effects need an input. ie. no more empty initialzers with connections defined later.
AudioKit-This was a global singleton, instead create an instance of AudioEngine.
AudioKitUI-Separate package
ClipMergeDelegate-Original programmer hired by Apple and not available for maintaining.
ClipMergerError-Original programmer hired by Apple and not available for maintaining.
ClipRecordingError-Original programmer hired by Apple and not available for maintaining.
FileClip-Original programmer hired by Apple and not available for maintaining.
MultitouchGestureRecognizerMultitouchGestureRecognizer
random(::)-Use AUValue's random(in:) method.