Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[FEATURE] RoomAnalysis class for monaural room impulse response parameters calculation. #35

Merged
merged 11 commits into from
Jul 6, 2021
Merged
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

# Data files
*.pkl
*.mat
*.pytta
*.hdf5
*.json
*.wav
#*.mat
#*.pytta
#*.hdf5
#*.json
#*.wav
*.txt

# All the python stuff
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
</a>
</p>


## PyTTa (Python in Technical Acoustics)

The project began as an effort to create audio, acoustics, and vibration data acquiring and analysis toolbox to a free cost level, high-end results, combining the passion for programming with the expertise in Acoustics and Vibration of the Acoustics Engineers from the Federal University of Santa Maria (Southern Brazil).
Expand Down
Binary file added examples/RIS/EstereoRIS1_freq.mat
Binary file not shown.
Binary file added examples/RIS/EstereoRIS1_time.mat
Binary file not shown.
Binary file added examples/RIS/MonoRIS1_freq.mat
Binary file not shown.
Binary file added examples/RIS/MonoRIS1_time.mat
Binary file not shown.
Binary file added examples/RIS/scene9_RIR_LS1_MP1_Dodecahedron.wav
Binary file not shown.
31 changes: 31 additions & 0 deletions examples/roomparameters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Room Parameters.

Demonstration of how to use the new RoomParameters class.

@author: João Vitor Gutkoski Paes.
"""
import pytta


# myMonoIR = pytta.load("SOME_SAVED_SIGNALOBJ_WITH_IR.hdf5")
myMonoIR = pytta.read_wav("RIS/scene9_RIR_LS1_MP1_Dodecahedron.wav")


room = pytta.RoomAnalysis(myMonoIR, nthOct=3, minFreq=50., maxFreq=16e3)


print()
print("Parameters from impulse response are:")
print("\n", room.parameters, "\n")
print("Access directly by RoomAnalysis().PNAME")
print("Or view it in a bar plot by RoomAnalysis().plot_PNAME")
print("where PNAME is the name of the desired parameter, as shown above.")
print()
print(f"{room.T20=}")


fig = room.plot_EDT()
fig.show()
7 changes: 4 additions & 3 deletions pytta/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
* pytta.generate:
functions for signal synthesis and measurement configuration;

* pytta.rooms:
* pytta.rooms (DEPRECATED):
room acoustics parameters calculation according to ISO 3382-1;

* pytta.iso3741:
Expand Down Expand Up @@ -100,7 +100,7 @@
Measurement, RecMeasure, PlayRecMeasure, FRFMeasure,\
Streaming, Monitor,\
OctFilter, weighting,\
Analysis
Analysis, RoomAnalysis

from . import _h5utils
from . import _plot
Expand All @@ -120,7 +120,7 @@

from .apps import roomir

__version__ = '0.1.0' # package version
__version__ = '0.1.1' # package version

# package submodules and scripts to be called as pytta.something
__all__ = [ # Apps
Expand Down Expand Up @@ -163,6 +163,7 @@
'SignalObj',
'ImpulsiveResponse',
'Analysis',
'RoomAnalysis',
'OctFilter',
'Monitor',
'Streaming',
Expand Down
3 changes: 2 additions & 1 deletion pytta/classes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@
from .measurement import Measurement, RecMeasure, PlayRecMeasure, FRFMeasure
from .streaming import Streaming, Monitor
from .filter import OctFilter, weighting
from .analysis import Analysis
from .analysis import Analysis, RoomAnalysis

__all__ = [# Classes
'SignalObj',
'ImpulsiveResponse',
'Analysis',
'RoomAnalysis',
'RecMeasure',
'PlayRecMeasure',
'FRFMeasure',
Expand Down
2 changes: 1 addition & 1 deletion pytta/classes/_instanceinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class RememberInstanceCreationInfo:
def __init__(self):
for frame, _ in traceback.walk_stack(None):
varnames = frame.f_code.co_varnames
if varnames is ():
if varnames == ():
break
if frame.f_locals[varnames[0]] not in (self, self.__class__):
break
Expand Down
Loading