ADM Data¶
The ADM data representation is in the ear.fileio.adm module.
An ADM document is represented by an adm.ADM object, which contains
lists of all of the top-level ADM elements.
In general, element objects have properties which match the ADM XML tag or attribute names, except for:
The main ID of elements are stored in an
.idproperty, rather than (for example).audioProgrammeID.typeDefinitionandtypeLabelare resolved to a single.typeproperty.formatDefinitionandformatLabelare resolved to a single.formatproperty.References to other objects by ID are translated into a python object reference, or a list of references. For example,
audioObjectIDRefelements in anaudioContenttag become a list ofelements.AudioObjectstored inelements.AudioContent.audioObjects.Note
Element objects do contain
IDRefproperties (e.g.audioObjectIDRef), which are used while parsing, but these are cleared when references are resolved to avoid storing conflicting information.In representations of ADM elements which contain both text and attributes (for example
<objectDivergence azimuthRange="30">0.5</objectDivergence>), the text part is stored in a semantically-relevant property, e.g.elements.ObjectDivergence.value. For boolean elements (e.g.channelLock), this is represented by the presence or absence of the object in the parent object.
- class ear.fileio.adm.adm.ADM¶
An ADM document.
- addAudioChannelFormat(channelformat)¶
Add an audioChannelFormat.
- Parameters
channelformat (ear.fileio.adm.elements.AudioChannelFormat) –
- addAudioContent(content)¶
Add an audioContent.
- Parameters
content (ear.fileio.adm.elements.AudioContent) –
- addAudioObject(audioobject)¶
Add an audioObject.
- Parameters
audioobject (ear.fileio.adm.elements.AudioObject) –
- addAudioPackFormat(packformat)¶
Add an audioPackFormat.
- Parameters
packformat (ear.fileio.adm.elements.AudioPackFormat) –
- addAudioProgramme(programme)¶
Add an audioProgramme.
- Parameters
programme (ear.fileio.adm.elements.AudioProgramme) –
- addAudioStreamFormat(streamformat)¶
Add an audioStreamFormat.
- Parameters
streamformat (ear.fileio.adm.elements.AudioStreamFormat) –
- addAudioTrackFormat(trackformat)¶
Add an audioTrackFormat.
- Parameters
trackformat (ear.fileio.adm.elements.AudioTrackFormat) –
- addAudioTrackUID(trackUID)¶
Add an audioTrackUID.
- Parameters
trackUID (ear.fileio.adm.elements.AudioTrackUID) –
- property audioChannelFormats¶
Get all audioChannelFormat elements.
- Type
- property audioContents¶
Get all audioContent elements.
- Type
- property audioObjects¶
Get all audioObject elements.
- Type
- property audioPackFormats¶
Get all audioPackFormat elements.
- Type
- property audioProgrammes¶
Get all audioProgramme elements.
- Type
- property audioStreamFormats¶
Get all audioStreamFormat elements.
- Type
- property audioTrackFormats¶
Get all audioTrackFormat elements.
- Type
- property audioTrackUIDs¶
Get all audioTrackUID elements.
- Type
- property elements¶
Iterator over all elements.
- lookup_element(key)¶
Get an element by ID.
- validate()¶
Validate all elements, raising an exception if an error is found.
Note
This is not extensive.
Top-level Elements¶
- class ear.fileio.adm.elements.main_elements.ADMElement(id=None, is_common_definition=False)¶
base class for top-level ADM elements
- class ear.fileio.adm.elements.AudioProgramme(id=None, is_common_definition=False, audioProgrammeName=None, audioProgrammeLanguage=None, start=None, end=None, maxDuckingDepth=None, audioContents=NOTHING, audioContentIDRef=NOTHING, referenceScreen=PolarScreen(aspectRatio=1.78, centrePosition=PolarPosition(azimuth=0.0, elevation=0.0, distance=1.0), widthAzimuth=58.0), loudnessMetadata=NOTHING)¶
ADM audioProgramme
- start¶
- Type
Optional[fractions.Fraction]
- end¶
- Type
Optional[fractions.Fraction]
- audioContents¶
audioContent elements referenced via audioContentIDRef
- Type
- referenceScreen¶
- Type
Optional[Union[CartesianScreen, PolarScreen]]
- loudnessMetadata¶
- Type
- class ear.fileio.adm.elements.AudioContent(id=None, is_common_definition=False, audioContentName=None, audioContentLanguage=None, loudnessMetadata=NOTHING, dialogue=None, audioObjects=NOTHING, audioObjectIDRef=None)¶
ADM audioContent
- loudnessMetadata¶
- Type
- audioObject¶
- Type
- class ear.fileio.adm.elements.AudioObject(id=None, is_common_definition=False, audioObjectName=None, start=None, duration=None, importance=None, interact=None, disableDucking=None, dialogue=None, audioPackFormats=NOTHING, audioTrackUIDs=NOTHING, audioObjects=NOTHING, audioComplementaryObjects=NOTHING, audioPackFormatIDRef=None, audioTrackUIDRef=None, audioObjectIDRef=None, audioComplementaryObjectIDRef=None)¶
ADM audioObject
- start¶
- Type
Optional[fractions.Fraction]
- duration¶
- Type
Optional[fractions.Fraction]
- audioPackFormats¶
- Type
- audioTrackUIDs¶
- Type
- audioObjects¶
- Type
- audioComplementaryObjects¶
- Type
- class ear.fileio.adm.elements.AudioPackFormat(id=None, is_common_definition=False, audioPackFormatName=None, type=None, absoluteDistance=None, audioChannelFormats=NOTHING, audioPackFormats=NOTHING, importance=None, encodePackFormats=NOTHING, inputPackFormat=None, outputPackFormat=None, normalization=None, nfcRefDist=None, screenRef=None, audioChannelFormatIDRef=None, audioPackFormatIDRef=None, encodePackFormatIDRef=None, decodePackFormatIDRef=None, inputPackFormatIDRef=None, outputPackFormatIDRef=None)¶
ADM audioPackformat
- type¶
typeDefintionand/ortypeLabel- Type
- audioChannelFormats¶
- Type
- audioPackFormats¶
- Type
- encodePackFormats¶
Only for type==Matrix. Encode and decode pack references are a single binary many-many relationship; we only store one side.
- Type
- inputPackFormat¶
Only for type==Matrix.
- Type
Optional[AudioPackFormat]
- outputPackFormat¶
Only for type==Matrix.
- Type
Optional[AudioPackFormat]
- class ear.fileio.adm.elements.AudioChannelFormat(id=None, is_common_definition=False, audioChannelFormatName=None, type=None, audioBlockFormats=NOTHING, frequency=NOTHING)¶
ADM audioChannelFormat
- type¶
typeDefintionand/ortypeLabel- Type
- audioBlockFormats¶
- Type
- class ear.fileio.adm.elements.AudioTrackFormat(id=None, is_common_definition=False, audioTrackFormatName=None, format=None, audioStreamFormat=None, audioStreamFormatIDRef=None)¶
ADM audioTrackFormat
- format¶
formatDefintionand/orformatLabel- Type
- audioStreamFormat¶
- Type
Optional[AudioStreamFormat]
- class ear.fileio.adm.elements.AudioStreamFormat(id=None, is_common_definition=False, audioStreamFormatName=None, format=None, audioChannelFormat=None, audioPackFormat=None, audioTrackFormatIDRef=None, audioChannelFormatIDRef=None, audioPackFormatIDRef=None)¶
ADM audioStreamFormat
- format¶
formatDefintionand/orformatLabel- Type
- audioChannelFormat¶
- Type
Optional[AudioStreamFormat]
- audioPackFormat¶
- Type
Optional[AudioPackFormat]
- class ear.fileio.adm.elements.AudioTrackUID(id=None, is_common_definition=False, trackIndex=None, sampleRate=None, bitDepth=None, audioTrackFormat=None, audioPackFormat=None, audioTrackFormatIDRef=None, audioPackFormatIDRef=None)¶
ADM audioTrackUID
- audioTrackFormat¶
- Type
Optional[AudioTrackFormat]
- audioPackFormat¶
- Type
Optional[AudioPackFormat]
Common Sub-Elements¶
- class ear.fileio.adm.elements.TypeDefinition(value)¶
Bases:
enum.EnumADM type definitions, representing
typeDefintionandtypeLabelattributes.- Binaural = 5¶
- DirectSpeakers = 1¶
- HOA = 4¶
- Matrix = 2¶
- Objects = 3¶
- class ear.fileio.adm.elements.FormatDefinition(value)¶
Bases:
enum.EnumADM format definitions, representing
formatDefintionandformatLabelattributes.- PCM = 1¶
- class ear.fileio.adm.elements.LoudnessMetadata(loudnessMethod=None, loudnessRecType=None, loudnessCorrectionType=None, integratedLoudness=None, loudnessRange=None, maxTruePeak=None, maxMomentary=None, maxShortTerm=None, dialogueLoudness=None)¶
ADM loudnessMetadata
Common Types¶
- class ear.fileio.adm.elements.ScreenEdgeLock(horizontal=None, vertical=None)¶
ADM screenEdgeLock information from position elements
audioBlockFormat types¶
- class ear.fileio.adm.elements.AudioBlockFormat(id=None, rtime=None, duration=None)¶
ADM audioBlockFormat base class
- rtime¶
- Type
Optional[fractions.Fraction]
- duration¶
- Type
Optional[fractions.Fraction]
Objects audioBlockFormat¶
- class ear.fileio.adm.elements.AudioBlockFormatObjects(id=None, rtime=None, duration=None, position=None, cartesian=False, width=0.0, height=0.0, depth=0.0, gain=1.0, diffuse=0.0, channelLock=None, objectDivergence=None, jumpPosition=NOTHING, screenRef=False, importance=10, zoneExclusion=NOTHING)¶
Bases:
ear.fileio.adm.elements.AudioBlockFormatADM audioBlockFormat with typeDefinition == “Objects”
- position¶
- Type
Optional[ObjectPosition]
- channelLock¶
- Type
Optional[ChannelLock]
- objectDivergence¶
- Type
Optional[ObjectDivergence]
- jumpPosition¶
- Type
- zoneExclusion¶
- Type
list[Union[CartesianZone, PolarZone]]
- class ear.fileio.adm.elements.CartesianZone(minX, minY, minZ, maxX, maxY, maxZ)¶
ADM zoneExclusion zone element with Cartesian coordinates
- class ear.fileio.adm.elements.PolarZone(minElevation, maxElevation, minAzimuth, maxAzimuth)¶
ADM zoneExclusion zone element with polar coordinates
- class ear.fileio.adm.elements.ChannelLock(maxDistance=None)¶
ADM channelLock element
- class ear.fileio.adm.elements.JumpPosition(flag=False, interpolationLength=None)¶
ADM jumpPosition element
- interpolationLength¶
- Type
Optional[fractions.Fraction]
- class ear.fileio.adm.elements.ObjectDivergence(value, azimuthRange=None, positionRange=None)¶
ADM objectDivergence element
- class ear.fileio.adm.elements.ObjectPosition¶
Base for classes representing data contained in audioBlockFormat position elements for Objects.
See also
- class ear.fileio.adm.elements.ObjectPolarPosition(azimuth, elevation, distance=1.0, screenEdgeLock=NOTHING)¶
Bases:
ear.fileio.adm.elements.ObjectPosition,ear.common.PolarPositionMixinRepresents data contained in audioBlockFormat position elements for Objects where polar coordinates are used.
Attributes are formatted according to the ADM coordinate convention.
- screenEdgeLock¶
- Type
- class ear.fileio.adm.elements.ObjectCartesianPosition(X, Y, Z, screenEdgeLock=NOTHING)¶
Bases:
ear.fileio.adm.elements.ObjectPosition,ear.common.CartesianPositionMixinRepresents data contained in audioBlockFormat position elements for Objects where Cartesian coordinates are used.
Attributes are formatted according to the ADM coordinate convention.
- screenEdgeLock¶
- Type
DirectSpeakers audioBlockFormat¶
- class ear.fileio.adm.elements.AudioBlockFormatDirectSpeakers(id=None, rtime=None, duration=None, position=None, speakerLabel=NOTHING)¶
Bases:
ear.fileio.adm.elements.AudioBlockFormatADM audioBlockFormat with typeDefinition == “DirectSpeakers”
- position¶
- class ear.fileio.adm.elements.BoundCoordinate(value, min=None, max=None)¶
ADM position coordinate for DirectSpeakers
This represents multiple position elements with the same coordinate, so for azimuth this translates to:
<position coordinate="azimuth">{value}</position> <position coordinate="azimuth" bound="min">{min}</position> <position coordinate="azimuth" bound="max">{max}</position>
Attributes are formatted according to the ADM coordinate convention.
- class ear.fileio.adm.elements.DirectSpeakerPosition¶
Base for classes representing data contained in audioBlockFormat position elements for DirectSpeakers.
See also
DirectSpeakerPolarPositionandDirectSpeakerCartesianPosition
- class ear.fileio.adm.elements.DirectSpeakerPolarPosition(bounded_azimuth, bounded_elevation, bounded_distance=NOTHING, screenEdgeLock=NOTHING)¶
Bases:
ear.fileio.adm.elements.DirectSpeakerPosition,ear.common.PolarPositionMixinRepresents data contained in audioBlockFormat position elements for DirectSpeakers where polar coordinates are used.
Attributes are formatted according to the ADM coordinate convention.
- bounded_azimuth¶
data for position elements with
coordinate="azimuth"- Type
- bounded_elevation¶
data for position elements with
coordinate="elevation"- Type
- bounded_distance¶
data for position elements with
coordinate="distance"- Type
- screenEdgeLock¶
- Type
- as_cartesian_array()¶
Get the position as a Cartesian array.
- Returns
equivalent X, Y and Z coordinates
- Return type
np.array of shape (3,)
- class ear.fileio.adm.elements.DirectSpeakerCartesianPosition(bounded_X, bounded_Y, bounded_Z, screenEdgeLock=NOTHING)¶
Bases:
ear.fileio.adm.elements.DirectSpeakerPosition,ear.common.CartesianPositionMixinRepresents data contained in audioBlockFormat position elements for DirectSpeakers where Cartesian coordinates are used.
- bounded_X¶
data for position elements with
coordinate="X"- Type
- bounded_Y¶
data for position elements with
coordinate="Y"- Type
- bounded_Z¶
data for position elements with
coordinate="Z"- Type
- screenEdgeLock¶
- Type
HOA AudioBlockFormat¶
- class ear.fileio.adm.elements.AudioBlockFormatHoa(id=None, rtime=None, duration=None, equation=None, order=None, degree=None, normalization=None, nfcRefDist=None, screenRef=None)¶
Bases:
ear.fileio.adm.elements.AudioBlockFormatADM audioBlockFormat with typeDefinition == “HOA”
Matrix AudioBlockFormat¶
- class ear.fileio.adm.elements.AudioBlockFormatMatrix(id=None, rtime=None, duration=None, outputChannelFormat=None, matrix=NOTHING, outputChannelFormatIDRef=None)¶
Bases:
ear.fileio.adm.elements.AudioBlockFormatADM audioBlockFormat with typeDefinition == “Matrix”
- outputChannelFormat¶
- Type
Optional[AudioChannelFormat]
- matrix¶
- Type
- class ear.fileio.adm.elements.MatrixCoefficient(inputChannelFormat=None, gain=None, gainVar=None, phase=None, phaseVar=None, delay=None, delayVar=None, inputChannelFormatIDRef=None)¶
ADM audioBlockFormat Matrix coefficient element
- inputChannelFormat¶
- Type
Optional[AudioChannelFormat]