Calculate the clarity from the energy decay curve (EDC).
The clarity parameter (C50 or C80) is defined as the ratio of early-to-late
arriving energy in an impulse response and is a measure for how clearly
speech or music can be perceived in a room. The early-to-late boundary is
typically set at 50 ms (C50) or 80 ms (C80) [1].
where \(t_e\) is the early time limit and \(p(t)\) is the pressure
of a room impulse response. Here, the clarity is efficiently computed
from the EDC \(e(t)\)
energy_decay_curve (pyfar.TimeData) – Energy decay curve (EDC) of the room impulse response
(time-domain signal). The EDC must start at time zero.
early_time_limit (float, optional) – Early time limit (\(t_e\)) in milliseconds. Defaults to 80 (C80).
Typical values are 50 ms (C50) or 80 ms (C80) [1].
Returns:
clarity – Clarity index (early-to-late energy ratio) in decibels,
shaped according to the channel shape of the input EDC.
Calculate the definition from the energy decay curve (EDC).
The definition parameter (D50) is defined as the ratio of early-to-total
arriving energy in an impulse response and is a measure for how defined
speech or music can be perceived in a room. The early-to-total boundary is
typically set at 50 ms (D50) [2].
where \(t_e\) is the early time limit and \(p(t)\) is the pressure
of a room impulse response. Here, the definition is efficiently computed
from the EDC \(e(t)\) directly by:
The early lateral energy fraction \(J_\mathrm{LF}\)
according to [3] is defined as the ratio between the
lateral sound energy captured with a figure of eight microphone
arriving between 5 ms and 80 ms and the total sound energy
captured with an omnidirectional microphone arriving within
the first 80 ms after the direct sound. It is a measure of the
apparent source width.
where \(p_\mathrm{L}(t)\) is the lateral sound pressure measured with a
figure-eight microphone whose zero axis is oriented towards the source,
and \(p(t)\) is the sound pressure measured at the same position
with an omnidirectional microphone.
Using the energy decay curves of the omnidirectional response
\(e(t)\) and the lateral response \(e_\mathrm{L}(t)\), the
parameter can be computed efficiently as
energy_decay_curve_omni (pyfar.TimeData) – Energy decay curve of the room impulse response measured with an
omnidirectional microphone. The EDC must start at time zero.
energy_decay_curve_lateral (pyfar.TimeData) – Energy decay curve of the room impulse response measured with a
figure-eight microphone oriented according to [3]
(zero axis pointing towards the source). The EDC must start at
time zero.
Both EDCs must have identical signal.cshape.
Returns:
Early Lateral Energy Fraction – Early lateral energy fraction (\(J_\mathrm{LF}\)),
shaped according to the channel shape of the input EDCs.
The late lateral sound level \(L_\mathrm{J}\) quantifies the strength
of late-arriving lateral sound energy. According to ISO 3382-1 [4],
it is defined as the level ratio between the late lateral sound energy
captured with a figure-of-eight microphone and the total sound energy of a
reference impulse response measured with an omnidirectional microphone at
a distance of 10 m in the free field. It is a measure of listener
envelopment.
where \(p_\mathrm{L}(t)\) is the lateral sound pressure measured with a
figure-eight microphone whose zero axis is oriented towards the source,
and \(p_{10}(t)\) is the instantaneous sound pressure of the
impulse response measured with an omnidirectional microphone
at 10 m distance in the free field.
Using the energy decay curves of the reference response
\(e_{10}(t)\) and the lateral response \(e_\mathrm{L}(t)\),
the parameter can be computed efficiently as
energy_decay_curve_free_field (pyfar.TimeData) – Energy decay curve of the reference free field impulse response
measured vwith an omnidirectional microphone at 10 m distance in the
free field. The EDC must start at time zero.
Energy decay curve of the room impulse response measured with a
figure-eight microphone oriented according to [4]
(zero axis pointing towards the source). The EDC must start at
time zero.
Both EDCs must have identical signal.cshape.
Returns:
Late Lateral Sound Level – Late lateral sound level (\(L_\mathrm{J}\)) in decibels,
shaped according to the channel shape of the input EDCs.
Compute the modulation transfer function (MTF) of an impulse response
according to IEC 60268-16:2020.
The MTF describes the reduction of modulation depth caused by the
transmission path. It is evaluated for 7 octave bands (125 Hz–8 kHz)
and 14 modulation frequencies (0.63 Hz–12.5 Hz) and forms the basis
of the Speech Transmission Index (STI).
Parameters:
rir (pyfar.Signal) – Single-channel room impulse response with rir.cshape=(1,).
The room impulse response must be at least 1.6 seconds long.
rir_type ({'electrical', 'acoustical'}, optional) – Determines whether input signals given by rir were obtained
acoustically or electrically. Default is 'acoustical'.
Auditory masking effects are only applied for acoustical
signals [5], section A.3.1.
level (numpy.ndarray or None, optional) – Test signal level without noise in dB SPL, given per octave band
(125 Hz–8 kHz). Shape must be (7,) (7 octave bands: 125 Hz–8 kHz).
If None is provided, auditory and ambient noise corrections are
omitted. Default is None. See [5], section A.3.2.
snr (numpy.ndarray or float, optional) – Signal-to-noise ratio in dB for each octave band (125 Hz–8 kHz).
Shape must be (7,) (7 octave bands: 125 Hz–8 kHz).
Default is np.inf (no ambient noise). See [5], section 3.
ambient_noise_correction (bool, optional) – Apply ambient noise correction according to [5],
Annex A.2.3. Default is True. Only applied when
levelisnotNone and ambient_noise_correctionisTrue.
Returns:
mtf – Modulation transfer function with shape (7,14).
pyfar uses octave-band filters of order 14 and the filter order
influences the MTF. Higher filter orders produce steeper roll-off and
a more ideal band separation, which affects the energy distribution
within each octave band and thus the computed modulation depth.
The influence on the broadband STI is negligible, since individual
deviations in the MTF tend to average out in the weighted sum over
octave bands and modulation frequencies.
Estimate the reverberation time from a given energy decay curve.
The linear regression is performed using least squares error minimization
according to the ISO standard 3382 [6].
Parameters:
energy_decay_curve (pyfar.TimeData) – Energy decay curve.
T ('T15', 'T20', 'T30', 'T40', 'T50', 'T60', 'EDT', 'LDT') – Decay interval to be used for the reverberation time extrapolation. EDT
corresponds to the early decay time extrapolated from the interval
[0,-10] dB, LDT corresponds to the late decay time extrapolated
from the interval [-25,-35] dB.
return_intercept (bool) – If True, the function returns the intercept of the linear regression,
which corresponds to the amplitude of the energy decay curve on a
linear scale. The default is False.
Returns:
reverberation_time – The reverberation time
Return type:
double
References
Examples
Estimate the reverberation time from an energy decay curve.
Calculate the room-acoustic strength parameter (\(G\)).
The strength parameter (\(G\)) is defined as the ratio between the
total arriving sound energy and the total arriving sound energy
of a reference free-field response measured at 10 m with the same
source. It is a measure of the room-induced level amplification
at the receiver position [7].
where \(p(t)\) is the room sound pressure and
\(p_\mathrm{10}(t)\) is the reference free-field sound pressure
at 10 m measured with the same loudspeaker.
Using the energy decay curves of the room response
\(e(t)\) and the reference response
\(e_\mathrm{10}(t)\), the
parameter can be computed efficiently as
energy_decay_curve_room (pyfar.TimeData) – Energy decay curve of the room impulse response. The EDC must
start at time zero.
energy_decay_curve_free_field (pyfar.TimeData) – Energy decay curve of the reference free-field impulse response
at 10 m. The EDC must start at time zero.
Both EDCs must have identical signal.cshape.
Returns:
strength – Strength parameter (\(G\)) in decibels,
shaped according to the channel shape of the input EDC.
Computes the Speech Transmission Index (STI) according to
IEC 60268-16:2020 using the indirect method.
The STI is a scalar measure between 0 (bad) and 1 (excellent)
describing speech intelligibility. It is computed from the
modulation_transfer_function, optionally including auditory
masking and ambient noise effects.
STI considers 7 octave bands from 125 Hz to 8 kHz
and 14 modulation frequencies between 0.63 Hz and
12.5 Hz [8].
Parameters:
rir (pyfar.Signal) – Single or multi-channel room impulse response for which the
STI is computed. The room impulse response must be at least
1.6 seconds long. See [8], Section 6.2.
rir_type ('electrical', 'acoustical') – Determines whether input signals given by rir were obtained
acoustically or electrically. Default is 'acoustical'.
Auditory masking effects are only applied for acoustical
signals [8], section A.3.1.
level (numpy.ndarray or None, optional) – Test signal level without noise in dB SPL, given per octave band
(125 Hz–8 kHz). Shape can be (7,) (7 octave bands: 125 Hz–8 kHz)
to use the same values for all channels, or (rir.cshape,7)
for channel-specific values.
If None is provided, auditory and ambient noise corrections are
omitted. See [8], section A.3.2.
snr (numpy.ndarray or float, optional) – Signal-to-noise ratio in dB for each octave band (125 Hz–8 kHz).
Shape can be (7,) (7 octave bands: 125 Hz–8 kHz)
to use the same values for all channels, or (rir.cshape,7)
for channel-specific values.
Default is np.inf (no ambient noise). See [8], section 3.
ambient_noise_correction (bool, optional) – Apply ambient noise correction according to [8],
Annex A.2.3. Default is True. Only applied when
levelisnotNone and ambient_noise_correctionisTrue.
Returns:
sti – Channel-wise Speech Transmission Index with shape rir.cshape.
pyfar uses octave-band filters of order 14 and the filter order
influences the MTF. Higher filter orders produce steeper roll-off and
a more ideal band separation, which affects the energy distribution
within each octave band and thus the computed modulation depth.
The influence on the broadband STI is negligible, since individual
deviations in the MTF tend to average out in the weighted sum over
octave bands and modulation frequencies.