roughness_ecma#
- roughness_ecma(signal, fs)[source]#
Calculation of the specific and total roughness according to ECMA-418-2 (2nd Ed, 2022).
This function computes the acoustic loudness according to ECMA-418-2 (section 7) method for stationary signals. The calculation is based on the Hearing Model (HMS) used in loudness_ecma aswell.
- Parameters:
signal (numpy.array) – Signal time values [Pa]. The sampling frequency of the signal must be 48000 Hz.
fs (int) – Sampling frequency [Hz].
- Returns:
R (float) – Overall roughness representative value [asper_HMS].
R_time (numpy.ndarray) – Roughness over time [asper_HMS], size (Ntime,).
R_specific (numpy.ndarray) –
- Specific roughness [asper_HMS/bark], size (Nbark, Ntime).
Each of the 53 elements of the list corresponds to the time-dependant specific roughness for a given bark band.
bark_axis (numpy.ndarray) – Corresponding bark axis, size (Nbark,).
time_axis (numpy.ndarray) – Time axis, size (Ntime,).
Warning
The sampling frequency of the signal must be 48 kHz.
See also
roughness_dwDaniel and Weber roughness computation
loudness_ecmaLoudness computation based on the hearing model of ECMA 418-2
References
[1]ECMA.418-2:2022. Psychoacoustic metrics for ITT equipment — Part 2 (models based on human perception). European Computer Manufacturers Association, 2022. URL: https://www.ecma-international.org/wp-content/uploads/ECMA-418-2_2nd_edition_december_2022.pdf?trk=organization_guest_main-feed-card_reshare-text.
Examples
>>> from mosqito.sq_metrics import roughness_ecma >>> import matplotlib.pyplot as plt >>> import numpy as np >>> f=1000 >>> fs=48000 >>> d=1 >>> dB=60 >>> fmod = 70 >>> fc = 1000 >>> mdepth = 1 >>> time = np.arange(0, d, 1/fs) >>> signal = (0.5* (1 + mdepth * (np.sin(2 * np.pi * fmod * time))) >>> * np.sin(2 * np.pi * fc * time) >>> ) >>> rms = np.sqrt(np.mean(np.power(signal, 2))) >>> ampl = 0.00002 * np.power(10, dB / 20) / rms >>> stimulus = signal * ampl >>> R, R_time, R_spec, bark_axis, time_axis = roughness_ecma(stimulus, fs) >>> plt.step(bark_axis, R_spec) >>> plt.xlabel("Bark axis [Bark]") >>> plt.ylabel("Specific roughness [Asper/Bark]") >>> plt.title("Roughness = " + f"{R:.2f}" + " [Asper]")
(
Source code,png,hires.png,pdf)