LCAV / pyroomacoustics

Pyroomacoustics is a package for audio signal processing for indoor applications. It was developed as a fast prototyping platform for beamforming algorithms in indoor scenarios.
https://pyroomacoustics.readthedocs.io
MIT License
1.33k stars 417 forks source link

Custom Materials #310

Open Djingle opened 1 year ago

Djingle commented 1 year ago

Hello,

I am encountering a problem when specifying my own materials in a room simulation scenario. I have a custom room that I extrude like that :

room = pra.Room.from_corners(
    pol,
    absorption=None,
    fs=20000,
    t0=0.0,
    max_order=10,
    sigma2_awgn=None,
    sources=None,
    mics=None,
    materials=m,
)

room.extrude(
    4,
    materials=me
)

The room is 4x4m

the materials are initiated like so, before creating the room :

test_mat = {
    "description":  "Example wall material",
    "coeffs":       [0.1,  0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,  0.1,  0.1,  0.1,  0.1,  0.1,  0.1,  0.1,  0.1,  0.1,  0.1,   0.1],
    "center_freqs": [ 25, 31.5,  40,  50,  63,  80, 100, 125, 160, 200, 250, 315, 400, 500, 630, 800, 1000, 1250, 1600, 2000, 2500, 3150, 4000, 5000, 6300, 8000, 10000],
}

m = pra.make_materials(*[(test_mat,) for i in range(pol.shape[1])]) # pol is my corners array

me = pra.make_materials(floor=(test_mat,), ceiling=(test_mat,)) # I copied the docs for these lines

When I try to execute it, the call to extrude triggers an error : "all walls should have the same number of frequency bands" . I Already tried tweaking the sample frequency as i saw that could trigger this error whenworking with fewer frequency bands. When I try with the same frequency bands as in the materials database it works, but as soon as I try to add frequency bands, this error is triggered by the extrude. Here is the full error message :

Traceback (most recent call last):
  File "test_pyroom.py", line 65, in <module>
    room.extrude(4, materials=me)
  File "room.py", line 1463, in extrude
    self._init_room_engine()
  File "room.py", line 983, in _init_room_engine
    self.room_engine = libroom.Room(*args)
RuntimeError: Error: All walls should have the same number of frequency bands

I have been stuck on this problem for a few days now, do you have any idea what could cause this error, and how I could solve it ?

fakufaku commented 1 year ago

Hi @Djingle , sorry this took a while. I will look into this.

fakufaku commented 1 year ago

Actually, one issue may be that the number of frequencies is too high. I am not sure that pyroomacoustics supports more than 6-7 bands.

Djingle commented 1 year ago

No problem, thank you for answering my question ! And yes when I simulate with less frequency bands it works.