roughness_dw#

roughness_dw(signal, fs, overlap=0.5)[source]#

Computes the roughness according to Daniel and Weber method from a time signal

This function computes the global and specific roughness values of a signal sampled at 48 kHz.

Parameters:
  • signal (array_like or DataTime object) – Input time signal in Pa

  • fs (float) – Sampling frequency [Hz]

  • overlap (float) – Overlapping coefficient for the time windows of 200ms

Returns:

  • R (numpy.array) – Roughness value in [asper]

  • R_spec (numpy.array) – Specific roughness over bark axis

  • bark_axis (numpy.array) – Frequency axis in [bark]

  • time (numpy.array) – Time axis in [s]

See also

roughness_dw_freq

Roughness computation from a sound spectrum

Notes

The model consists of a parallel processing structure made up of successive stages to calculate intermediate specific roughnesses \(R'\), which are summed up to determine the total roughness \(R\):

\[R=0.25\sum_{i=1}^{47}R'_{i}\]

References

[1]

P. Daniel and R. Weber. Psychoacoustical roughness: implementation of an optimized model. Acta Acustica, Vol. 83: 113-123, 1997. URL: https://www.ingentaconnect.com/contentone/dav/aaua/1997/00000083/00000001/art00020.

Examples

>>> from mosqito.sq_metrics import roughness_dw
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> fc=1000
>>> fmod=70
>>> fs=44100
>>> d=0.2
>>> dB=60
>>> time = np.arange(0, d, 1/fs)
>>> stimulus = (0.5 * (1 + np.sin(2 * np.pi * fmod * time))* np.sin(2 * np.pi * fc * time))
>>> rms = np.sqrt(np.mean(np.power(stimulus, 2)))
>>> ampl = 0.00002 * np.power(10, dB / 20) / rms
>>> stimulus = stimulus * ampl
>>> R, R_specific, bark, time = roughness_dw(stimulus, fs=44100, overlap=0)
>>> plt.plot(bark, R_specific)
>>> plt.xlabel("Bark axis [Bark]")
>>> plt.ylabel("Specific roughness [Asper/Bark]")
>>> plt.title("Roughness = " + f"{R[0]:.2f}" + " [Asper]")

(Source code, png, hires.png, pdf)

../../_images/mosqito-sq_metrics-roughness-roughness_dw-roughness_dw-1.png