-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from nuniz/calculate_rtx
Calculate rtx
- Loading branch information
Showing
9 changed files
with
239 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/mirrors-clang-format | ||
rev: v17.0.6 | ||
hooks: | ||
- id: clang-format | ||
# Using this mirror lets us use mypyc-compiled black, which is about 2x faster | ||
- repo: https://github.com/psf/black-pre-commit-mirror | ||
rev: 23.12.1 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.13.2 | ||
hooks: | ||
- id: isort | ||
args: | ||
- --profile=black |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,4 +24,5 @@ | |
""" | ||
|
||
from .estimation import BlindRT60 | ||
from .utils import calculate_decay_time | ||
from .version import __version__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import numpy as np | ||
|
||
|
||
def calculate_decay_time(decay_db: float, tau: float) -> float: | ||
""" | ||
Calculates the decay time of a signal based on its decay in decibels (dB) and the time constant (tau). | ||
decay_time = -decay_db / (20 * log10(e)) * tau | ||
Parameters: | ||
- decay_db (float): The decay of the signal in decibels (dB). Positive values indicate | ||
attenuation, while negative values indicate amplification. | ||
- tau (float): The time constant of the system, which represents the time it takes for | ||
the signal to decay to 1/e (approximately 36.8%) of its initial value. | ||
- e (float, optional): The mathematical constant e (approximately 2.71828). Defaults | ||
to `np.e` for efficiency (already imported with `numpy`). | ||
Returns: | ||
float: The calculated decay time in the same units as `tau` (typically seconds, milliseconds, etc.). | ||
Raises: | ||
ValueError: If `decay_db` is not a finite number (i.e., NaN or Inf). | ||
""" | ||
|
||
if not np.isfinite(decay_db): | ||
raise ValueError("decay_db must be a finite number (not NaN or Inf).") | ||
|
||
decay_time = -decay_db / (20 * np.log10(np.e**-1)) * tau | ||
return decay_time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# blind_rt60 version | ||
__version__ = '0.1.0-a0' | ||
__version__ = "0.1.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"cells": [ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,29 +5,27 @@ | |
|
||
setuptools.setup( | ||
name="blind_rt60", | ||
version="0.1.0-a0", | ||
version="0.1.1", | ||
author="Asaf Zorea", | ||
author_email="[email protected]", | ||
description="The BlindRT60 algorithm is used to estimate the reverberation time (RT60) " | ||
"of a room based on the recorded audio signals from microphones", | ||
"of a room based on the recorded audio signals from microphones", | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
license='MIT', | ||
license="MIT", | ||
url="https://github.com/nuniz/blind_rt60", | ||
packages=setuptools.find_packages(exclude=["tests", "*.tests", "*.tests.*", "tests.*", "tests.*"]), | ||
packages=setuptools.find_packages( | ||
exclude=["tests", "*.tests", "*.tests.*", "tests.*", "tests.*"] | ||
), | ||
include_package_data=True, | ||
classifiers=[ | ||
"Programming Language :: Python :: 3", | ||
'License :: OSI Approved :: MIT License', | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
], | ||
python_requires=">=3.6", | ||
install_requires=[ | ||
"scipy", | ||
"numpy", | ||
"matplotlib" | ||
], | ||
install_requires=["scipy", "numpy", "matplotlib"], | ||
extras_require={ | ||
"dev": ["pyroomacoustics", "parameterized"], | ||
"dev": ["pyroomacoustics", "parameterized", "pre-commit"], | ||
}, | ||
) |
Oops, something went wrong.