TonalityECMA418_2#
- class ansys.sound.core.psychoacoustics.TonalityECMA418_2(signal=None, field_type=None, edition=None)#
Computes ECMA-418-2 tonality.
This class is used to compute the tonality according to the ECMA-418-2 standard (Sottek Hearing Model), formerly known as ECMA-74, annex G.
Note
The releases of DPF Sound 2026 R1 and PyAnsys Sound 0.2 introduce the 3rd edition of ECMA-418-2, in addition to the 1st edition implemented in previous versions. Theoretically, the 1st and 3rd editions of ECMA-418-2 are supposed to describe the same algorithm of psychoacoustic tonality calculation. However, the standard does not include any real verification data and its 1st edition noticeably included errors and unclear computation details open to interpretation. The 3rd edition was largely improved in that regard, and now allow producing consistent results throughout distinct implementations of the standard. As a consequence, this 3rd edition is strongly recommended in most cases, while the 1st edition should only be used when backward compatibility is required.
Note
Prior to release 0.2 of PyAnsys Sound, only the 1st edition of ECMA-418-2 was proposed. Similarly, the calculation was only available in free field. Release 0.2 includes the possibility to use the 3rd edition of ECMA-418-2, and perform the calculation in diffuse field (with either edition), using the two new attributes
edition
andfield_type
. This means that older code using this class needs be updated with values assigned to these two attributes. This can be done either when instantiating the class:my_tonality = TonalityECMA418_2(my_signal, my_field_type, my_edition)
, or later, by setting the attributes:my_tonality.field_type = my_field_type
andmy_tonality.edition = my_edition
.Class instantiation takes the following parameters.
- Parameters:
- signal: Field, default: None
Signal in Pa on which to calculate the tonality.
- field_type: str, default: None
Sound field type. Available options are “Free” and “Diffuse”.
- edition: str, default: None
Edition of the ECMA-418-2 standard to use. Available options are “1st” and “3rd”, which correspond to the 2020 and 2024 versions of the ECMA-418-2 standard, respectively.
Methods
Convert a DPF fields container to a NumPy array.
Get the ECMA-418-2 tonality data, in a tuple containing data of various types.
Get the ECMA-418-2 tonality data, in a tuple of NumPy arrays.
Get the ECMA-418-2 tonality, in tuHMS.
Get the ECMA-418-2 tonality over time, in tuHMS.
Get the ECMA-418-2 tonality time scale, in s.
Get the ECMA-418-2 tone frequency over time, in Hz.
Get the ECMA-418-2 tone frequency time scale, in s.
Plot the ECMA-418-2's tonality and tone frequency over time.
Compute the ECMA-418-2 tonality.
Attributes
Edition of the ECMA-418-2 standard to use.
Sound field type.
Input signal in Pa.