Check if Zwicker method can be applied and raise ValueError if it can't #18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The following small Python program demonstrate the problem:
Giving the following error:
The spectrum is actually from a very loud but real data source. I do of course acknowledge that the loudness can't be computed for this data, but instead of throwing a random out-of-bounds error (indicating a programming error) it should give a ValueError that can be understood and handled by the user.
I was in doubt as of where the check should be performed, but since the
calc_main_loudness
is the first common routine for both stationary and non-stationary signals I thought that was the best place.