pyroomacoustics
pyroomacoustics copied to clipboard
Specify different wall material from STL file?
Hi, I am new here. I have learned pyroomacoustics for a while. Now, I am stuck at using customised room as an STL file. Then, I expect that this program could also specify each wall material as I imported from an STL file. However, I could not find the docs related to that.
Even, I read a master thesis published in 2022 (https://www.diva-portal.org/smash/get/diva2:1637682/FULLTEXT01.pdf) at page 24, stating that:
Unfortunately there where no documentation on how to specify the materials for each face of the L-shaped room, only a uniform absorption coefficients for the whole room.
I work as a lecturer and I am interested in popularising this package to my students and colleagues in Indonesia. I look forward to any hints, examples, and guidances. Thank you!
Hi @ikhwanuddin , the reason there is no documentation is simple: I don't know how to do it! I have been thinking about this problem for a while. I am not very familiar with the STL file format and I have not found out how to include wall material information in the format. If you know how to do it and want to share, that would be very appreciated.
One issue is that many 3D file formats are designed more for optical rendering which requires different parameters than acoustic rendering.
Actually, importing STL files is not officially supported in pyroomacoustics, which is why there is no documentation. However, it is possible to some extent and I have included one example code, see examples/room_from_stl.py
.
Actually I have an idea how to do it. I was reading this #249 and checking his code, the thread starter implemented 2 types of material, then I found that there is *.material file which is used to add absorption coefficient to each facet inside *.stl.
They are in the same order! Each row represents a material respective to a facet which is built inside *.stl. I must ensure that *.stl is in ASCII mode to read them all.
OK, 10 to 30 facets maybe not a problem. What if I want to build a more complex 3D model? It could have a hundred or maybe a thousand facet with more than 5 different materials. If I know the order, maybe I can build *.material manually. That would be fine, this software package is free after all.
Now the question is how to examine the facet order inside the *.stl file? I just had found that GMSH could activate this option for me. Tick mark "Node labels" and "2d element labels". Now I have all number in the correct order.
![GMSH shows us node and 2d element labels of an stl 3d model](https://user-images.githubusercontent.com/26325017/171917158-a260f6ee-33b9-4304-9cd8-77e20670702f.png)
Next, I will be experimenting a real project, in order to test if this really works or does not. I still need to modify his main.py file in order to accept my own *.material.
@ikhwanuddin Thank you very much for the information! We had been discussing the idea of adding more mesh related stuff in pyroomacoustics, but came to the conclusion that there does not seem to be any python package for mesh processing that is both simple to install, has sufficient features, and compatible across major platforms. I am very grateful to know about gmsh, such external tools are also very useful!