treble_tsdk.postprocessing.DRTF

Device Related Transfer Function (DRTF) postprocessing.

Contains utility function for working with device related transfer functions.

Functions

create_device_from_sofa_file(sofa_filepath, ...)

Take a .sofa file and create a list of device microphones which can then be added to the project

plot_device_microphone_impulse_response(...)

Plot the impulse responses from sources to microphone.

plot_device_microphone_transfer_function(...)

Plot the frequency domain transfer function, either for all angles or for a given azimuth and/or elevation

plot_transfer_function(device, angle[, ...])

Plot the frequency domain transfer function for a specific angle

treble_tsdk.postprocessing.DRTF.create_device_from_sofa_file(sofa_filepath: str | Path, device_name: str, max_ambisonics_order: int, device_description: str | None = None, reference_frequency: float | None = 100) DeviceDefinition

Take a .sofa file and create a list of device microphones which can then be added to the project

Parameters:
  • sofa_filepath (str | Path) – Path to sofa file

  • device_name (str) – Name of the device

  • max_ambisonics_order (int) – Highest ambisonics order to render devices for. Maximum allowed is 32

  • device_description (Optional[str]) – Optional description of device, defaults to None

  • reference_frequency (Optional[float]) – Reference frequency for the device.

Return DeviceDefinition:

A definition of the device contained in the sofa file

treble_tsdk.postprocessing.DRTF.plot_transfer_function(device: DeviceObj | DeviceDefinition, angle: tuple[float, float], frequency_range: tuple[float, float] | None = None)

Plot the frequency domain transfer function for a specific angle

Parameters:
  • device (DeviceObj) – The device object to plot transfer function for

  • angle (tuple[float, float]) – Azimuth angle and elevation angle corresponding to the ones in input, if left empty, will plot all angles, defaults to None

  • frequency_range (tuple[float, float]) – Frequency range to plot, defaults to None

treble_tsdk.postprocessing.DRTF.plot_device_microphone_transfer_function(device_microphone: DeviceMicrophone, angle: tuple[float, float] | None = None, frequency_range: tuple[float, float] | None = None)

Plot the frequency domain transfer function, either for all angles or for a given azimuth and/or elevation

Parameters:
  • device_microphone (DeviceMicrophone) – The device microphone to plot transfer function for

  • angle (tuple[float, float]) – Azimuth angle and elevation angle corresponding to the ones in input, if left empty, will plot all angles, defaults to None

  • frequency_range (tuple[float, float]) – Frequency range to plot, defaults to None

treble_tsdk.postprocessing.DRTF.plot_device_microphone_impulse_response(device_microphone: DeviceMicrophone, angle: tuple[float, float] | None = None, temporal_range_in_ms: tuple[float, float] | None = None)

Plot the impulse responses from sources to microphone. Either from a specific angle or all of them.

Parameters:
  • device_microphone (DeviceMicrophone) – The device microphone to plot impulse response for

  • angle (tuple[float, float]) – Azimuth, Elevation angle to the source, defaults to None

  • temporal_range_in_ms (tuple[float, float]) – Temporal range in millisecons to plot, defaults to None