Skip to content
32 changes: 32 additions & 0 deletions pyrato/parametric.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,38 @@
"""
import numpy as np

def schroeder_frequency(volume, reverberation_time):
r"""
Calculate the Schroeder cut-off frequency of a room.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the source - the citation is broken

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice hint, but we don´t know how ... seems as broken as for energy_decay_curve_analytic function below.

Calculation according to [#]_.

.. math::

f_s = 2000 \sqrt{\left(\frac{T}{V}\right)}

Parameters
----------
volume : double, np.ndarray
room volume in m^3
reverberation_time : double, np.ndarray
reverberation time in s

Returns
-------
schroeder_frequency : float, np.ndarray
schroeder frequency in Hz

References
----------
.. [#] H. Kuttruff, Room acoustics, 4th Ed. Taylor & Francis, 2009.

"""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can do a validation check of the input parameters. For example, the volume needs to be greater than zero. 🔢

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here we could raise error, if the input parameters of the function are not valid. See the Guidelines

schroeder_frequency = 2000*np.sqrt(reverberation_time / volume)

return schroeder_frequency

def energy_decay_curve_analytic(
surfaces, alphas, volume, times, source=None,
receiver=None, method='eyring', c=343.4, frequency=None,
Expand Down