Skip to content

Commit 69d5842

Browse files
committed
add ISo calculation
1 parent 241121a commit 69d5842

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

imkar/scattering/diffuse.py

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,92 @@ def maximum_baseplate_scattering_coefficient(N: int = 1) -> pf.FrequencyData:
9090
frequencies=np.array(frequencies)/N,
9191
comment="Maximum scattering coefficient of the baseplate",
9292
)
93+
94+
95+
def calculation(
96+
reverberation_times, speed_of_sound,
97+
air_attenuation_coefficient,
98+
volume, surface_sample) -> tuple:
99+
"""
100+
Calculate the diffuse scattering coefficient after ISO 17497-1:2004.
101+
102+
Measurement conditions for the four different reverberation times
103+
and the corresponding speed of sound and air attenuation
104+
coefficients based on Table 2 in ISO 17497-1:2004 [#]_.
105+
106+
+------------------------+-------------+--------------+
107+
| measurement condition | test sample | turntable |
108+
+------------------------+-------------+--------------+
109+
| 1 | not present | not rotating |
110+
+------------------------+-------------+--------------+
111+
| 2 | present | not rotating |
112+
+------------------------+-------------+--------------+
113+
| 3 | not present | rotating |
114+
+------------------------+-------------+--------------+
115+
| 4 | present | rotating |
116+
+------------------------+-------------+--------------+
117+
118+
Parameters
119+
----------
120+
reverberation_times : pf.FrequencyData
121+
The reverberation times in seconds of the measurement conditions of
122+
cshape (..., 4).
123+
speed_of_sound : np.ndarray
124+
is the speed of sound in air, in metres per second (m/s),
125+
during the measurement of each measurement conditions of
126+
shape (..., 4).
127+
air_attenuation_coefficient : pf.FrequencyData
128+
the energy attenuation coefficient of air, in reciprocal metres
129+
(:math:`m^-1`), calculated according to ISO 9613-1,
130+
using the temperature and relative humidity during the measurement
131+
of each measurement conditions of cshape (..., 4).
132+
volume : float
133+
volume of the reverberation room, in cubic metres (:math:`m^3`).
134+
surface_sample : float
135+
is the area of the test sample, in square metres (:math:`m^2`).
136+
137+
Returns
138+
-------
139+
scattering : pf.FrequencyData
140+
The random-incidence scattering coefficient.
141+
s_base : pf.FrequencyData
142+
The base plate scattering coefficient.
143+
alpha_s : pf.FrequencyData
144+
The random-incidence absorption coefficient.
145+
alpha_spec : pf.FrequencyData
146+
The random-incidence specular absorption coefficient.
147+
148+
References
149+
----------
150+
.. [#] ISO 17497-1:2004, Sound-scattering properties of surfaces. Part 1:
151+
Measurement of the random-incidence scattering coefficient in a
152+
reverberation room. Geneva, Switzerland: International Organization
153+
for Standards, 2004.
154+
"""
155+
T_1 = reverberation_times[..., 0]
156+
T_2 = reverberation_times[..., 1]
157+
T_3 = reverberation_times[..., 2]
158+
T_4 = reverberation_times[..., 3]
159+
c_1 = speed_of_sound[..., 0]
160+
c_2 = speed_of_sound[..., 1]
161+
c_3 = speed_of_sound[..., 2]
162+
c_4 = speed_of_sound[..., 3]
163+
m_1 = air_attenuation_coefficient[..., 0]
164+
m_2 = air_attenuation_coefficient[..., 1]
165+
m_3 = air_attenuation_coefficient[..., 2]
166+
m_4 = air_attenuation_coefficient[..., 3]
167+
V = volume
168+
S = surface_sample
169+
170+
# random incident absorption coefficient
171+
alpha_s = 55.3 * V/S * (1/(c_2*T_2) - 1/(c_1*T_1)) - 4*V/S * (m_2-m_1)
172+
173+
# specular absorption coefficient
174+
alpha_spec = 55.3 * V/S * (1/(c_4*T_4) - 1/(c_3*T_3)) - 4*V/S * (m_4-m_3)
175+
176+
# calculate scattering coefficient
177+
scattering = (alpha_spec - alpha_s) / (1 - alpha_s)
178+
179+
s_base = 55.3*V/S*(1/(c_3*T_3) - 1/(c_1*T_1)) - 4*V/S*(m_3-m_1)
180+
181+
return scattering, s_base, alpha_s, alpha_spec

0 commit comments

Comments
 (0)