AudioKit FFT转换为dB? [英] AudioKit FFT conversion to dB?

查看:811
本文介绍了AudioKit FFT转换为dB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第一次发帖,感谢伟大的社区!

First time posting, thanks for the great community!

我正在使用 AudioKit 并尝试添加频率加权过滤器到麦克风输入,所以我试图理解AudioKit AKFFTTap出来的值。

I am using AudioKit and trying to add frequency weighting filters to the microphone input and so I am trying to understand the values that are coming out of the AudioKit AKFFTTap.

目前我试图打印转换的FFT缓冲区进入dB值

Currently I am trying to just print the FFT buffer converted into dB values

for i in 0..<self.bufferSize {
    let db = 20 * log10((self.fft?.fftData[Int(i)])!)
    print(db)
}

我期待的数值范围在-128到0之间,但是我得到了近-200dB的奇怪值,当我吹上麦克风来读出读数时它只达到 - 60。我没有正确接近这个吗?我假设从EZAudioFFT引擎输出的值将是普通的幅度值,并且正常的dB转换数学将起作用。有什么想法吗?

I was expecting values ranging in the range of about -128 to 0, but I am getting strange values of nearly -200dB and when I blow on the microphone to peg out the readings it only reaches about -60. Am I not approaching this correctly? I was assuming that the values being output from the EZAudioFFT engine would be plain amplitude values and that the normal dB conversion math would work. Anyone have any ideas?

提前感谢您对此问题的任何讨论!

Thanks in advance for any discussion about this issue!

推荐答案

数组中的值对应于FFT中的二进制值。使单个箱包含接近1的幅度值将意味着大量能量处于该窄频带中,例如一个非常响亮的正弦曲线(一个单一频率的信号)。

The values in the array correspond to the values of the bins in the FFT. Having a single bin contain a magnitude value close to 1 would mean that a great amount of energy is in that narrow frequency band e.g. a very loud sinusoid (a signal with a single frequency).

正常的声音,例如你在麦克风上吹的声音,在整个频谱上传播能量,也就是说,在许多箱子而不是一个箱子里。出于这个原因,通常随着FFT大小的增加,幅度会变小。

Normal sounds, such as the one caused by you blowing on the mic, spread their energy across the entire spectrum, that is, in many bins instead of just one. For this reason, usually the magnitudes get lower as the FFT size increases.

单个bin上的-40dB的幅度非常大。如果您尝试播放音调,则应在其中一个箱中看到明显的峰值。

Magnitude of -40dB on a single bin is quite loud. If you try to play a tone, you should see a clear peak in one of the bins.

这篇关于AudioKit FFT转换为dB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