6/7 6. ߴϑʔϦΤมͷ݁Ռ͔Βৼ෯εϖΫτϧΛࢉग़͢Δʢ2/2ʣ class FFT { // ... func compute(sampleRate: Float, audioData: UnsafePointer<Float>) -> [(Float, Float)] { // ... // ϑʔϦΤมͷ݁ՌΛཁૉͰׂΔʢ͜ͷ࣌Ͱ૭ͷαΠζͷ͚ͩΛ༻͢Δʣ var fftNormFactor = Float(fftFullSize) vDSP_vsdiv(dspSplitComplex.realp, 1, &fftNormFactor, dspSplitComplex.realp, 1, fftHalfSize) vDSP_vsdiv(dspSplitComplex.imagp, 1, &fftNormFactor, dspSplitComplex.imagp, 1, fftHalfSize) // ઈରΛࢉग़͢Δ => ৼ෯͕ಘΒΕΔ var magnitudeData = [Float](repeating: .zero, count: Int(fftHalfSize)) vDSP_zvabs(&dspSplitComplex, 1, &magnitudeData, 1, fftHalfSize) // ৼ෯Λ̎ഒ͢Δ var fftFactor = Float(2) vDSP_vsmul(magnitudeData, 1, &fftFactor, &magnitudeData, 1, fftHalfSize) 30