treble_tsdk.scene.scene_listener
Classes
Moving-listener automation: dynamic position and/or orientation for receiver motion rendering. |
|
Device microphone properties for static noise and frequency response. |
|
A group of listeners that are related to each other. |
|
Per-channel noise level specification. |
|
Per-angle sampling range that resolves to a static rotation per scene. |
|
A single, fully-resolved listener within a scene (receiver + device + orientation + optional filtering/noise/automation), as opposed to |
- class treble_tsdk.scene.scene_listener.Automation
Moving-listener automation: dynamic position and/or orientation for receiver motion rendering.
- Parameters:
position (DynamicPosition | None) – Optional dynamic position over time.
orientation (DynamicOrientation | None) – Optional dynamic orientation over time. When set on a
SceneListener’sautomation, this takes precedence over that listener’s ownorientationfield.
- __init__(position: DynamicPosition | None = None, orientation: DynamicOrientation | None = None) None
- classmethod from_struct(struct: dict | None) Automation | None
Reconstruct an
Automationfrom its serialized struct.- Parameters:
struct (dict | None) – Struct as produced by
to_struct().- Return Automation | None:
The reconstructed instance, or
NoneifstructisNone.
- to_struct() dict
Serialize to a plain dict.
- Return dict:
Struct with
positionandorientation, eachNoneor the nested object’s ownto_struct()output.
- orientation: DynamicOrientation | None = None
- position: DynamicPosition | None = None
- class treble_tsdk.scene.scene_listener.DeviceSpecs
Device microphone properties for static noise and frequency response.
Applies regardless of whether a device is set on the owning
ListenerRules: with no device, the receiver renders as a single mono channel, andnoise_rules/filter_definitionsstill apply to that one channel exactly as they would to a device’s channels. This is the receiver-side counterpart toTrackGenerator.filter_definitions(a source-side filter scoped to one source group’s own content): this one applies uniformly, once per track, insideAudioScene.render()to every track in the scene, regardless of which source group produced it.- Parameters:
noise_rules (StaticNoiseRules) – Noise profile and behavior for this device or microphone. See
StaticNoiseRulesfor details.filter_definitions (list[list[FilterDefinition]]) – One filter list per device/microphone channel. A bare (non-list) value is wrapped into a one-element list in
__post_init__, but a flatlist[FilterDefinition]is not re-nested into per-channel sublists — it applies that same chain uniformly across every channel. Nest explicitly ([[filter_a], [filter_b]]) for genuinely different filters per channel.
- __init__(noise_rules: StaticNoiseRules = None, filter_definitions: list[list['FilterDefinition']] = None) None
- noise_rules: StaticNoiseRules = None
- class treble_tsdk.scene.scene_listener.ListenerRules
A group of listeners that are related to each other.
- Parameters:
device (DeviceObj) – The device for the listener.
orientation (Rotation | DynamicOrientation | ActiveTalkerFollowOrientation | OrientationRange) – The listener orientation: a static rotation, a dynamic orientation, a dynamic rule that follows the active talker in a source group, or a per-angle sampling range that resolves to a static rotation per scene.
device_specs (DeviceSpecs) – Device specifications for static noise generation and microphone response.
receiver_selection (pl.Expr) – A polars expression to filter receivers (optional). Must be a
polars.Exprif given.automation (Automation) – Optional listener automation. Use this to provide moving-listener position and/or dynamic orientation for receiver motion rendering.
deviceandorientationmust be set together — neither is allowed without the other.orientationcannot be anActiveTalkerFollowOrientationorDynamicOrientation: this check is unconditional, rejecting both types regardless of whether the receiver actually moves (not only for moving receivers, as the error message implies) — it’s forward-looking code gated on general moving-receiver support landing, not on this specific case.automationis not yet supported for moving receivers and must beNone.- __init__(device: DeviceObj | None = None, orientation: Rotation | DynamicOrientation | ActiveTalkerFollowOrientation | OrientationRange | None = None, device_specs: DeviceSpecs | None = None, receiver_selection: pl.Expr | None = None, automation: Automation | None = None) None
- automation: Automation | None = None
- device_specs: DeviceSpecs | None = None
- orientation: Rotation | DynamicOrientation | ActiveTalkerFollowOrientation | OrientationRange | None = None
- receiver_selection: pl.Expr | None = None
- class treble_tsdk.scene.scene_listener.NoiseGenerator
Per-channel noise level specification.
- Parameters:
noise_type (str) – Identifier for the kind of noise to generate.
noise_level_db_spl (float | list[float]) – Noise level in dB SPL, either a single value applied to all channels or a list with one value per channel.
n_channels (int) – Number of channels. Required to broadcast a scalar
noise_level_db_splor to validate a per-channel list.seed (int | None) – Optional random seed.
- class treble_tsdk.scene.scene_listener.OrientationRange
Per-angle sampling range that resolves to a static rotation per scene.
Each range is converted to a distribution (
Uniformby default, or the givenUniform/ScaledBeta) in__post_init__and validated against the physical bounds for that angle.- Parameters:
azimuth_range (tuple[float, float] | Uniform | ScaledBeta) – Azimuth sampling range in degrees, within [-180, 180].
elevation_range (tuple[float, float] | Uniform | ScaledBeta) – Elevation sampling range in degrees, within [-90, 90].
roll_range (tuple[float, float] | Uniform | ScaledBeta) – Roll sampling range in degrees, within [-180, 180].
- __init__(azimuth_range: tuple[float, float] | Uniform | ScaledBeta, elevation_range: tuple[float, float] | Uniform | ScaledBeta, roll_range: tuple[float, float] | Uniform | ScaledBeta) None
- classmethod from_struct(struct: dict | None) OrientationRange | None
Reconstruct an
OrientationRangefrom its serialized struct.- Parameters:
struct (dict | None) – Struct as produced by
to_struct().- Return OrientationRange | None:
The reconstructed instance, or
Noneifstructis not a dict or itsmodeis not"orientation_range".
- to_dict() dict
Alias for
to_struct().- Return dict:
Same as
to_struct().
- to_struct() dict
Serialize to a plain dict, tagged with
mode: "orientation_range".- Return dict:
Struct with
mode,azimuth_range,elevation_range, androll_rangeas[low, high]lists.
- azimuth_range: tuple[float, float] | Uniform | ScaledBeta
- elevation_range: tuple[float, float] | Uniform | ScaledBeta
- roll_range: tuple[float, float] | Uniform | ScaledBeta
- class treble_tsdk.scene.scene_listener.SceneListener
A single, fully-resolved listener within a scene (receiver + device + orientation + optional filtering/noise/automation), as opposed to
ListenerRules, which describes rules shared across a group of listeners.- Parameters:
receiver (Receiver) – The receiver this listener is attached to.
device (DeviceObj | None) – The device/microphone array used for rendering. If
None, rendering is done in mono mode.orientation (Rotation | DynamicOrientation | None) – Static or dynamic listener orientation. If
automation.orientationis also set, it wins and overwrites this field in__post_init__(with a warning if both were explicitly provided).filter_definitions (list[FilterDefinition]) – Optional per-channel filters applied at rendering time.
noise_definitions (list[StaticNoiseTrack] | StaticNoiseTrack | None) – Static noise track(s) to add per microphone channel. A single track, or a list with one entry, is broadcast to all device channels. A list with more than one entry must have exactly one entry per device microphone; if
deviceisNonein that case, only the first noise definition is used (with a warning).automation (Automation | None) – Optional moving-listener position and/or dynamic orientation for receiver motion rendering.
- __init__(receiver: Receiver, device: DeviceObj | None = None, orientation: Rotation | DynamicOrientation | None = None, filter_definitions: list['FilterDefinition'] = None, noise_definitions: list[StaticNoiseTrack] | StaticNoiseTrack | None = None, automation: Automation | None = None) None
- classmethod from_struct(struct: dict, receiver=None, device=None) SceneListener
Reconstruct a
SceneListenerfrom its serialized struct.- Parameters:
struct (dict) – Struct as produced by
to_struct(). For backward compatibility, a legacy top-levelpositionkey (with noautomation) is treated asautomation.position.receiver – Receiver to attach; if
None, a lightweight stand-in object exposingidandlabelfrom the struct is used instead.device – Device to attach. Not resolved from the struct; the caller must supply the actual device object.
- Return SceneListener:
The reconstructed instance.
- to_struct() dict
Serialize this listener to a plain dict.
- Return dict:
Struct with
receiver,device(id/name/channel labels),orientation,filter_definitions,noise_definitions, andautomation.
- automation: Automation | None = None
- filter_definitions: list['FilterDefinition'] = None
- noise_definitions: list[StaticNoiseTrack] | StaticNoiseTrack | None = None
- orientation: Rotation | DynamicOrientation | None = None
- receiver: Receiver