Skip to main content

Advanced simulation settings

Simulation settings allow you to control advanced parameters related to the computation and post-processing applied by Treble during the simulation run-time. If you don't provide a SimulationSettings object to the simulation definition, the default settings are used. All parameters included in the object are optional, and the object passed to the definition can included only one or several at once.

You can also pass advanced, optional GA solver settings to the SimulationSettings object as well.

Basic examples

Default ambisonics order

The following snippet sets the default ambisonics order of spatial receivers (cross-link) to 16. This number governs the order of all spatial receivers that were left with the default ambisonics order upon creation: if you've explicitly set an ambisonics order during receiver definition, this setting won't override it.

# set the simulation-level ambisonics order
sim_settings = treble.SimulationSettings(ambisonics_order=16)

# specify the settings in the simulation definition
sim_def = treble.SimulationDefinition(
name="My simulation",
simulation_type=treble.SimulationType.hybrid,
model=room,
crossover_frequency=cross_freq,
energy_decay_threshold=decay_dB,
receiver_list=receivers,
source_list=source,
material_assignment=material_assignment,
simulation_settings=sim_settings
)

Custom GA solver settings

The following example demonstrates how to set custom GaSolverSettings, pass them to the simulation settings object, and include them in the simulation definition.

# define the GA settings
ga_settings = treble.GaSolverSettings(ism_order=20, air_absorption=True, number_of_rays=750000,ism_ray_count=100000)
# add them to the simulation settings
sim_settings = treble.SimulationSettings(ga_settings=ga_settings, ambisonics_order=16)
#include the simulation settings in the simulation definition
sim_def = treble.SimulationDefinition(
name=f"hybrid_{model.name}",
simulation_type=treble.SimulationType.hybrid,
model=model,
crossover_frequency=4000,
receiver_list=sim_receivers,
source_list=sim_sources,
material_assignment=[material_assignments[model.name][layer] for layer in model.layer_names],
ir_length=0.5,
simulation_settings=sim_settings,
gpu_allocation_strategy=treble.GpuAllocationStrategy.utilization_optimized
)

GPU count for DG simulations

The following snippet allocates the number of GPUs to use for wave-based (DG) simulations. GPU allocation is handled automatically when not explicitly defined, and rarely needs to be adjusted. In case an adjustment is required, the highest number you can use is governed by your organization's concurrency settings.

# set the GPU count
sim_settings = treble.SimulationSettings(gpu_count=2)

# specify the settings in the simulation definition
sim_def = treble.SimulationDefinition(
name="My simulation",
simulation_type=treble.SimulationType.hybrid,
model=room,
crossover_frequency=cross_freq,
energy_decay_threshold=decay_dB,
receiver_list=receivers,
source_list=source,
material_assignment=material_assignment,
simulation_settings=sim_settings
)

Speed of sound

The following snippet changes the speed of sound used in the calculations from the default value of 343 m/s to 340 m/s:

# set the speed of sound
sim_settings = treble.SimulationSettings(speed_of_sound=340)

# specify the settings in the simulation definition
sim_def = treble.SimulationDefinition(
name="My simulation",
simulation_type=treble.SimulationType.hybrid,
model=room,
crossover_frequency=cross_freq,
energy_decay_threshold=decay_dB,
receiver_list=receivers,
source_list=source,
material_assignment=material_assignment,
simulation_settings=sim_settings
)