Skip to content

[FIX] take the band edges from the exact mid-band frequencies (IEC 61260-1) - #129

Open
aguirreSL wants to merge 1 commit into
PyTTaMaster:developmentfrom
aguirreSL:dev-fix_band_edges
Open

aguirreSL wants to merge 1 commit into
PyTTaMaster:developmentfrom
aguirreSL:dev-fix_band_edges

Conversation

@aguirreSL

Copy link
Copy Markdown

Summary

fractional_octave_frequencies computed the edges of each band from its nominal mid-band frequency (125 Hz, 16 kHz) where IEC 61260-1:2014 takes them from the exact one (125.89 Hz, 15 848.9 Hz). The filters of OctFilter were therefore centred up to 0.95 % away from where the standard places them, and the octave filter at 16 kHz fell outside the class 1 limits at its upper edge. This pull request takes the edges from the exact mid-band frequency and keeps the nominal one as the label of the band.

What the standard asks

For filter sets with an odd denominator b, IEC 61260-1:2014 sets the exact mid-band frequency to f_m = f_r G^(x/b), with G = 10^(3/10) and f_r = 1000 Hz (Eq. 2). The band edges are f_1 = f_m G^(-1/(2b)) and f_2 = f_m G^(+1/(2b)) (Eq. 4 and 5), and the nominal frequencies of Annex E only label the bands (5.5).

What was found

The geometric centres of the edges were the nominal frequencies, with these offsets from the exact ones in octave bands:

Nominal 31.5 Hz 125 Hz 250 Hz 1 kHz 4 kHz 8 kHz 16 kHz
Offset of the centre −0.39 % −0.71 % −0.47 % 0 +0.48 % +0.71 % +0.95 %

Evaluated around the exact mid-band frequencies, the order 4 octave filters of OctFilter meet the class 1 limits of Table 1 in every band from 31.5 Hz to 8 kHz. At 16 kHz the relative attenuation just above the upper band edge was 0.97 dB, where Table 1 asks for at least 1.2 dB. The one-third octave filters meet the limits of Table F.1 in every band from 25 Hz to 20 kHz, before and after this change.

The table of nominal frequencies also read 0.6, 3., 0.8 where Annex E gives 0.63 and 0.8, which mislabelled the band of 0.63 Hz.

The change

  1. In fractional_octave_frequencies the edges come from the exact mid-band frequency refFreq * base**(x * factor / nthOct), and the nominal frequency nearest to it stays in the middle column as the label. OctFilter, RoomAnalysis and the other users of the edges get the exact bands without further change.
  2. The nominal table reads 0.63 and 0.8.

Unchanged

For an even denominator (1/6, 1/12, 1/24 octave) the standard places the mid-band frequencies at f_r G^((2x+1)/(2b)) (Eq. 3), so that 1000 Hz is an edge and not a centre, while PyTTa uses G^(x/b) for every denominator. Following Eq. 3 would change the numbering of the bands in freq_to_band and in everything that counts bands, which is a decision for the maintainers, so this pull request leaves it as it is.

Tests

The tests in tests/test_band_edges.py check the rule and the class 1 limits:

  1. The edges of the octave and one-third octave bands equal f_m G^(∓1/(2b)) for consecutive band numbers x, within 1e-12, and the nominal labels stay 125 Hz and 0.63 Hz.
  2. Every octave filter from 31.5 Hz to 16 kHz meets the class 1 limits of Table 1 around its exact mid-band frequency.
  3. Every one-third octave filter from 25 Hz to 20 kHz meets the class 1 limits of Table F.1 around its exact mid-band frequency.

The first two fail without this change. On a branch that merges all my open pull requests, the 309 tests pass with this change. Checked with Python 3.12, numpy 1.26 and scipy 1.17. The 7 failures of development (3 in test_h5io.py, 4 in test_pyttasave.py) are the same with and without this change.

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com

…260-1)

fractional_octave_frequencies computed the band edges from the nominal
mid-band frequency, up to 0.95 % off the exact one, which put the 16 kHz
octave filter outside the class 1 limits of IEC 61260-1 at its upper
edge. The edges now follow Eq. 2, 4 and 5 of the standard, and the nominal
frequency stays as the label. The nominal table read 0.6, 3. for 0.63.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant