sharpness_din_st#
- sharpness_din_st(signal, fs, weighting='din', field_type='free')[source]#
Compute the sharpness value from a time signal (optionally segmented)
This function computes the DIN.45692:2009 sharpness value according to different methods.
- Parameters:
signal (array_like) – Input time signal in [Pa], dim (nperseg, nseg)
fs (float) – Sampling frequency
weighting ({'din', 'aures', 'bismarck', 'fastl'}) – Weighting function used for the sharpness computation. Default is ‘din’
field_type ({'free', 'diffuse'}) – Type of soundfield. Default is ‘free’
- Returns:
S – Sharpness value in [acum], dim (nseg)
- Return type:
float
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_from_loudnessSharpness computation from loudness values
sharpness_din_tvSharpness computation for a time-varying signal
sharpness_din_persegSharpness computation by time-segment
sharpness_din_freqSharpness computation from a sound spectrum
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 according to Zwicker method for stationary signals.
- 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 sharpness_din_st >>> 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) >>> 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 >>> S = sharpness_din_st(stimulus, fs=fs) >>> plt.plot(time, stimulus) >>> plt.xlim(0, 0.05) >>> plt.xlabel("Time [s]") >>> plt.ylabel("Amplitude [Pa]") >>> plt.title("Sharpness = " + f"{S:.2f}" + " [Acum]")
(
Source code,png,hires.png,pdf)