拙网论坛

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 348|回复: 0

How do I calculate dB(A) values for 1/3 octave bands using AVAudioRecorder in...

[复制链接]

949

主题

1001

帖子

3736

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
3736
发表于 2019-12-5 10:28:49 | 显示全部楼层 |阅读模式
How do I calculate dB(A) values for 1/3 octave bands using AVAudioRecorder in iPhone
https://stackoverflow.com/questions/25485805/how-do-i-calculate-dba-values-for-1-3-octave-bands-using-avaudiorecorder-in-ip

In your first question about obtaining a dB(A) value by adding an arbitrary dB value: I think the answer is no, that is not correct. In digital audio, 0dB is considered a full scale signal with lower amplitudes going negative.
As for the 1/3rd octave analyzer: Let's start with the definition of an octave. An octave means a doubling or halving of a frequency. So 20Hz and 40Hz are an octave apart. If you divide an octave logarithmically into 3 ranges those are called 1/3rd octave bands.
The job of a 1/3rd octave analyzer is to display in meter form the level of each of the bands over a given frequency range. Choosing a range of 20Hz to 20kHz, the first meter you'd have a bar indicating the level with a center frequency of 20Hz, a lower band limit of of 17.8 Hz and an upper band limit of 22.4 Hz. And so on up the spectrum.
The most common way this is implemented is with a bank of bandpass filters, each tuned to one of the center frequencies. You then take the output from the filter and compute the RMS and that becomes the level for that band. If you are doing this in software then there is a fair amount of DSP knowledge required to design the filters and the computational overhead is rather high (31 filters to cover 20Hz to 20kHz).
Another approach is to use an FFT. With this approach the goal is to lump together FFT bins around the center frequency and compute the total energy. The trick is in choosing which bands to lump because FFT bins are equally spaced in hertz.
I don't know what sample rate you are recording at but it's pretty easy to compute what your bin widths and bin centers are going to be:
The bin width is equal to the sampleRate/FFTlength. A 66536 pt FFT at 48kHz gives a bin width of 0.73Hz. Bin 24 has a bin lower limit at 17.58 and a bin center at 17.95, which is reasonably close to the lower band limit of a 1/3rd octave filter. And bin 30 has a upper limit of 22.71 and a center of 22.34, reasonable close to 22.4Hz. As you might notice, you are introducing some amount of error due to the frequency resolution of the FFT. You can reduce this error by increasing the size of the FFT.
Here's the calculator I used for finding the FFT frequencies and the 1/3 octave filter frequencies: http://www.zytrax.com/tech/audio/calculator.html



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|抱朴守拙BBS

GMT+8, 2025-5-25 20:56 , Processed in 0.196383 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表