Spectrogram from AVAudioPCMBuffer using Accelerate framework in Swift

前端 未结 2 1379
广开言路
广开言路 2020-12-28 09:16

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

2条回答
  •  北海茫月
    2020-12-28 09:42

    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):

    1. Allocate memory (realp, imagp - [Float](.....) is shorthand for Array[float] - and likely allocated on the heap`. Pre-allocate these

    2. 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.

提交回复
热议问题