Metadata Input

The data structures in the ear.core.metadata_input module act as the main interface between the core renderer classes for each type, and the wider EAR system, or other systems which want to render audio using the EAR.

The data structures are not ADM: they are essentially a simplified view of ADM data containing only the parts required for rendering: an association between some input audio tracks, and streams of time-varying metadata to apply to them.

The input to a renderer is a list of RenderingItem objects, which are specialised for each ADM type (ObjectRenderingItem, DirectSpeakersRenderingItem etc.). Each rendering item contains:

  • A pointer to some audio data, through a TrackSpec object. This generally says something like “track 2 of the input audio stream”, but can also contain a more complex mapping for Matrix types, or reference a silent input.

    In the case of HOA where multiple tracks are rendered together, multiple track specs are given.

    See Track Specs.

  • A source of time-varying metadata, provided by a MetadataSource. This can be used to access a sequence of TypeMetadata objects, which are again sub-classed for each ADM type (ObjectTypeMetadata, DirectSpeakersTypeMetadata etc.).

    TypeMetadata sub-classes generally contain a pointer to the corresponding audioBlockFormat data, as well as any extra data from outside the audioBlockFormat which is needed for rendering.

  • Extra data (generally ImportanceData and ADMPath) which is not required for rendering, but may be useful for debugging, or uses other than straightforward rendering (for example only rendering some sub-set of an ADM file).

The available classes and their inheritance relationships are shown below:

Inheritance diagram of TypeMetadata, ObjectTypeMetadata, DirectSpeakersTypeMetadata, HOATypeMetadata, RenderingItem, ObjectRenderingItem, DirectSpeakersRenderingItem, HOARenderingItem, TrackSpec, DirectTrackSpec, SilentTrackSpec, MatrixCoefficientTrackSpec, MixTrackSpec

Overall Structure

class ear.core.metadata_input.RenderingItem

Base class for *RenderingItem classes; these should represent an item to be rendered, combining a MetadataSource that produces a sequence of TypeMetadata objects, and some indices into the tracks that this metadata applies to.

class ear.core.metadata_input.TypeMetadata

Base class for *TypeMetadata classes; these should represent all the parameters needed to render some set of audio channels within some time bounds.

class ear.core.metadata_input.MetadataSource

A source of metadata for some input channels.

get_next_block()

Get the next metadata block, if one is available.

Return type

Optional[ear.core.metadata_input.TypeMetadata]

Track Specs

To render track specs, see ear.core.track_processor.TrackProcessor() and ear.core.track_processor.MultiTrackProcessor.

class ear.core.metadata_input.TrackSpec

Represents a method for obtaining audio samples to be processed given multi-track input samples (from a WAV file for example).

This is used to abstract over regular track references, silent channels and matrix channels, but could also be used for coded audio, fancy containers etc.

class ear.core.metadata_input.DirectTrackSpec(track_index)

Bases: ear.core.metadata_input.TrackSpec

Track obtained directly from the input audio stream.

track_index

Zero based input track index.

Type

int

class ear.core.metadata_input.SilentTrackSpec

Bases: ear.core.metadata_input.TrackSpec

A track whose samples are always 0.

class ear.core.metadata_input.MatrixCoefficientTrackSpec(input_track, coefficient)

Bases: ear.core.metadata_input.TrackSpec

Track derived from a single channel and a matrix coefficient.

input_track

track spec to obtain samples from before they are processed by parameters in coefficient.

Type

TrackSpec

coefficient

matrix parameters to apply; inputChannelFormat should be ignored.

Type

MatrixCoefficient

class ear.core.metadata_input.MixTrackSpec(input_tracks)

Bases: ear.core.metadata_input.TrackSpec

Track that is a mix of some other tracks.

input_tracks

list of input tracks to mix

Type

list of TrackSpec

Objects

class ear.core.metadata_input.ObjectTypeMetadata(block_format, extra_data=NOTHING)

Bases: ear.core.metadata_input.TypeMetadata

TypeMetadata for typeDefinition=”Objects”

block_format

Block format.

Type

AudioBlockFormatObjects

extra_data

Extra parameters from outside block format.

Type

ExtraData

class ear.core.metadata_input.ObjectRenderingItem(track_spec, metadata_source, importance=NOTHING, adm_path=None)

Bases: ear.core.metadata_input.RenderingItem

RenderingItem for typeDefinition=”Objects”

track_spec

Zero based input track index for this item.

Type

TrackSpec

metadata_source

Source of ObjectTypeMetadata objects.

Type

MetadataSource

