treble_tsdk.results.spatial_ir

Spatial impulse response handling and device rendering.

Provides the SpatialIR class for working with ambisonics spatial audio data and rendering device-specific impulse responses.

Functions

batch_render_device_ir(devices, spatial_irs)

Batch render a list of spatial impulse responses for a given device. :param device: list of devices or single device :param spatial_irs: list of spatial impulse responses or list of tuples (data, sampling_rate) :param orientation: list of orientations or single orientation :param orientation_application: The application of the orientations "cartesian" means all combinations are rendered, "zipped" pairs orientations and spatial irs one to one, defaults to "cartesian" :param ignore_max_frequency: Whether to ignore the maximum frequency of the device (if it contains a maximum valid frequency) :param output_mode: Progress output mode for the operation :return: list of rendered device impulse responses.

Classes

SpatialIR

Spatial impulse response with ambisonics channels.

class treble_tsdk.results.spatial_ir.SpatialIR

Spatial impulse response with ambisonics channels.

Represents multi-channel spatial audio data and provides methods for device rendering and analysis.

__init__(data: ndarray, sampling_rate: float, time: ndarray | None = None, source: list[SourceResults] | None = None, receiver: list[ReceiverResults] | None = None, zero_pad_samples: int = 0, normalization_coefficient: float | None = None)

An object containing the data for a spatial IR and methods associated with such an impulse response.

Parameters:
  • data (np.ndarray) – Time series data with the shape (channel, time)

  • sampling_rate (float) – sampling rate of the time series

  • normalization_coefficient (float | None) – Normalization coefficient for correct amplitude of wavfile

  • time (np.ndarray | None) – Time vector for the time series

  • source (SourceDto | None) – The source associated with the IR

  • receiver (ReceiverDto | None) – The receiver associated with the IR

  • normalization_coefficient – The coefficient used to normalize the data

render_device_ir(device: DeviceObj, orientation: Rotation = Rotation(azimuth=0.0, elevation=0.0, roll=0.0), ignore_max_frequency: bool = False) DeviceIR

Take a spatial impulse response and render a new device with it.

Parameters:
  • device (DeviceObj) – An object representing a device/head related transfer function

  • orientation (Rotation) – The orientation of the device

  • ignore_max_frequency (bool) – Whether to ignore the maximum frequency of the device (if it contains a maximum valid frequency)

Return DeviceIR:

The resulting impulse response object for the device

plot(channel_range: tuple[int, int] = (0, 8))

Plot the spatial impulse response

treble_tsdk.results.spatial_ir.batch_render_device_ir(devices: 'DeviceObj' | list['DeviceObj'], spatial_irs: list[SpatialIR] | list[tuple[np.ndarray, float]], orientations: Rotation | list[Rotation] = [Rotation(azimuth=0.0, elevation=0.0, roll=0.0)], orientation_application: Literal['zipped', 'cartesian'] = 'cartesian', ignore_max_frequency: bool = False, output_mode: utils.ProgressOutputMode = ProgressOutputMode.TQDM_OUTPUT) list[DeviceIR]

Batch render a list of spatial impulse responses for a given device. :param device: list of devices or single device :param spatial_irs: list of spatial impulse responses or list of tuples (data, sampling_rate) :param orientation: list of orientations or single orientation :param orientation_application: The application of the orientations “cartesian” means all combinations are rendered,

“zipped” pairs orientations and spatial irs one to one, defaults to “cartesian”

Parameters:
  • ignore_max_frequency – Whether to ignore the maximum frequency of the device (if it contains a maximum valid frequency)

  • output_mode – Progress output mode for the operation

Returns:

list of rendered device impulse responses