I\'m trying to generate a spectrogram from an AVAudioPCMBuffer
in Swift. I install a tap on an AVAudioMixerNode
and receive a callback with the aud
4: You have installed a callback handler on an audio bus. This is likely run with real-time thread priority and frequently. You should not do anything that has potential for blocking (it will likely result in priority inversion and glitchy audio):
Allocate memory (realp
, imagp
- [Float](.....)
is shorthand for Array[float]
- and likely allocated on the heap`. Pre-allocate these
Call lengthy operations such as vDSP_create_fftsetup()
- which also allocates memory and initialises it. Again, you can allocate this once outside of your function.