Spectrogram from AVAudioPCMBuffer using Accelerate framework in Swift

前端 未结 2 1380
广开言路
广开言路 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:29

    1. Hacky way: you can just cast a float array. Where reals and imag values are going one after another.
    2. It depends on if audio is interleaved or not. If it's interleaved (most of the cases) left and right channels are in the array with STRIDE 2
    3. Lowest frequency in your case is frequency of a period of 1024 samples. In case of 44100kHz it's ~23ms, lowest frequency of the spectrum will be 1/(1024/44100) (~43Hz). Next frequency will be twice of this (~86Hz) and so on.

提交回复
热议问题