Repository navigation
Conversation
tonal_audibility(signal) finds the tonal components of a noise and their audibility DeltaL = LT - LG - av, DIN 45681:2002: A-weighted spectrum averaged over Hann blocks with lines of 2 Hz, masking level of the critical band by iteration, tone level from the lines within 10 dB of the peak, distinctness by width and flank steepness, and the sum of the tones in one critical band. It is a port of ita_tonality of the ITA-Toolbox, whose BSD licence is reproduced in the module header. Three points differ from the MATLAB code and are documented: the frequency of each FFT line (ita_tonality reads each one 2 Hz high), the absolute scale of the levels (6 dB low there for tones and noise alike, so DeltaL is the same), and the ends of the search for a tone region, which stop at 100 Hz and 8192 Hz. Tests check a tone in white noise against the formula, parity with ita_tonality on golden data from tests/golden/make_din45681_ita.m (DeltaL within 0.005 dB, frequencies 2 Hz below ITA), that noise alone has no tone, and the rejection of invalid input. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds
pytta.din45681with the tonal audibility of DIN 45681:2002, asita_tonalityin the ITA-Toolbox (applications/Psychoacoustics).tonal_audibility(signal)takes one channel of sound pressure in Pa and returns the largest audibility DeltaL in dB, the frequency of that tone and a list with each tone found: its frequency, critical bandwidth, LS, LT, LG, av, DeltaL and DeltaL of its critical band. The method followsita_tonalitystep by step:The code is a port, so the licence of the ITA-Toolbox (BSD, four clauses) is reproduced in the module header, with the acknowledgment its third clause asks for. Three points differ from the MATLAB code, and the docstring states them:
ita_tonalitylabels FFT line k with the frequency (k + 1) df, so every frequency it reports is 2 Hz high. This module uses k df.The tone adjustment K_T of the standard is not computed, as in
ita_tonality.The tests in
tests/test_din45681.pyprint the measured differences:ita_tonalityon golden data fromtests/golden/make_din45681_ita.m(MATLAB R2026b, same samples): tones at 400 Hz, 1 kHz and 3 kHz in noise and two tones in one critical band give the DeltaL of ITA within 0.005 dB, the same number of tones, and frequencies 2 Hz below those of ITA.Checked with Python 3.12, numpy 1.26 and scipy 1.17. The 7 failures of
development(3 intest_h5io.py, 4 intest_pyttasave.py) are the same with and without this change.Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com