我有函数,可以将FFT的结果转换为八度频段(或1 / n-八度):
Function OctaveFilter(LowFreq, HighFreq, Im, Re) 'For amplitude
Dim i, j, SortedData(), F_From(), F_To()
Redim SortedData(Bins * n), F_From(Bins * n), F_To(Bins * n)
Dim p
For i = 1 To Bins * n
F_To(i) = Int(HighFreq(i) / df)
F_From(i) = Int(LowFreq(i) / df)
if (F_From(i) = 0) Then F_From(i) = 1 ' We cannot start from index 0
Next
For i = 1 To Bins * n
SortedData(i) = 0
For j = F_From(i) To F_To(i)
If (Length >= j) Then
SortedData(i) = SortedData(i) + Im(j)^2 + Re(j)^2
End If
Next
Next
SortInBins = sqrt(SortedData)
End Function
例如,此FFT: Amplitude
转换为这个1/3倍频程频段:
但是从FFT中我也有Re和Im部分。我也想将这些部分转换为八度音阶。功能是否相同?如何将该Im part虚部转换为相似的结果(1/3八度)?