游戏中的声音-客房(译文)
By robot-v1.0
本文链接 https://www.kyfws.com/games/sound-in-games-rooms-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 20 分钟阅读 - 9594 个词 阅读量 0游戏中的声音-客房(译文)
原文地址:https://www.codeproject.com/Articles/416509/Sound-in-games-Rooms
原文作者:Kenneth Haugland
译文由本站 robot-v1.0 翻译
前言
How to calculate a reverbration time in a room
如何计算房间的混响时间
- 下载WpfReverberationTime-noexe.zip-64 KB(Download WpfReverberationTime-noexe.zip - 64 KB)
- 下载WpfReverberationTime.zip-403.9 KB(Download WpfReverberationTime.zip - 403.9 KB)
介绍(Introduction)
如今,大多数与动作相关的游戏通常都采用某种算法来计算房间,隧道或其他封闭空间中的声音反射.有几种方法可以实现对房间中发生的声音的这种修改,但是我将向您展示使用古典理论向您展示声学家如何看待房间的几种最简单的方法.(Most of the action related games today usually implement some kind of algorithm for calculation of the sound reflections in either a room or tunnel or other enclosed spaces. There are several ways to implement this modification of the sound that will occur in a room, but I am going to show you a couple of the simplest ways using classical theory to show you how acousticians see a room.) 模拟房间中的声音非常重要,因为我们会根据听到的声音对所处的空间做出许多假设.为了真实再现声音,我们需要对声压进行一些修改,在这里实际的声音起着重要作用.(The sound in a room is quite important to simulate, as we make many assumptions about the space we are in by what we hear. For a realistic reproduction of the sound, we need to implement some modifications to the sound pressure, and here the actual acoustics plays a part.) 如果您可以选择表面元素,则本文后面的程序将计算矩形房间的混响时间.(The program that follows this article calculates the reverberation time of a rectangular room, were you can choose the surface elements.)
混响(Reverberation)
我将通过以下方式来解释混响:如果您站在山谷中,在平坦的山峰上尖叫,您会听到回声,因为声音将从您的嘴传播到平坦的墙壁,然后反射回去.到你的耳朵.您在房间中听不到声音的原因是,天花板和墙壁的反射非常紧密,以至于您仅假设回声是声音的一部分.在吉他,钢琴,鼓等乐器中也存在这种情况,因为即使您停止弦中的振动,它们也会在发出声音后很长时间发出声音.(I am going to explain reverberation in the following way: If you stand in a valley and scream at a mountain with a reasonably flat surface, you would hear an echo, as the sound will travel from your mouth to the flat wall, and reflect back to your ears. The reason that you don’t hear it in a room is that the reflections from the ceiling floor and walls are so close together that you just assume that the echo is part of the voice. This is also present in instruments as for instance guitar, piano, drums, and so on, as they give off sound long after the tone is initiated even if you stop the vibration in the strings.)
首先考虑混响时间的是美国物理学家W. C. Sabine,他在1900年的文章中概述了下面给出的一般方程式的结果(其中w是能源,V是体积,W(The first to consider the reverberation time was the American physicist W. C. Sabine, his article in 1900 outlined the result of the general equation given below (were w is the source energy, V is the Volume, and W)腹肌(abs)是房间的吸收量):(is the absorption in the room):)
与所有方程式一样,乍一看似乎很困难,但实际上这很简单.它只是说,来自我们的源(扬声器,汽车声音或在封闭的房间中发出声音的任何东西)的能量等于房间中平均分配的瞬时能量,加上从我们的表面吸收的能量(来自室内的回声减少了).墙壁,天花板或地板).吸收实际上是声音在一次反射中按比例逐渐衰减(类似于(As with all equations, it seems rather difficult at first, but this one is actually quite simple. It simply says, the energy from our source (loudspeaker, car voice or anything that makes a sound in the enclosed room) is equal to the momentary energy equally distributed in the room, plus the energy absorbed from our surfaces (the reduced echo from the walls, ceiling or floor). Absorption is actually the procentwise decay of sound from one reflection (similar to) 斯内尔(Snell) 的光反射定律(吸收除外)描述了反射波中的能量损失),通常以0-1.0之间的系数给出.在公式中要考虑的最重要方面是,根据房间内各处的Sabine方程,声能相等.(’s reflection law for light, except absorption describes the loss of energy in the reflected wave), and is usually given as a factor between 0 - 1.0. The most important aspect to contemplate in the formula, is that the sound energy according to Sabine’s equation is equal everywhere in the room.)
在开发方程式时,我们将跳过许多细节以使用一些东西.总的来说,我们假设所有到达墙壁的声能都将以平面波的形式出现,并在此假设下转换一般方程式得出p(We will skip a lot of the details in developing the equation to something we can use. In general we assume that all the sound energy that would reach the walls, would take the form of a plan wave, and transforming the general equation with this assumption gives the p)2(2)在任何给定时间的价值.结果是下面的等式(value at any given time. The result is this equation below (were rho)0(0)是空气的重量,在这种情况下(1.21 kg/m(is the weight of air, in this case (1.21 kg/m)3(3))和C(), and C)0(0)是空气中的声音速度(343 m/s),A =表面积吸收系数,V是房间的体积,t是时间.这适用于本文中给出的所有公式):(is the speed of sound in air (343 m/s) and A = Surface area Absorption coefficient, and V is the Volume of the room, and t is the time. This applies for all the formulas given in the article):)
Sabine公式中的吸收面积是根据以下公式计算的(S是表面积,而alfa是材料的吸收系数):(The absorption area in Sabine’s formula is calculated from the equation below (were S is the surface area and alfa is the absorption coefficient for the material):)
A =S(A = S)1个(1)α(α)1个(1)+ S(+ S)2(2)α(α)2(2)+ … + S(+ … + S)ñ(n)α(α)ñ(n)=∑ S(= ∑ S)一世(i)α(α)一世(i)
混响时间可以从该方程式推断出来.如果我们设置一个持续为我们提供已知效果的信号源并将其关闭,即在t =0时将w =0设置为关闭,则可以计算自关闭信号源以来的声压,如下所示:(The reverberation time could be extrapolated from this equation. If we set up a source that continually supplies us with a know effect and turn it off, that is set w = 0 at t=0, we can calculate the sound pressure since the time we switch off the source like this:)
但是,正如Sabine定义的混响时间一样,我们只是对声场衰减60 dB所需的时间感兴趣,而这实际上与声源无关.因此,混响时间的公式可以这样设置:(We are however only, as Sabine defined the reverberation time, interested in how long the soundfield takes to decay with 60 dB, and this is actually independent of the sound source. So the formula for reverberation time could the be set like this:)
毫不奇怪,该微分方程可以通过使用数字e来求解.作为本文的附注,此数字出现在许多解决方案中,因为数字e(Not surprisingly, this differential equation could be solved by using the number e. As a side note in the article this number appears in many solutions, because the number e)X(x)是它自己的导数和积分,可以通过下面的简单公式使用从0到x的无界积分来表示(我在其他任何地方都没有看到它写成这样):(is its own derivative and integrant, which can be shown by the simple formula below using nonbounded integral from 0 to x (I have not seen it written like this anywhere else though):)
在对该理论进行了多次修改之后不久,Eyring-Norris(尽管Schuster和Waetzmann独立地找到了结果)是基于这样的观念,即声波在撞到墙壁之前将具有平均传播距离.这意味着射线形式的波平均会在反射之间传播一段距离.这很容易解释.如果将激光放在墙壁,天花板或地板的任意点上,并沿随机方向发射许多光线,则激光撞击表面之前的平均长度就是房间中的平均距离.然而,在室内声学中,我们对每秒的反射次数更感兴趣,这可以通过以下公式找到:c是声速L(Shortly after a number of revisions to the theory came, and Eyring-Norris (although Schuster and Waetzmann found the result independently) is based on the notion that a sound wave would have an average distance to travel before it hits a wall. That means that a wave in the form of a ray, would on average travel a distance between the reflections. This could easily be explained. If you place a laser light at any point wall, ceiling, or floor, and shoot many rays in a random direction, the average length before the laser light hits a surface would be the mean distance in the room. In room acoustics we are however more interested in the number of reflections per second, and this could be found by the formula below, were c is the speed of sound, L)ñ(n)是矩形房间中x,y和z方向的长度,V是房间中的总体积(两个不同的公式使用不同的技术得出,但得出的结果相同):(is the length of x, y, and z direction in a rectangular room, and V is the total volume in the room (the two different formulas are derived using different techniques but they yield the same result):)
利用这些信息,我们可以轻松地找到每个时间单位的反射次数,从而找到混响场衰减率的函数.该方程式的发展类似于以下方程式(一个小小的注解是(With this information we can easily find the number of reflections per time unit and thus a function for the decay rate of a reverberation field. The equation is developed like the one below (one small remark is that the)alpha是下式中的平均吸收系数,可以表示为(alpha is the average absorption coefficient in the formula below, and can be formulated as a)α(alpha)=A/S(= A / S)**)()):(:)
墙壁上的平均吸收如下计算:(With the average absorption on the walls calculated like this:)
这实际上与Sabine的方程式非常相似,不同之处在于,由于入射天使而不是平面波的影响,α值要大一些.如果采用吸收函数的级数展开,则更清楚:(This is actually quite similar to Sabine’s equation, except that that alpha is a little bigger due to the incident angels instead of the plan wave. This is more clear if we take the series expansion of the absorption function:)
但是,Eyring-Norris的问题在于入射角在整个房间内扩散,如果某些表面上某些部分的吸收系数非常不同,这可能是个问题. Millington-Sette就是采用Eyring-Norris公式并将其应用于较小部分的修改方式. Millington-Sette给出以下表达式:(But the problem with Eyring-Norris is that the incident angle is diffuse over the entire room, this could be a problem if the absorption coefficient on some of the surfaces is very different on some sections. The is is way Millington-Sette made the modification that you take Eyring-Norris formula and apply it to smaller sections. Millington-Sette gives the following expression:)
对于h的相对湿度,有一个简单的公式适用于1.5到10 kHz,h为相对湿度(20-70%之间有效)i%,f为频率.近似公式如下:(There is a simple formula for the annutation coefficient that is valid between 1.5 to 10 kHz, were h is relative humidity (valid between 20 - 70 %) i percent and f is frequency. The approximate formula is given below:)
ISO 9613-2中给出了在空气中进行环化的确切公式,可以查看(The exact formula for the annutation in air is given in ISO 9613-2 and it can be view) 这里(here) .(.)
它们与混响公式结合在一起,因为空气流通只是另一个吸收系数.萨宾经修正方程式的结果:(They are coupled together with the formulas for reverberation, as air annutation is just another absorption coefficient. The resulting in the modified equations for Sabine:)
Eyring-Norris:(Eyring-Norris:)
Millington-Sette:(Millington-Sette:)
这些混响公式的问题在于它们不是绝对正确的.您会看到为什么当您看到背后的假设是什么样的假设.主要问题之一是您可能在房间的各个方向产生驻波,这导致与上述三个公式中任何一个计算出的混响时间有所不同.尝试解决这种情况的一种方法是Frizroy的方程,该方程基于计算不同方向上的混响时间并将其平均.他提出的公式如下:(The problem with these reverberation formulas is that they are not absolutely correct. You can see why when you see what kind of assumptions that lay behind the development of them. One of the main problems is that you could have standing waves in a room in all the directions, and this leads to a different perceived reverberation time than you would have calculated by any of the three formulas above. One method to try and remedy the situation is the equation by Frizroy, who is based on calculation the reverberation time in the different directions and average them. His proposed a formula looks like this:)
一个具有空气吸收量的近似公式(如果进行数学计算,您会发现它不准确,但通常也不太差):(An approximate formula with air absorption (if you do the math you’ll see that it is not accurate but its usually not too bad either):)
近年来,还有其他一些公式(此处未给出)也试图捕获不同方向上的不同混响时间.但是除非考虑到散射,否则您将无法获得正确的混响时间曲线.你可以看到(In recent years there has been several other formulas (which are not given here) that also tries to capture the different reverberation times in the different directions. But unless you take scattering into account you won’t get the correct reverberation time curve. You can see the) 视频(video) Jens Holger Rindel(声学软件Odeon的开发商之一)对其中的一些解释很好.(were some of it is explained quite good by Jens Holger Rindel (one of the developers behind the acoustic software Odeon).) 他解释说,除其他因素外,某些房间的衰减率在取指数衰减的对数后将不是直线.在某些情况下,您可以得到指数衰减.这是由于在x,y和z方向上的平行壁.如果混响时间变化很大,则声能将在吸收最低的方向上停留更长的时间.如果您想象有一个平面波朝向墙壁,由于散射,一些能量会在另外两个方向反射.因此,混响时间曲线受混响时间低的方向与混响时间高的方向之间的耦合影响最大,并且这将在整个混响时间曲线上发生,因为方向在整个混响时间曲线上具有无限多的耦合平行壁时间(这类似于有关耦合房间的问题).(He explains among other things, that the decay rate in some rooms would not be a straight line after taking the logarithm of the exponential decay. You can in some circumstances get an exponential decay. This is due to the parallel walls in the x, y, and z direction. If the reverberation time varies much the sound energy would stay longer in the direction with the lowest absorption. If you imagine a plan wave coming towards a wall, some of the energy would be reflected in the two other directions due to scattering. The reverberation time curve would thus be effected most by the coupling between the directions with low reverberation time to the direction with the high reverberation time, and this would happen over the entire reverberation time curve, as the directions would have infinite many coupled parallel walls over time (this is similar to the problems regarding coupled rooms).) 但是,混响场的计算仅限于测得的吸收系数的精度,并且可能会变化+/- 5%.因此,即使我们有完美的混响时间公式,也没关系.顺便说一句,对于所有物理预测模型都是如此,因为它很大程度上取决于输入的准确度-或GIGO(垃圾输出).(However, the calculation of the reverberation field is limited to the accuracy of the measured absorption coefficient, and that can vary as much as +/- 5%. So even if we had the perfect formula for reverberation time it wouldn’t matter. This is by the way true for all physical prediction models as it depends strongly on the accuracy of the input - or GIGO (garbage in garbage out).) 下面的代码给出了以上所有公式的实现:(The implementation of all the formulas above is given in the code below:)
Dim FullOctaveBand() As String
Dim OctaveBandString As String = "31,63,125,250,500,1000,2000,4000,8000,16000"
FullOctaveBand = OctaveBandString.Split(",")
If Not _lstXAbsorbers.Count = 0 And Not _lstYAbsorbers.Count = 0 _
And Not _lstZAbsorbers.Count = 0 Then
TotalSufraceArea = _TotalSurfaceArea
Humidity = CInt(txtHumidityRoom.Text)
Sabine.Name = "Sabine"
Eyring.Name = "Eyring"
Miller.Name = "Millington-Sette"
Fritzroy.Name = "Fritzroy"
Volume = _Height * _Length * _Width
For i As Integer = 0 To Sabine.Count - 1
Dim SabineTempZ, SabineTempY, SabineTempX As Double
SabineTempX = 0
SabineTempY = 0
SabineTempZ = 0
Dim EyringTempZ, EyringTempY, EyringTempX As Double
EyringTempZ = 0
EyringTempY = 0
EyringTempX = 0
Dim MillingtonSetteTempZ, MillingtonSetteTempY, MillingtonSetteTempX As Double
MillingtonSetteTempZ = 0
MillingtonSetteTempY = 0
MillingtonSetteTempX = 0
For Each p As Absorber In _lstZAbsorbers
SabineTempZ += p.Area * p.GetItem(i)
EyringTempZ += p.Area * p.GetItem(i) / _TotalSurfaceArea
MillingtonSetteTempZ += p.Area * CalculateAlfa(p.GetItem(i))
Next
For Each p As Absorber In _lstYAbsorbers
SabineTempY += p.Area * p.GetItem(i)
EyringTempY += p.Area * p.GetItem(i) / _TotalSurfaceArea
MillingtonSetteTempY += p.Area * CalculateAlfa(p.GetItem(i))
Next
For Each p As Absorber In _lstXAbsorbers
SabineTempX += p.Area * p.GetItem(i)
EyringTempX += p.Area * p.GetItem(i) / _TotalSurfaceArea
MillingtonSetteTempX += p.Area * CalculateAlfa(p.GetItem(i))
Next
Dim m As Double = 5.5 * 10 ^ (-4) * (50 / Humidity) * _
(CDbl(FullOctaveBand(i)) / 1000) ^ (1.7)
'Calculationg total absorbtion area and air annutaion
Dim AbsorbtionAreaSabine As Double = (SabineTempX + SabineTempY + SabineTempZ) + 4 * m * Volume
Dim AbsorbtionAreaEyring As Double = _TotalSurfaceArea * _
CalculateAlfa(EyringTempX + EyringTempY + EyringTempZ) + 4 * m * Volume
Dim AbsorbtionAreaMillingtonSette As Double = MillingtonSetteTempX + _
MillingtonSetteTempY + MillingtonSetteTempZ + 4 * m * Volume
Dim FritzroyTempZ, FritzroyTempY, FritzroyTempX As Double
FritzroyTempX = CDbl(lblXrea.Content) / (CalculateAlfa(EyringTempX) + _
(4 * m * Volume / 3) * (CDbl(lblXrea.Content) / _TotalSurfaceArea ^ 2))
FritzroyTempY = CDbl(lblYrea.Content) / (CalculateAlfa(EyringTempY) + _
(4 * m * Volume / 3) * (CDbl(lblYrea.Content) / _TotalSurfaceArea ^ 2))
FritzroyTempZ = CDbl(lblZarea.Content) / (CalculateAlfa(EyringTempZ) + _
(4 * m * Volume / 3) * (CDbl(lblZarea.Content) / _TotalSurfaceArea ^ 2))
Sabine.SetItem(i, ReverberationTime(AbsorbtionAreaSabine))
Eyring.SetItem(i, ReverberationTime(AbsorbtionAreaEyring))
Miller.SetItem(i, ReverberationTime(AbsorbtionAreaMillingtonSette))
Fritzroy.SetItem(i, (0.16 * Volume / (_TotalSurfaceArea ^ 2)) * _
(FritzroyTempX + FritzroyTempY + FritzroyTempZ))
Next
Dim AverageReverberationTimeSabine As Double
AverageReverberationTimeSabine = 0
For i As Integer = 0 To Sabine.Count - 1
AverageReverberationTimeSabine += Sabine.GetItem(i) / Sabine.Count
Next
'Calculate the Schroeder frequency based on Sabine
Schroeder = 2000 * Math.Sqrt(AverageReverberationTimeSabine / Volume)
'Room radius is calculated besed on a omnidirectional source, meaning D = 1
RoomRadius = Math.Sqrt(55.26 * Volume / (16 * Math.PI * C0 * AverageReverberationTimeSabine))
lblSchroder.Content = Math.Round(Schroeder, 0).ToString
lblRoomRadius.Content = Math.Round(RoomRadius, 2).ToString
_lstResult2.Add(Sabine)
_lstResult2.Add(Eyring)
_lstResult2.Add(Miller)
_lstResult2.Add(Fritzroy)
lstResult.ItemsSource = _lstResult2
For Each p As Absorber In _lstResult2
PlotReverbrationTime(p, False)
Next
Else
MessageBox.Show("missing absorbers")
End If
对公式的评论(Comments on the formulas)
关于得出的结果,尤其是关于该理论的局限性,有几点评论.假设房间中的所有点都具有完全相同的能量,这被用来表示吸收表面在房间中的位置并不重要.(There are several comments to be given in relation to the result that is derived, and especially with regards to the limitations of the theory. The assumption was that all the points in the room had the exact same energy, which was used to formulate that it didn’t matter where in the room the absorbing surfaces were.)
实际上,电路理论有一个简单的类比.可以将房间建模为一个简单的电容器,因此可以将一个房间中的吸收作为一个简单的电阻器,并将来自窗户,门等狭缝的泄漏建模为一个电感器.显然,“正常"房间将表现为带通滤波器,其系数取决于边界的声学特性和房间的几何形状.这意味着我们可以根据电容器上的电荷来模拟房间中的能量:(There is actually a simple analogy from electrical circuit theory. The room can be modeled as a simple capacitor, and thus the absorption in a room as a simple resistor and the leakage from slits like a window, doors etc could be modeled as a inductor. It is evident that a “normal” room would behave as a bandpass filter with coefficient dependent on the acoustic properties of the boundaries and the geometry of the room. This means that we could model the energy in a room, based on the charge over a capacitor:)
在充放电之间可以找到稳态条件,在房间中也是如此.在电容器类比中,混响时间的计算与电容器中的放电相同.但是,电容器的电荷在室内声学上也等效,这称为早期衰减时间(EDT).在电容器和房间之间执行的类比中缺少几件事.一种是直接声音,即声音和听众之间的最短路径是声音的稳态是三种不同现象的组合,即DirectSound,EDT和最后的混响时间,而电容器仅是充电和放电的组合.而且3D耦合壁在单个电容器中也不是唯一的百分比.因此,下图显示了一个脉冲响应的平方,该脉冲响应以不同的颜色标记了不同的区域:(The steady state condition could be found between the charge and discharge, as is also true in a room. In the capacitor analogy reverberation time calculations is the same as the discharge in a capacitor. However the charge of the capacitor has also it’s equivalent in room acoustics, and it’s called early decay time (EDT). There are a couple of things missing from the analogy that is performed between the capacitor and a room. One is the direct sound, i.a. the shortest path between the listener and the source, the other is that the steady state in acoustics is a combination of three different phenomena, namely DirectSound, EDT and at last the reverberation time, while the capacitor is a combination of charge and discharge only. And 3D coupled walls is also not percent in a single capacitor. So the simulation of an impulse response squared with the different regions marked by different color is shown in the picture below:)
在傅立叶分析中,房间节点或特征值通常用于声学,以解释声压如何在房间中分布.问题在于,墙壁是这种假设的来源,与推导Sabines方程中的混响时间所用的假设相同,因此无法在任意放置来源的房间中为您提供正确的声压值.(In Fourier analysis, the room nodes or eigenvalues, are often used to acoustics to explain how the sound pressure is distributed through the room. The problem is that the walls are the sources with this assumtion, the same assumtion that was used to derive the reverberation time in Sabines equation, and would thereby not give you the correct values of sound pressure in a room with an arbitrary placement of the source.) 但是,通过同时改变源和麦克风的位置来解释房间中墙壁的影响以及房间中几个测量点的平均值.这实际上是已知信息,并且Waterhouse根据该假设计算了一个公式,因为由于低频节点的影响,必须固定低频处的声压.(The do however explain the influence of the walls in a room with the averaging of several measurement points in a room, were both the source and microphone position is varied. This is actually known information, and the Waterhouse calculated a formula based on the assumption, as the sound pressure at the low frequencies have to be fixed due to the influence of the low frequency nodes.) 到目前为止,本文仅说明房间声音的混响部分中发生的情况.直接声音相对容易在游戏中实现,因为它是源与接收器之间的直接距离或最短距离.如果要模拟房间中的声场,则早期反射非常重要,因为大多数感知的空间信息都在此处收集.通常使用"图像"源或"镜像"源来模拟此部分.通常,最重要的信息来自直接声音后的0到80 ms,EDT在标准中定义为自第一次反射起10 dB的衰减. (在测量中,它被定义为从最高的-0.1 dB到-10.1 dB,因为人们试图不包括直接声音的影响.)(Up to this point the article only explains what happens in the reverberation section of the sound in the room. The direct sound is relatively easy to implement in a game, as it is the direct or shortest distance between source and receiver. The early reflections are very important if you want to simulate a sound field in a room, as most of the perceived spatial information is picked up here. This part is usually simulated with Image sources, or mirror sources. Normally the most important information comes from 0 to 80 ms after the direct sound, and EDT is defined in standards as the 10 dB decay from the first reflection. (In measurement it is defined as from the top -0.1 dB to -10.1 dB, as one tries to not include the effect of the direct sound.)) 因此,如果我们无法准确找到声压,可以使用哪些技术?事实证明,唯一可以完全准确预测声场的技术是传输线模型(TLM)或等效的时差有限差分法(FDTD),但是计算时间直接取决于频率,因此并不依赖于频率可行的(So if we cant find the sound pressure exactly what techniques could we use? Well as it turns out the only technique that could predict the sound field completely accurate is the Transmission Line Model (TLM) or the equivalent Finite Difference Time Dependent (FDTD), but the calculation time is directly dependent on frequency, and it is therefore not a viable)技术(technique)用于实时过程.(for real time processes.) 几何声学是房间声学顾问使用的分析工具,这是一种结合了射线和图像源的混合解决方案.使用的程序示例为:(Geometrical acoustics is the analytic tool used by room acoustic consultants, and this is a hybrid solution with a combination of rays and image sources. Examples of programs used are:)
- Odeon(Odeon)
- 卡特(Catt) 这些是我所知道的仅有的两个,可能还有其他人提供商业程序.他们预测在中高频时声压相当好,但在低频时声压不佳.这是因为在低频时,声音不会像射线那样四处移动,而更像是平面波.在射线变换有效的频率下,可以使用Schroeder频率进行估算.这就是说,当我们的声压是分散的,因此低于此频率时,我们可以预期声压将由边界生成的节点主导.(Those are the only two I know of and there might be other who offer commercial programs. They predict the sound pressure quite good at medium and high frequencies, but fail at the lower frequencies. This is becouse at low frequencies the sound don’t move around as rays but more as plane waves. At the frequency were the ray transformation is valid, can be estimated using the Schroeder frequency. This says when our sound pressure is diffuse, and thus below this frequency we could expect the sound pressure to be dominated by the nodes generated by the boundaries.) 但是,从这些程序中获得的信息在很多情况下对于粗略估计衰减曲线所需的信息来说是一个过大的矫kill过正,这在大多数情况下听起来是可以相信的. (这并不是说不需要它们,因为它们是必需的.通常在某些情况下,您将花费数百万美元来建造一个交响音乐厅,巨大的演讲厅,剧院,歌剧院等,只是发现声音使印象混乱,使听众/学生感到混乱.光线追踪/图像源(However the information you’ll get out of these programs is in many circumstances is a huge overkill for what is needed to roughly estimate a decay curve, that would sound believable in most cases. (This is not to say that they are not needed, because they are. Mostly in situations were you are going to spend millions of dollars constructing a symphony hall, huge lecture hall, theater, opera house etc., only to find out that the sound is messing up the impression leaving the audience/students in disarray. The ray tracing/image source)技术(technique)通常对我们的听力最敏感的频率也非常可靠.)(is usually also very reliable for frequencies were our hearing is most sensitive.))
听觉化(Auralization)
可听见的名字直接来自可视化,但是声音不可见但可听见,因此可听见的名字.但是,它确实需要大量处理才能将计算出的混响时间转换为可用于在房间内人工创建声音的时间.(The name auralization derives directly from visualization, but sound is not visible but audible, therefore the name Auralization. It does however require quite a lot of processing to translate the calculated reverberation time into something the could be used to artificially create the sound in a room.) 要创建合理的音频,您需要制作一个1/3倍频带滤波器,该滤波器可以在31.5 Hz-16000 Hz的范围内应用(该程序仅计算整个倍频带,但是通常可以将其插值到覆盖1/3个八度频带.例外是另一种窄的Helmholt吸收器.这不是直接的,需要了解DSP(数字信号处理)和滤波器设计的知识.如下所示,可以为房间创建伪脉冲响应:(To create an audio of reasonable you need ot make an 1/3 octave band filter, that could be applied in the range from 31.5 Hz - 16 000 Hz (the program only calculates the full octave bands, but values can be usually be interpolated to cover 1/3 octaveband. The exception would be different kind of narrow Helmholt absorbers). This is not straightforward and requires knowledge of DSP (Digital signal processing) and filter design. A pseudo impulse response for rooms could be created as suggested below:)
- 获得足够长的白噪声信号(在大多数情况下,大约4秒或更多的时间就足够了.(我假设该值的范围是1到-1,并且我知道wav文件没有该值)(Get a white noise signal with sufficient length (approximately 4 seconds or more should be enough in most circumstances. (I will assume that this has values from 1 to -1, and I know wav files do not have that))
- 在所有八度频带中过滤信号并存储.(Filter the signal in all octave bands and store it.)
- 将滤波后的信号乘以p(t)方程(或更确切地说,将e(Multiply the filtered signal by p(t) equation (or rather the e)-xt(-xt)信号)-10 dB. p(t)将在不同的混响时间公式中找到.(signal) -10 dB. p(t) would be found in the different reverberation time formulas.)
- 在开头添加直接声音,值为1(直接声音和混响场之间的延迟大约60-80毫秒会使它听起来更自然,甚至更好,甚至可以计算直接声音和混响场之间的声音使用图片来源).(Add the direct sound at the beginning with the value 1 (a delay of about 60 - 80 ms between the direct sound and the reverberation field would make it sound more natural, or better even to calculate the sound between the direct sound and the reverberation field using image sources).)
- 提取您想要在游戏中播放的声音(无反射),并使用建议的滤波器对其进行卷积处理.(Take the sound (without reflections) that you want to play in the game and convolute this with the proposed filter.) 您可能已经猜到了,让游戏听起来自然很困难,而且我知道在某些情况下不建议使用这种算法,例如在走廊,室外或没有混响场的其他区域(查看推导方程式时设定的前提条件.(As you by now probably have guessed, making a game sound natural is quite a task, and I know that there are instances were this algorithm won’t be advisable, as in corridors, outdoor or other areas that do not have a reverberant field (look at the pre-conditions that was set when deriving the equations).) 直接使用该软件之前,请多加警告.我不能保证excel文件中提供的吸收系数是正确的,尽管它们对我来说似乎是合理的假设.但是,您可以再次将所有可以想到的项目添加到excel文件中(或查找其他位置),因此从这个意义上讲没有问题.(A bit of warning before you use the software directly. I won’t guarantee that the absorption coefficient supplied in the excel-file are correct, though they look like reasonable assumptions to me. But then again you can add all the items in the excel file that you could think of (or find other places), so there is no problem in that sense.)
历史(History)
第一版31.07.2012(First relase 31.07.2012) 该计划包括:(The program includes:)
- 混响时间的计算(四种不同的算法)(Calculation of reverberation time (four different algorithms))
- 从可编辑的Excel文件中以完整的八度音阶加载吸收数据(Loading absorption data in full octave band from an editable Excel file)
参考文献(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.)
-
“建筑声学”(“Building acoustics”),第一版(2008),Tor Erik Vigran,CRC出版社(, First edition (2008), Tor Erik Vigran, CRC Press)
-
“听觉化-声学,建模,模拟,算法和声学虚拟现实的基础知识”(“Auralization - Fundamentals of Acoustics, Modelling, Simulation, Algorithms and Acoustic Virtual Reality”),第一版(2008),迈克尔`弗兰德(Michael Vorlander),施普林格(Springer).(, First edition (2008), Michael Vorlander, Springer.)
-
“房间声学”(“Room Acoustics”),第五版(2009),亨里希`库特鲁夫(Henrich Kuttruff),Spon出版社.(, Fifth edition (2009), Henrich Kuttruff, Spon Press.)
-
“声学基础”(“Fundementals of Acoustics”),第四版,金斯勒,弗雷,科本斯和桑德斯,约翰`威利父子公司(, Fourth edition, Kinsler, Frey, Coppens and Sanders, John Wiley & Sons, Inc.) 有一本书只涉及材料的反射和吸收,如果您想知道如何处理理论计算,则应严格阅读以下内容:(There is a book that just deals with reflections and absorption of materials, and if you want to know how to deal with theoretical calculations you should defiantly read this:)
-
“吸声和扩散器-理论,设计和应用”(“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.) 在这里可以找到不同混响时间公式的简短历史:(A short history of different reverberation time formulas could be found here:)
-
http://sound.eti.pg.gda.pl/papers/prediction_of_reverberation_time.pdf(http://sound.eti.pg.gda.pl/papers/prediction_of_reverberation_time.pdf) 其他一些有趣的网站:(Some other interesting sites:)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
VB.NET VB .NET4 .NET4.5 .NET general algorithms mathematics game 新闻 翻译