sharpness_din_from_loudness#
- sharpness_din_from_loudness(N, N_specific, weighting='din')[source]#
Compute the sharpness value from loudness
This function computes the sharpness value according to different methods.
- Acoustic sharpness calculation according to different methods
(Aures, Von Bismarck, DIN 45692, Fastl) from loudness.
- Parameters:
N (float or array_like) – Overall loudness [sones], size (Ntime,).
N_specific (numpy.ndarray) – Specific loudness array [sones/bark], size (Nbark, Ntime).
weighting ({'din', 'aures', 'bismarck', 'fastl'}) – Weighting function used for the sharpness computation. Default is ‘din’
- Returns:
S (float or numpy.ndarray) – Sharpness value in [acum], dim (nseg)
time_axis (numpy.array) – Time axis cut according to skip argument, size (Ntime,).
Warning
The sampling frequency of the signal must be >= 48 kHz to fulfill requirements. If the provided signal doesn’t meet the requirements, it will be resampled.
See also
sharpness_din_tvSharpness computation for a non-stationary time signal
sharpness_din_stSharpness computation for a stationary time signal
sharpness_din_freqSharpness computation from a sound spectrum
sharpness_din_persegSharpness computation by time-segment
Notes
The computation consists of a specific loudness weighting employing a weighting function \(g(z)\):
\[S=0.11\frac{\int_{0}^{24Bark}N'(z)g(z)\textup{dz}}{N}\]with \(N'\) the specific loudness and \(N\) the global loudness.
- The different methods available with the function account for the weighting function applied:
DIN 45692 : weighting defined in the standard
Aures
Bismarck
Fastl
References
[1]DIN.45692:2009. Measurement technique for the simulation of the auditory sensation of sharpness. Deutsches Institut fur Normung, 2009. URL: https://www.normadoc.com/english/din-45692-2009-08.html?___from_store=french.
[2]E.Zwicker and H.Fastl. Psychoacoustics. Springer Berlin, 2007. URL: https://link.springer.com/book/10.1007/978-3-540-68888-4.
[3]E. von Bismarck. Sharpness as an attribute of the timbre of steady sounds. Acta Acustica, 1974. URL: https://www.ingentaconnect.com/contentone/dav/aaua/1974/00000030/00000003/art00006.
Examples
>>> from mosqito.sq_metrics import loudness_zwtv, sharpness_din_from_loudness >>> import matplotlib.pyplot as plt >>> import numpy as np >>> f=1000 >>> fs=48000 >>> d=0.2 >>> dB=60 >>> time = np.arange(0, d, 1/fs) >>> f = np.linspace(1000,5000, len(time)) >>> stimulus = 0.5 * (1 + np.sin(2 * np.pi * f * time)) >>> rms = np.sqrt(np.mean(np.power(stimulus, 2))) >>> ampl = 0.00002 * np.power(10, dB / 20) / rms >>> stimulus = stimulus * ampl >>> N, N_spec, bark_axis, time_axis = loudness_zwtv(stimulus, fs=fs) >>> S = sharpness_din_from_loudness(N, N_spec) >>> plt.plot(time_axis, S) >>> plt.xlabel("Time [s]") >>> plt.ylabel("Sharpness [Acum]")
(
Source code,png,hires.png,pdf)
Warning
Note the transient effect at the beginning of the signal.