Skip to main content

Room database

The Treble SDK comes with a large database comprised of thousands of ready made room models, already optimized for acoustic simulations. To get an overview of the categories of models in the room database, simply run this command:

dd.as_table(tsdk.geometry_library.list_datasets_with_count())

This should give you a table of the categories with a count of the total number of models in each category. Some of the categories are autogenerated using detailed instructions and example models, and therefore have a high number of models. These catergores include restaurants, apartments and meetingrooms. Other categories, such as auditoriums or Cafe have been made manually and include a smaller number of models.

                                    ┏━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┓
┃ Name ┃ Count ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━┩
│ ListeningRoom │ 2
│ Restaurants │ 1250
│ MeetingRoom │ 999
│ Auditorium │ 1
│ SwimmingPool │ 1
│ Bathrooms │ 1669
│ Atrium │ 2
│ Office │ 8
│ LivingRooms │ 926
│ Bedrooms │ 2267
│ LivingRoomsWithHallway │ 462
│ Cafe │ 1
│ Apartments │ 1451
└────────────────────────┴───────┘

In order to access a certain category, simply copy the name of the category into the get_dataset function and load into a variable or list as a table

dd.as_table(tsdk.geometry_library.get_dataset("Office"))
                                             Geometry table                                              
┏━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓
┃ Index ┃ Name ┃ Id ┃ Description ┃ Dataset ┃
┡━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩
0 │ Office 0 │ 06579bfb-1045-4889-8588-dcdfe9d05513 │ │ Office │
1 │ Office 1 │ d2a88220-af28-4337-87f8-e64e867b037c │ │ Office │
2 │ Office 2 │ 0d96d581-fb96-4854-b8dd-0da12df5f005 │ │ Office │
3 │ Office 3 │ 03ce2742-0c6d-4e58-9b90-6bbe80a0cbf6 │ │ Office │
4 │ Office 4 │ c9a18b65-4a30-4545-96d5-8625326ce22c │ │ Office │
5 │ Office 5 │ 46f3cb7d-d97b-4fe5-bcfd-f7dacec8013d │ │ Office │
6 │ Office space with vaulted ceiling │ 7e4e5b00-d20b-42dd-a390-fcf2e297868c │ │ Office │
7 │ Office with dividers │ ee2eac3a-d632-4a12-91db-a58498e882d7 │ │ Office │
└───────┴───────────────────────────────────┴──────────────────────────────────────┴─────────────┴─────────┘

This next example shows how to load all the models into a variable, selecting one, calculating and printing out the model volume, and finally plotting the model for viewing purposes.


restaurants = tsdk.geometry_library.get_dataset("Restaurants")
room_index = 4
restaurant = restaurants[room_index]
vol = restaurant._compute_model_volume()
print(f"Room volume = {vol:.02f} cubic meters [m3].")
restaurant.plot()

Room volume = 99.05 cubic meters [m3].

Restaurant model

The model layers can be listed by running

model.layer_names
['Chairs',
'Wall Absorbers',
'Outer Walls',
'Floor',
'Ceiling',
'Windows',
'Tables']

Suggested positions

Some of the rooms in the database come with a collection of suggested positions. These can be used to place either receiever or sources at predefined locations, for example above a chair or other various locations in the room. The following code examples utilizes the suggested points and handpicks selected indexes to use as background noise sources:


receiver_index = 18
main_source_index = 17
noise_source_indexes = [0, 2, 7, 15, 27]


Restaurant.position_suggestions[receiver_index]._position

receiver_list = []

receiver_list.append(
treble.Receiver.make_spatial(
position=Restaurant.position_suggestions[receiver_index]._position,
label="R1",
ambisonics_sphere_radius_in_m=0.1,
)
)


# get a mouth source from the loudspeaker library
speech_directivity = tsdk.source_directivity_library.query(name="speech")[0]

source_list = []
# make the main target source as speech directivity
source_list.append(
treble.Source.make_directive(Restaurant.position_suggestions[main_source_index]._position,
orientation = treble.Rotation(180,0,0),
label = "S0",
source_directivity = speech_directivity
))

# make the noise sources as omni
for n in range(len(noise_source_indexes)):
source_list.append(
treble.Source.make_omni(Restaurant.position_suggestions[noise_source_indexes[n]]._position,
label = "S" + str(n+1),
))