pyroomacoustics.parameters module

This file defines the main physical constants of the system:
  • Speed of sound
  • Absorption of materials
  • Scattering coefficients
  • Air absorption
class pyroomacoustics.parameters.Constants

Bases: object

A class to provide easy access package wide to user settable constants.

get(name)
set(name, val)
class pyroomacoustics.parameters.Material(energy_absorption, scattering=None)

Bases: object

A class that describes the energy absorption and scattering properties of walls.

energy_absorption

A dictionary containing keys description, coeffs, and center_freqs.

Type:dict
scattering

A dictionary containing keys description, coeffs, and center_freqs.

Type:dict
Parameters:
  • energy_absorption (float, str, or dict) –
    • float: The material created will be equally absorbing at all frequencies
      (i.e. flat).
    • str: The absorption values will be obtained from the database.
    • dict: A dictionary containing keys description, coeffs, and
      center_freqs.
  • scattering (float, str, or dict) –
    • float: The material created will be equally scattering at all frequencies
      (i.e. flat).
    • str: The scattering values will be obtained from the database.
    • dict: A dictionary containing keys description, coeffs, and
      center_freqs.
absorption_coeffs

shorthand to the energy absorption coefficients

classmethod all_flat(materials)

Checks if all materials in a list are frequency flat

Parameters:materials (list or dict of Material objects) – The list of materials to check
Returns:
Return type:True if all materials have a single parameter, else False
is_freq_flat()

Returns True if the material has flat characteristics over frequency, False otherwise.

resample(octave_bands)

resample at given octave bands

scattering_coeffs

shorthand to the scattering coefficients

class pyroomacoustics.parameters.Physics(temperature=None, humidity=None)

Bases: object

A Physics object allows to compute the room physical properties depending on temperature and humidity.

Parameters:
  • temperature (float, optional) – The room temperature
  • humidity (float in range (0, 100), optional) – The room relative humidity in %. Default is 0.
classmethod from_speed(c)

Choose a temperature and humidity matching a desired speed of sound

get_air_absorption()
Returns:
  • (air_absorption, center_freqs) where air_absorption is a list
  • corresponding to the center frequencies in center_freqs
get_sound_speed()
Returns:
Return type:the speed of sound
pyroomacoustics.parameters.calculate_speed_of_sound(t, h, p)

Compute the speed of sound as a function of temperature, humidity and pressure

Parameters:
  • t (float) – temperature [Celsius]
  • h (float) – relative humidity [%]
  • p (float) – atmospheric pressure [kpa]
Returns:

Return type:

Speed of sound in [m/s]

pyroomacoustics.parameters.make_materials(*args, **kwargs)

Helper method to conveniently create multiple materials.

Each positional and keyword argument should be a valid input for the Material class. Then, for each of the argument, a Material will be created by calling the constructor.

If at least one positional argument is provided, a list of Material objects constructed using the provided positional arguments is returned.

If at least one keyword argument is provided, a dict with keys corresponding to the keywords and containing Material objects constructed with the keyword values is returned.

If only positional arguments are provided, only the list is returned. If only keyword arguments are provided, only the dict is returned. If both are provided, both are returned. If no argument is provided, an empty list is returned.