I’m attempting to transition my audio project to utilize AudioKit. In my current setup, I employ a standard Apple node for equalization. Here’s a snippet to provide context:
var engine = AVAudioEngine()
var eqNode = AVAudioUnitEQ()
engine.attach(eqNode)
func initEqualizer() {
eqNode = AVAudioUnitEQ(numberOfBands: frequencies.count)
eqNode.globalGain = 0
for i in 0..<frequencies.count {
eqNode.bands[i].frequency = Float(frequencies[i])
eqNode.bands[i].gain = 0
eqNode.bands[i].bypass = false
eqNode.bands[i].filterType = .parametric
}
}
eqNode.globalGain = eqSettings.generalGain
for i in 0..<frequencies.count {
eqNode.bands[i].gain = values[i]
}
I had assumed that integrating ParametricEQ would be straightforward, but I’ve encountered challenges:
- The ParametricEQ appears to utilize different parameters and lacks a globalGain feature, which is essential for my setup.
- Despite reviewing AudioKit’s cookbook examples, I haven’t found a similar straightforward example of a simple equalizer.
It seems like I may need to develop a custom Equalizer class in AudioKit to replicate the functionality of my AVAudioUnitEQ. Am I on the right track, or is there something I might be overlooking?
2
Answers
Look into SoundPipeAudioKit, AudioKits extension library with Instruments and Effects.
There are several filters available, e.g. EqualizerFilter.
You can do this with filter nodes from SoundpipeAudiokit. I would suggest you create the following chain:
your input -> LowShelfParametricEqualizerFilter -> as many PeakingParametricEqualizerFilters as you need -> HighShelfParametricEqualizerFilter
All of these filters have parameters for center frequency, gain and q, and can also be bypassed.