游戏中的声音-多孔吸收体(译文)
By robot-v1.0
本文链接 https://www.kyfws.com/games/sound-in-games-porous-absorbers-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 9 分钟阅读 - 4248 个词 阅读量 0游戏中的声音-多孔吸收体(译文)
原文地址:https://www.codeproject.com/Articles/474810/Sound-in-games-porous-absorbers
原文作者:Kenneth Haugland
译文由本站 robot-v1.0 翻译
前言
How to calculate damping in a room with a porous absorber in front of the wall.
如何计算墙前有多孔吸收器的房间的阻尼.
- 下载源代码33.7 KB(Download source code - 33.7 KB)
- 下载源代码和演示-215.1 KB(Download source code and demo - 215.1 KB)
介绍(Introduction)
本文重点介绍如何通过将多孔吸收剂放置在墙壁或其他硬表面的前面来计算吸收系数.这意味着,如果您要在家庭工作室,车库或任何其他房间中构造自己的矿棉吸收器,则可以使用计算出的值并将其用于计算混响时间(您可以了解更多有关这里:(This article focuses on how to calculate the absorption coefficient by placing porous absorbers in front of a wall or other hard surfaces. This means that if you want to construct an absorber of mineral wool of your own, in you home studio, garage or any other a room, you could use the calculated values and use them in calculating the reverberation time (which you can read more about here:)
- 游戏中的声音-客房(Sound in games - Rooms) 这是一篇狭窄的文章,但这是许多房间以及它们如何表现的重要方面.当您要计算房间中的更多高级功能并将其用于声音再现时,还必须了解这些属性.(This is quite a narrow article, but it’s an important aspect of many rooms, and how they will behave. It is also necessary to have knowledge of these these properties when you want to calculate more advanced features in a room, and use it for sound reproduction.)
背景(Background)
当您要计算多孔吸收器中的吸收率和复数波数时,可以遵循两种不同的主要路径.它们都使用无量纲参数E,该参数由以下等式定义:(There are two different main paths you could follow when you want to calculate the absorption and the complex wavenumber in a porous absorber. They both use the dimensionless parameter E and that is defined by the equation below:)
应该注意的是,p0通常设置为空气的重量,因为大多数多孔吸收剂中的空气含量约为98%.流动电阻率通常在数据表中以MKS rayl m给出.(One should take note that the p0 is usually set to the weight of air, as most porous absorbers have roughly 98 % air in them. The Flow resistivity is often given in datasheets as MKS rayl m)-1(-1),这是方程式中最重要的参数之一,因此了解如何找到它很重要.(, and this is one of the most important parameters in the equation, so it’s important to know how to find it.) 两位研究人员Delany和Bazley发表了一个基于许多正常多孔吸收剂平均值的近似公式.他们发布的公式为波数给出了一个,为特性阻抗给出了一个,下面给出了这两个:(The two researchers Delany and Bazley published a formula for approximating based on the averages of many normal porous absorbers. The formula they published gave one for the wavenumber and one for the characteristic impedance, and these two are given below:)
这些公式可以在中高频使用,而不会出现任何问题,但是它们在低频下会失败.幸运的是,梅歇尔(Mechel)开发了一个不同的公式,使用了中高频的测量和低频的理论模型.低频部分的公式如下:(These formulas can be used in mid and high frequency without any problems, but they fail at the low frequency. Luckily Mechel developed a different formula, using measurement for the mid and high frequencies and a theoretical model for the low frequencies. The formulation for the low frequency part are as follows:)
哪里(Where the) 是空气的绝热常数,大约等于1.4,并且(is the adiabatic constant for air, roughly equal to 1.4, and the) 是材料的孔隙率,通常在0.98左右,这意味着吸收器的体积中约含98%的空气.下面给出了适用于中高频的法线或公式:(is the porosity of the material, usually in the area around 0.98, meaning the absorber contains roughly 98 % air in its volume. The normal, or formulas valid for the mid and high frequencies are given below:)
梅歇尔还为两个不同公式之间的传递相互作用设置了一些边界,这些边界在程序中给出,在此不再讨论.该实现将给出一个包含这两个参数的类,如下所示:(Mechel also sets some boundaries for where the transmission between the two different formulas interact, these are given in the program and not discussed here. The implementation of that would give out a class containing these two parameters are given below:)
Module Porous
''' <summary>
''' Calculates the Material coefficients based on FlowResistivity and Frequency
''' </summary>
''' <param name="Frequency">The frequency the calculation is valid for</param>
''' <param name="FlowResistivity">Flow resistivity of the porous material</param>
''' <param name="rho"></param>
''' <param name="c"></param>
''' <returns>most of the prous materials consists of roughly 98% air,
''' so its assumed that this is the caracteristic properties
''' of most of these kind of absorbers</returns>
''' <remarks>returns the complex wave number ia j*k'.
''' This is not useable directly in some formulas</remarks>
Public Function DelanyBazely(ByVal Frequency As Double, ByVal FlowResistivity _
As Double, Optional ByVal rho As Double = 1.21, Optional ByVal c As Double = 340) _
As Acoustics.SimpleMaterialPropertiesHolder
Dim result As New Acoustics.SimpleMaterialPropertiesHolder
Dim E As Double = rho * Frequency / FlowResistivity
result.CharacteristicImpedance = rho * c * (1 + 0.0571 * Math.Pow(E, -0.754) - New Complex(0, 0.087 * Math.Pow(E, -0.732)))
result.PropagationCoeficcient = New Complex(0, 2 * Math.PI * Frequency / c)
result.PropagationCoeficcient *= (1 + 0.0978 * Math.Pow(E, -0.7) - New Complex(0, 0.189 * Math.Pow(E, -0.595)))
Return result
End Function
''' <summary>
''' Calculates the Material coefficients based on FlowResistivity,
''' Adiabat constant, Porousoty of the material and the Frequency
''' </summary>
''' <param name="Frequency">The frequency for the calculation</param>
''' <param name="FlowResistivity">Flow resistivity of the porous material</param>
''' <param name="Porousity">A percentige of air in the material,
''' set to 0.98 by default, mening it has 2% of fibers in a volume</param>
''' <param name="Adiabat">This is the compressability of air</param>
''' <param name="rho">The weight of air</param>
''' <param name="c">The speed of sound in air</param>
''' <returns>most of the prous materials consists of roughly 98% air,
''' so its assumed that this is the caracteristic properties of most of these kind of absorbers</returns>
''' <remarks>returns the complex wave number ia j*k'.
''' This is not useable directly in some formulas</remarks>
Public Function Mechel(ByVal Frequency As Double, ByVal FlowResistivity As Double, _
Optional ByVal Porousity As Double = 0.98, Optional ByVal Adiabat As Double = 1.4, _
Optional ByVal rho As Double = 1.21, Optional ByVal c As Double = 340) _
As Acoustics.SimpleMaterialPropertiesHolder
Dim E As Double = rho * Frequency / FlowResistivity
Dim lessPart As New Acoustics.SimpleMaterialPropertiesHolder
lessPart.PropagationCoeficcient = New Complex(0, 2 * Math.PI * Frequency / c)
lessPart.PropagationCoeficcient *= Complex.Sqrt(New Complex(1, -Adiabat / (2 * Math.PI * E)))
lessPart.CharacteristicImpedance = New Complex(0, -rho * c ^ 2 / (2 * Math.PI * Frequency * Adiabat * Porousity))
lessPart.CharacteristicImpedance *= lessPart.PropagationCoeficcient
Dim NormalPart As New Acoustics.SimpleMaterialPropertiesHolder
NormalPart.PropagationCoeficcient = New Complex(0.2082 * E ^ (-0.6193), 1 + 0.1087 * E ^ (-0.6731))
NormalPart.PropagationCoeficcient *= New Complex(2 * Math.PI * Frequency / c, 0)
NormalPart.CharacteristicImpedance = New Complex(1 + 0.06082 * E ^ (-0.717), -0.1323 * E ^ (-0.6601))
NormalPart.CharacteristicImpedance *= rho * c
Dim FinalResult As New Acoustics.SimpleMaterialPropertiesHolder
FinalResult = NormalPart
If E > 0.04 Then
Return FinalResult
End If
Dim Elimit As New ElimitHolder
If E < Elimit.GammaReal Then
FinalResult.PropagationCoeficcient = _
New Complex(lessPart.PropagationCoeficcient.Real, _
FinalResult.PropagationCoeficcient.Imaginary)
End If
If E < Elimit.GammaImg Then
FinalResult.PropagationCoeficcient = _
New Complex(FinalResult.PropagationCoeficcient.Real, _
lessPart.PropagationCoeficcient.Imaginary)
End If
If E < Elimit.Zreal Then
FinalResult.CharacteristicImpedance = _
New Complex(lessPart.CharacteristicImpedance.Real, _
FinalResult.CharacteristicImpedance.Imaginary)
End If
If E < Elimit.Zimg Then
FinalResult.CharacteristicImpedance = _
New Complex(FinalResult.CharacteristicImpedance.Real, _
lessPart.CharacteristicImpedance.Imaginary)
End If
Return FinalResult
End Function
Private Class ElimitHolder
Public GammaReal As Double = 0.04
Public GammaImg As Double = 0.008
Public Zreal As Double = 0.006
Public Zimg As Double = 0.02
End Class
End Module
梅赫尔(Mechel)还给出了其他更复杂的皮革配方,其中包括窗帘的作用,如果您不知道孔隙率,则需要对其进行计算才能得出正确的传播常数和特性阻抗公式.(Mechel has given other more complicated formulas leather, that includes the effect of among other things curtains, were you don’t know the porosity and that would need to be calculated in order to arrive at the correct formulas for propagation constants and characteristic impedance.) 我刚刚展示的两种方法还有其他选择,即瑞利模型,它使用纯理论方法,并且类似于梅歇尔低频公式,假设多孔吸收器可以建模为管或矩阵的矩阵.孔板.(There are also alternatives to the two methods that I have just shown, namely the Rayleigh model, which uses a purely theoretical approach and is similar to Mechels low frequency formula, by assuming that a porous absorber could be modeled as a matrix of tubes or a perforated plate.) 梅歇尔(Mechel)也有一个不同的公式来区分不同类型的矿棉.他将玻璃纤维和矿物纤维(玄武岩或岩棉)分开,并给出了两种不同的表达方式.但是,它在<声学吸收剂和扩散器>一书中给出,Mechel在"声学公式"中给出了计算多孔吸收剂的不同方法的完整说明(他的论文大约有50页,而这仅仅是为了公式参考书!)(Mechel also have a different formula that separates different types of mineral wool. He separates Glass fibers,and mineral fibre (basalt or rock wool), and gives two different expressions for it. It is however given in the book “Acoustic absorbers and diffusers”, and Mechel gives a full account of different ways of calculation porous absorbers in “Formulas of acoustic” (his account is on roughly 50 pages, and that is just intended to be a formula reference book!)) 还有另外两个模型,一个是Attenborough的模型,另一个是Allard和Johnson的模型,但是Allard和Johnson的模型的确在公式中使用了Attenborough的一些结果.这些是相对复杂的模型,在计算介质的属性时会考虑更多参数.我将来可能会重新审视本文,并将其扩展到包括其模型在内.(There are also two more models, one by Attenborough and one by Allard and Johnson, the model of Allard and Johnson do however use some of the results from Attenborough in their formulas. These are relative complex models that take more parameters into account when calculating the properties of the medium. I may revisit this article in the future and expand it to include their model as well.)
怎么做计算(How to do calculations)
实际上,这与计算方程式中使用的多孔材料的系数一样困难.我们需要首先从一些理论开始.(This is actually just as difficult as calculating the coefficients of the porous materials used in the equation. We need to start off with some theory first.) 无限反射表面前面的层将始终具有可以用以下方式表示的表面阻抗:(A layer in front of an infinitely reflecting surface would always have a surface impedance that could be expressed the following way:)
请注意,这里我们谈论的是波数,而不是传播系数(两者的差是传播系数=jk.因此,如果我们具有传播系数,则需要将其乘以-j以获得波数,该波数是令人困惑的是,其本身可能很复杂.)(Take note that we are here talking about the wave number and not the propagation coefficient (the difference is Propagation coefficient = jk. So if we have the propagation coefficient we need to multiply it by -j in order to get the wave number, which, confusingly enough could be complex in itself.)) 一旦获得了这种简单材料的表面阻抗,我们便可以通过计算材料相对于材料前面的空气的反射进行计算:(Once we have the surface impedance of this simple material we would then proceed by calculating the reflections from our material relative to the air in front of the material:)
这代表反射,但是我们对损耗感兴趣,因此我们必须取1-反射波,以找出消耗了多少能量.在声学方面,反射系数是指反射波的幅度,我们希望强度的变化与压力的平方成正比.这称为吸收系数,其计算如下所示:(This represents the reflection, but we are interested in the losses so we must take 1 - the reflected wave to find out how much of the energy is depleted. And in acoustics the reflection factor is meant to be the amplitude of the reflected wave, and we want the changes in intensity, which is proportional to the pressure squared. This is called the absorption factor and is calculated as shown below:)
该公式计算声波的法线入射,这意味着它不考虑在房间中遇到的扩散波.(The formulation calculates the normal incident of a sound wave, meaning that it does not take into account a diffuse waves that are encountered in rooms.)
使用代码(Using the code)
计算吸收系数的代码如下:(The code that calculates the absorptions coefficient are as follows:)
''' <summary>
''' Returns the absorbtion coefficient of a porous absorber in front of a hard wall
''' </summary>
''' <param name="Sigma">Flow resistance in the porous material</param>
''' <param name="ThicknessOfPorousAbsorber">Thickness of the porous material</param>
''' <param name="DelanyBazely">If set to true you
''' use Delaney-Bazley, and if false it uses Mechels approximation</param>
''' <returns>Normal incident absorbtion coefficient</returns>
''' <remarks></remarks>
Public Function CalcualtePorousAbsorption(ByVal Sigma As Double, _
ByVal ThicknessOfPorousAbsorber As Double, ByVal DelanyBazely As Boolean) As OctaveBand
'Store the calcualted result
Dim Result As New OctaveBand
'Speed of sound in air
Dim c As Double = 340
'Mass of air in kg/m^3
Dim rho As Double = 1.21
'Caracteristic impedance of air
Dim z0 As Double
z0 = c * rho
For i As Integer = 0 To Result.Count - 1
'Center frequency of Octave band
Dim f As Double = Result.Okt13(i)
Dim MaterialProperties As New SimpleMaterialPropertiesHolder
If DelanyBazely Then
MaterialProperties = Acoustics.Materials.DelanyBazely(f, Sigma)
Else
MaterialProperties = Acoustics.Materials.MechelGrundmann(f, Sigma)
End If
'Calculate the surface impedance
Dim z As New Complex(0, -1)
z *= MaterialProperties.CharacteristicImpedance / _
Complex.Tan(MaterialProperties.PropagationCoeficcient * z * ThicknessOfPorousAbsorber)
'Calculate the reflection coefficient relative to the main propagation material
Dim ReflectionCoefficient As New Complex
ReflectionCoefficient = (z - z0) / (z + z0)
'Calculate the absorbtioncoefficient and store it
Result.Item(i) = 1 - (Complex.Abs(ReflectionCoefficient)) ^ 2
Next
Return Result
End Function
这样就完成了应用程序.(And that completes the application.)
历史(History)
- 2012年10月12日-初始版本.(12.10.2012 - Initial release.) 如果您看一下两种不同类型的计算方法,即在硬质材料支持下的多孔材料层的吸收,除低频范围外,不会有太大差异.通常认为Delany-Bazley在250 Hz及以上的频率范围内有效,因此通常建议改用Mechels公式.(If you take a look at the two different types of calculation the absorption from a layer of porous material backed by a hard wall, you don’t see much difference, except at the low frequency range. Normally Delany-Bazley are considered valid from 250 Hz and above, so it’s normally always advisable to use Mechels formula instead.)
参考文献(References)
我在这里列出的书对我的描述提供了很好的解释,如果您想了解更多的话,也可以作为进一步的参考.它们按照我在本文中使用它们的顺序列出.(The books I list here offers a good explanation of what I describe, and are good further references if you want to know more. They are listed in the order of how much I have used them in the article.)
- “建筑声学”(“Building acoustics”),第一版(2008),Tor Erik Vigran,CRC出版社(, First edition (2008), Tor Erik Vigran, CRC Press)
- “吸声器和扩散器-理论,设计和应用”(“Acoustic Absorbers and diffuseres - Theory, design, and application”),第二版(2009),Trevor J. Cox和Peter D’Antonio,Taylor&Francis.(, Second edition (2009), Trevor J. Cox and Peter D’Antonio, Taylor & Francis.)
- <声学公式>,第二版,F.P.梅切尔(Springer)(“Formulas of Acoustics”, 2nd Edition, F.P. Mechel, Springer)
- “声学基础”(“Fundementals of Acoustics”),第四版,金斯勒,弗雷,科本斯和桑德斯,约翰`威利父子公司(, Fourth edition, Kinsler, Frey, Coppens and Sanders, John Wiley & Sons, Inc.)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
VB.NET VB VS2010 Visual-Studio 新闻 翻译