importance

Importance data for this item.

Type

ImportanceData

adm_path

Pointers to the ADM objects which this is derived from.

Type

ADMPath

Direct Speakers

class ear.core.metadata_input.DirectSpeakersTypeMetadata(block_format, audioPackFormats=None, extra_data=NOTHING)

Bases: ear.core.metadata_input.TypeMetadata

TypeMetadata for typeDefinition=”DirectSpeakers”

block_format

Block format.

Type

AudioBlockFormatDirectSpeakers

extra_data

Extra parameters from outside block format.

Type

ExtraData

class ear.core.metadata_input.DirectSpeakersRenderingItem(track_spec, metadata_source, importance=NOTHING, adm_path=None)

Bases: ear.core.metadata_input.RenderingItem

RenderingItem for typeDefinition=”DirectSpeakers”

track_spec

Specification of input samples.

Type

TrackSpec

metadata_source

Source of DirectSpeakersTypeMetadata objects.

Type

MetadataSource

importance

Importance data for this item.

Type

ImportanceData

adm_path

Pointers to the ADM objects which this is derived from.

Type

ADMPath

HOA

class ear.core.metadata_input.HOATypeMetadata(orders, degrees, normalization, nfcRefDist=None, screenRef=False, rtime=None, duration=None, extra_data=NOTHING)

Bases: ear.core.metadata_input.TypeMetadata

TypeMetadata for typeDefinition=”HOA”

orders

Order for each input channel.

Type

list of int

degrees

Degree for each channel.

Type

list of int

normalization

Normalization for all channels.

Type

str

nfcRefDist

NFC Reference distance for all channels.

Type

float or None

screenRef

Are these channels screen related?

Type

bool

rtime

Start time of block.

Type

fractions.Fraction or None

duration

Duration of block.

Type

fractions.Fraction or None

extra_data

Info from object and channels for all channels.

Type

ExtraData

class ear.core.metadata_input.HOARenderingItem(track_specs, metadata_source, importances=None, adm_paths=None)

Bases: ear.core.metadata_input.RenderingItem

RenderingItem for typeDefinition=”HOA”

track_specs

Specification of n tracks of input samples.

Type

list[TrackSpec]

metadata_source

Source of HOATypeMetadata objects; will usually contain only one object.

Type

MetadataSource

importances

Importance data for each track.

Type

Optional[list[ImportanceData]]

adm_paths

Pointers to the ADM objects which each track is derived from.

Type

Optional[list[ADMPath]]

Shared Data

class ear.core.metadata_input.ExtraData(object_start=None, object_duration=None, reference_screen=PolarScreen(aspectRatio=1.78, centrePosition=PolarPosition(azimuth=0.0, elevation=0.0, distance=1.0), widthAzimuth=58.0), channel_frequency=NOTHING, pack_absoluteDistance=None)

Common metadata from outside the ADM block format.

object_start

Start time of audioObject.

Type

fractions.Fraction or None

object_duration

Duration of audioObject.

Type

fractions.Fraction or None

reference_screen

Reference screen from audioProgramme.

Type

CartesianScreen or PolarScreen

channel_frequency

Frequency information from audioChannelFormat.

Type

Frequency

pack_absoluteDistance

absoluteDistance parameter from audioPackFormat.

Type

float or None

class ear.core.metadata_input.ADMPath(audioProgramme=None, audioContent=None, audioObjects=None, audioPackFormats=None, audioChannelFormat=None)

Pointers to the ADM objects which a rendering item is derived from.

audioProgramme
Type

Optional[AudioProgramme]

audioContent
Type

Optional[AudioContent]

audioObjects
Type

Optional[list[AudioObject]]

audioPackFormats
Type

Optional[list[AudioPackFormat]]

audioChannelFormat
Type

Optional[list[AudioChannelFormat]]

property first_audioObject

The first audioObject of this track in the chain, or None

Type

Optional[AudioObject]

property first_audioPackFormat

The first audioPackFormat of this track in the chain, or None

Type

Optional[AudioPackFormat]

property last_audioObject

The last audioObject of this track in the chain, or None

Type

Optional[AudioObject]

property last_audioPackFormat

The last audioPackFormat of this track in the chain, or None

Type

Optional[AudioPackFormat]

class ear.core.metadata_input.ImportanceData(audio_object=None, audio_pack_format=None)

Importance metadata for a single channel in a RenderingItem

audio_object

Importance that has been derived from the audioObject level

Type

int or None

audio_pack_format

Importance that has been derived from the audioPackFormat level

Type

int or None