for i in stride(from: 0, to: self.FFT_SIZE - 1, by: 2) {
// get the real and imaginary parts of the complex number
let real = fftData[i]
let imaginary = fftData[i + 1]
let normalizedBinMagnitude = 2.0 * sqrt(real * real + imaginary * imaginary) / Float(self.FFT_SIZE)
let amplitude = Double(20.0 * log10(normalizedBinMagnitude)) //decibel value
print("amplitude:",i, amplitude)
....
}
The amplitude is negative value. Example : -255 for frequency at i = 1450
So for average amplitude , we can calculate median of amplitude but it's still a negative value. sum(amplitude)/ (FFT_SIZE/2) (i : 0-> FFT_SIZE-1, by : 2).
I want to make app to measure sound level in DbA from 30 to 120 decibel (Positive value which human use to check ) . Something like this app .
Could you take a look and help to solve my problem ?
.... }
The amplitude is negative value. Example : -255 for frequency at i = 1450 So for average amplitude , we can calculate median of amplitude but it's still a negative value. sum(amplitude)/ (FFT_SIZE/2) (i : 0-> FFT_SIZE-1, by : 2).
I want to make app to measure sound level in DbA from 30 to 120 decibel (Positive value which human use to check ) . Something like this app .
Could you take a look and help to solve my problem ?