Skip to content

Commit

Permalink
Check if Zwicker method can be applied and raise ValueError if it can't
Browse files Browse the repository at this point in the history
Ref. ISO 532-1:2017 paragraph A.3

The table A.3 giving the weights of the 1/3 band levels for
center freq. below 300 Hz is only specified for levels up to 120 dB
If one of the first 11 bands (from 25 to 250 Hz) exceed 120 dB the
Zwicker method cannot be applied.
  • Loading branch information
hakostra committed Sep 2, 2021
1 parent 116f3f5 commit 1cf0056
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mosqito/functions/loudness_zwicker/loudness_zwicker_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ def calc_main_loudness(spec_third, field_type):
nm : numpy.ndarray
Core loudness
"""
# Ref. ISO 532-1:2017 paragraph A.3
# The table A.3 giving the weights of the 1/3 band levels for
# center freq. below 300 Hz is only specified for levels up to 120 dB
# If one of the first 11 bands (from 25 to 250 Hz) exceed 120 dB the
# Zwicker method cannot be applied.
if np.max(spec_third[0:11]) > 120.0:
raise ValueError("1/3 octave band value exceed 120 dB, for which " +
"the Zwicker method is no longer valid.")

#
# Date tables definition (variable names and description according to
# Zwicker:1991)
Expand Down

0 comments on commit 1cf0056

Please sign in to comment.