Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Hanning window correction in Tonality analysis #255

@thvanbon

Description

@thvanbon

I am confused about the Tonality class in iso_1996_2_2007.py.

On line 34 of iso_1996_2_2007.py a correction for Hanning windows is defined:
_WINDOW_CORRECTION = { 'hanning': -1.8, }

This correction is subtracted from the total level of the sum of all lines of the tones in the cricital band on line 505, so effectively 1.8 dB is added:
tone_level = tones_level(tone_lines) - window_correction(window)

I understand the reason for a 1.8 dB correction is explained in the note after equation C.1 in ISO 1996-2: 2007:

NOTE If a 'tone' is a narrow band of noise, or if the frequency of a tone varies, the tone appears as several lines in the averaged spectrum. In such cases, the tone level, L_pt, is the energy sum of all lines, with levels within 6 dB of the local maximum level and corrected for the influence of the applied window function. (For Hanning weighting, this is the energy sum of the lines minus 1.8 dB.)

I believe the same correction is applied when calculating the total masking noise level in equation C.11, calculated with the function on line 78:
return dbsum(noise_lines) + 10.0 * np.log10(frequency_resolution / effective_analysis_bandwidth)
When using a Hanning window this is roughly equivalent to:
return dbsum(noise_lines) - 1.8

So to summarise I would expect on line 505 the -1.8 dB should be added to the total tone level. I hope somebody can shed some light on this. Any help would be greatly appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions