Give psychoacoustics two families - #479
Conversation
Loudness and sound quality are the two halves every text on the subject makes, and the fourteen flat modules made the reader find that split for themselves. The four loudness models and the equal-loudness contours they are read against move to psychoacoustics.loudness, and the attributes heard once loudness is known move to psychoacoustics.quality. The ERB scale stays at the root because both families measure on it. Five modules lose the word the family now says, and psychoacoustic_annoyance becomes quality.annoyance. The namespace is untouched: the package exports the same 60 names and the thirteen old module paths keep working until 5.0.
|
You've reached the fair usage limit for the Bito Code Review Agent trial. Upgrade to a paid plan or contact support@bito.in for assistance. Learn more |
|
Warning Review limit reached
Next review available in: 5 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (45)
📝 WalkthroughWalkthroughThe psychoacoustics API is reorganized into ChangesPsychoacoustics package split
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Reviewer's GuideRefactors the psychoacoustics package into two subpackages, Sequence diagram for resolving legacy psychoacoustics loudness_zwickersequenceDiagram
actor User
participant psychoacoustics
participant _namespace_shim
participant loudness_zwicker_new
User->>psychoacoustics: access loudness_zwicker
psychoacoustics->>_namespace_shim: __getattr__("loudness_zwicker")
_namespace_shim->>loudness_zwicker_new: import loudness.zwicker
_namespace_shim-->>psychoacoustics: return alias module
psychoacoustics-->>User: loudness_zwicker (alias to loudness.zwicker)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CHANGELOG.md`:
- Around line 1039-1052: Rewrite the malformed migration prose in the changelog
entry: replace “along the split every text on sound quality makes” with clear
wording describing the split between loudness and quality, and replace “lose the
word the family now says” with clear wording explaining that the module names
are being reorganized under those packages. Preserve the listed module mappings
and their intended meaning.
In `@docs/advanced-loudness.md`:
- Line 362: Update the API reference link text to use the canonical dotted
module names: psychoacoustics.loudness.moore_glasberg,
psychoacoustics.loudness.moore_glasberg_time, and psychoacoustics.loudness.ecma,
while leaving the existing URLs unchanged.
In `@llms-full.txt`:
- Line 1318: Update the generated API references in llms-full.txt at lines
1318-1318 and 19355-19355: replace the flat module identifiers with the nested
names loudness.moore_glasberg, loudness.moore_glasberg_time, loudness.ecma,
loudness.zwicker, and loudness.contours, while preserving the existing links.
In `@site/src/content/docs/guides/advanced-loudness.mdx`:
- Line 442: Update the API link labels to canonical module paths across all six
documented sites: site/src/content/docs/guides/advanced-loudness.mdx:442-442
should use the three canonical loudness labels;
site/src/content/docs/guides/loudness.mdx:310-310 should use
psychoacoustics.loudness.zwicker and psychoacoustics.loudness.contours;
site/src/content/docs/guides/psychoacoustic-annoyance.mdx:329-329 should use
psychoacoustics.quality.annoyance and
psychoacoustics.quality.fluctuation_strength; apply the corresponding same label
changes in site/src/content/docs/es/guides/advanced-loudness.mdx:451-451,
site/src/content/docs/es/guides/loudness.mdx:325-325, and
site/src/content/docs/es/guides/psychoacoustic-annoyance.mdx:339-339, without
changing the link targets.
In `@site/src/content/docs/reference/api/psychoacoustics/moore-glasberg.md`:
- Line 35: Update the source docstring that generates the Moore–Glasberg
reference page, changing “spectrum based” to “spectrum-based,” then regenerate
the API documentation so the generated page reflects the correction.
In `@tests/psychoacoustics/loudness/test_zwicker.py`:
- Line 29: Update the default ISO532_1_TESTDATA path in test_zwicker.py to use
pathlib.Path(__file__).parents[3], so it resolves from the repository root and
points to data/iso532_1 instead of tests/data/iso532_1.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 15452631-3025-42fb-a181-268289dc3f26
⛔ Files ignored due to path filters (1)
site/src/generated/api-sidebar.mjsis excluded by!**/generated/**
📒 Files selected for processing (75)
CHANGELOG.mddocs/ERRATA.mddocs/advanced-loudness.mddocs/api-reference.mddocs/loudness.mdllms-full.txtllms.txtscripts/api_taxonomy.pyscripts/conformance_report.pyscripts/generate_graphs.pysite/.pa11yci.jsonsite/public/llms/llms-psychoacoustics.txtsite/src/content/docs/es/guides/advanced-loudness.mdxsite/src/content/docs/es/guides/loudness.mdxsite/src/content/docs/es/guides/psychoacoustic-annoyance.mdxsite/src/content/docs/es/reference/errata.mdsite/src/content/docs/guides/advanced-loudness.mdxsite/src/content/docs/guides/loudness.mdxsite/src/content/docs/guides/psychoacoustic-annoyance.mdxsite/src/content/docs/reference/api/index.mdsite/src/content/docs/reference/api/psychoacoustics/annoyance.mdsite/src/content/docs/reference/api/psychoacoustics/contours.mdsite/src/content/docs/reference/api/psychoacoustics/ecma.mdsite/src/content/docs/reference/api/psychoacoustics/erb-scale.mdsite/src/content/docs/reference/api/psychoacoustics/fluctuation-strength-ecma.mdsite/src/content/docs/reference/api/psychoacoustics/fluctuation-strength.mdsite/src/content/docs/reference/api/psychoacoustics/moore-glasberg-time.mdsite/src/content/docs/reference/api/psychoacoustics/moore-glasberg.mdsite/src/content/docs/reference/api/psychoacoustics/roughness-ecma.mdsite/src/content/docs/reference/api/psychoacoustics/sharpness.mdsite/src/content/docs/reference/api/psychoacoustics/tonality-ecma.mdsite/src/content/docs/reference/api/psychoacoustics/tonality.mdsite/src/content/docs/reference/api/psychoacoustics/tone-audibility.mdsite/src/content/docs/reference/api/psychoacoustics/zwicker.mdsite/src/content/docs/reference/errata.mdsrc/phonometry/__init__.pysrc/phonometry/_compat.pysrc/phonometry/_plot/psychoacoustics.pysrc/phonometry/_report/iso1996_tone.pysrc/phonometry/_report/iso532.pysrc/phonometry/psychoacoustics/__init__.pysrc/phonometry/psychoacoustics/erb_scale.pysrc/phonometry/psychoacoustics/loudness/__init__.pysrc/phonometry/psychoacoustics/loudness/_zwicker_data.pysrc/phonometry/psychoacoustics/loudness/contours.pysrc/phonometry/psychoacoustics/loudness/ecma.pysrc/phonometry/psychoacoustics/loudness/moore_glasberg.pysrc/phonometry/psychoacoustics/loudness/moore_glasberg_time.pysrc/phonometry/psychoacoustics/loudness/zwicker.pysrc/phonometry/psychoacoustics/quality/__init__.pysrc/phonometry/psychoacoustics/quality/annoyance.pysrc/phonometry/psychoacoustics/quality/fluctuation_strength.pysrc/phonometry/psychoacoustics/quality/fluctuation_strength_ecma.pysrc/phonometry/psychoacoustics/quality/roughness_ecma.pysrc/phonometry/psychoacoustics/quality/sharpness.pysrc/phonometry/psychoacoustics/quality/tonality.pysrc/phonometry/psychoacoustics/quality/tonality_ecma.pysrc/phonometry/psychoacoustics/quality/tone_audibility.pytests/conftest.pytests/psychoacoustics/loudness/test_contours.pytests/psychoacoustics/loudness/test_ecma.pytests/psychoacoustics/loudness/test_moore_glasberg.pytests/psychoacoustics/loudness/test_moore_glasberg_time.pytests/psychoacoustics/loudness/test_zwicker.pytests/psychoacoustics/quality/test_annoyance.pytests/psychoacoustics/quality/test_fluctuation_strength.pytests/psychoacoustics/quality/test_fluctuation_strength_ecma.pytests/psychoacoustics/quality/test_roughness_ecma.pytests/psychoacoustics/quality/test_sharpness.pytests/psychoacoustics/quality/test_tonality.pytests/psychoacoustics/quality/test_tonality_ecma.pytests/psychoacoustics/quality/test_tone_audibility.pytests/psychoacoustics/test_erb_scale.pytests/test_deprecated_aliases.pytests/test_package_architecture.py
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #479 +/- ##
=======================================
Coverage 96.99% 96.99%
=======================================
Files 268 270 +2
Lines 38595 38604 +9
=======================================
+ Hits 37436 37445 +9
Misses 1159 1159 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Numerical conformance report✅ 533/533 conformance checks pass across 57 domains and 362 standards - filters class 1 - weightings within IEC 61672-1 class 1. Each row pins a standard clause to its expected normative value and the value the library computes. Every section below is collapsible and stays collapsed while all of its rows pass; a section with any failing row opens automatically. ✅ Numerical validation - filters & weightings: class showcase (IEC 61260-1 · IEC 61672-1 · ISO 7196)IEC 61260-1:2014 class per filter architecture (order 6, one-third-octave, 100 Hz-10 kHz, fs = 48 kHz). For each architecture the table shows, at its binding band, the measured relative attenuation and the class-1 limit it must clear, so the number and the range it must sit in are both visible. A positive margin means the acceptance limits are met with that much room.
Only Butterworth (the library default) and Chebyshev-II are class-compliant architectures. Chebyshev-I and elliptic trade the mask for passband ripple, and Bessel for a maximally-flat group delay (soft rolloff); they cannot satisfy the IEC 61260-1 Class 1/2 attenuation mask by construction, so they are labelled By design - this is expected, not a failure or regression. Frequency-weighting conformance (A/C: IEC 61672-1 Table 3; G: ISO 7196 A.3). The max deviation from nominal is informational (it falls at a frequency extreme where the tolerance is widest and asymmetric); compliance is judged at the binding frequency - the one with the least headroom - where the deviation, the applicable tolerance band and the headroom are shown together.
✅ Filters & weightings: 100% (10/10)
✅ Levels & dosimetry: 100% (9/9)
✅ Room & building acoustics: 100% (72/72)
✅ Room acoustics: 100% (16/16)
✅ Psychoacoustics: 100% (14/14)
✅ Speech transmission (IEC 60268-16): 100% (10/10)
✅ System measurement (Golay / Kirkeby / Mueller-Massarani): 100% (5/5)
✅ Intensity & sound power: 100% (10/10)
✅ Building prediction & uncertainty: 100% (15/15)
✅ Outdoor propagation & occupational exposure: 100% (10/10)
✅ Materials: absorption, airflow & impedance: 100% (6/6)
✅ Scattering & diffusion (ISO 17497): 100% (14/14)
✅ In-situ road absorption (ISO 13472): 100% (3/3)
✅ Precision sound power (ISO 3745 / 9614-3): 100% (4/4)
✅ Human vibration (ISO 8041 / 2631 / 5349): 100% (15/15)
✅ Speech intelligibility (ANSI S3.5-1997): 100% (24/24)
✅ Objective intelligibility (STOI / ESTOI): 100% (3/3)
✅ Impulsive-sound prominence (NT ACOU 112): 100% (2/2)
✅ Impulsive-sound prominence (ISO/PAS 1996-3): 100% (2/2)
✅ Room noise (ANSI S12.2-2019): 100% (3/3)
✅ Hearing threshold (ISO 7029 / ISO 389-7): 100% (3/3)
✅ Measurement uncertainty (GUM / Supplement 1): 100% (7/7)
✅ Noise-induced hearing loss (ISO 1999): 100% (6/6)
✅ Multiple-shock whole-body vibration (ISO 2631-5): 100% (6/6)
✅ Sound absorption in enclosed spaces (EN 12354-6): 100% (2/2)
✅ Prominent discrete tones (ECMA-418-1): 100% (2/2)
✅ Tonal audibility (ISO/PAS 20065): 100% (11/11)
✅ Psychoacoustic annoyance & fluctuation strength (Fastl & Zwicker): 100% (3/3)
✅ Electroacoustics: distortion & frequency response: 100% (20/20)
✅ Calibrated spectral analysis (Bendat & Piersol): 100% (12/12)
✅ Multiple-input coherence (Bendat & Piersol): 100% (5/5)
✅ Time-frequency analysis (Bendat & Piersol): 100% (3/3)
✅ Correlation, time delay and envelope (B&P / Knapp & Carter): 100% (7/7)
✅ Cepstrum, liftering and envelope spectrum (Havelock / B&P): 100% (3/3)
✅ Time synchronous averaging (McFadden 1987): 100% (5/5)
✅ Data qualification and Rice statistics (Bendat & Piersol): 100% (8/8)
✅ Underwater acoustics (ISO 18405/17208/18406): 100% (6/6)
✅ Underwater sound propagation (transmission loss): 100% (16/16)
✅ Underwater propagation regimes (Weston flux theory): 100% (3/3)
✅ Marine-mammal auditory weighting (NMFS / Southall): 100% (4/4)
✅ Underwater numerical propagation (modes / rays / PE): 100% (4/4)
✅ Aircraft noise (ICAO Annex 16 / IEC 61265): 100% (15/15)
✅ Rotorcraft noise (ECAC Doc 32 / NORAH2): 100% (12/12)
✅ CNOSSOS-EU road source (Directive 2002/49/EC Annex II): 100% (6/6)
✅ Wind-turbine noise (IEC 61400-11): 100% (3/3)
✅ Porous & multilayer absorbers (Mechel / Bies / Cox & D'Antonio): 100% (20/20)
✅ Slow-sound perfect absorbers (Jimenez et al. Appl. Sci. 2017): 100% (3/3)
✅ Program loudness (ITU-R BS.1770 / EBU R 128): 100% (8/8)
✅ 2D FDTD wave simulation (Attenborough & Van Renterghem 2021, Ch. 4): 100% (4/4)
✅ Swept-sine distortion & phase utilities (Farina / Novak): 100% (7/7)
✅ Spherical ground & barriers (Attenborough / Salomons / Bies): 100% (7/7)
✅ Panel & aperture sound insulation (Bies / Hopkins / Cremer): 100% (17/17)
✅ Bending-wave plate-junction transmission (Cremer / Craik / Hopkins): 100% (6/6)
✅ Atmospheric refraction (Salomons rays / GFPE): 100% (3/3)
✅ Electroacoustics: 100% (9/9)
✅ Industrial noise control: 100% (22/22)
✅ CNOSSOS-EU railway source (Directive 2002/49/EC Annex II): 100% (8/8)
Tests & coverage — 48312 tests, 0 failures (✅ all green)
Conformance harness: |
Four test paths quoted in the standards table and in three docstrings still named files this split moved, the ECMA quality modules pointed at their loudness front-end with a sibling-relative reference that no longer resolves, and the guides labelled their API links with the pre-split module paths while linking to the renamed pages. The taxonomy table now names the two families, and the time-varying Moore-Glasberg model is credited to ISO 532-3, which is a standard of its own.
The moved test files carried composite assertions and rejection tests whose input was built inside the block that expects the raise; both are split now. The alias table derives the pre-3.2 loudness target from the row that already gives it instead of repeating the path.
|
|
You've reached the fair usage limit for the Bito Code Review Agent trial. Upgrade to a paid plan or contact support@bito.in for assistance. Learn more |



phonometry.psychoacousticswas fourteen flat modules, and the split everytext on the subject makes was left for the reader to find. It has two
families now.
psychoacoustics.loudnessis how loud a sound is: ISO 532-1 Zwicker,ISO 532-2 Moore-Glasberg and its time-varying form, ECMA-418-2, and the
ISO 226 equal-loudness contours all four are read against.
psychoacoustics.qualityis what the sound is like once its loudness isknown: sharpness, roughness, fluctuation strength, tonality, tone audibility
and the annoyance models built on them.
erb_scalestays at the root,because both families measure on it.
Five modules lose the word the family now says:
loudness_zwicker,loudness_moore_glasberg,loudness_moore_glasberg_time,loudness_ecmaand
loudness_contoursbecomeloudness.zwicker,loudness.moore_glasberg,loudness.moore_glasberg_time,loudness.ecmaandloudness.contours;psychoacoustic_annoyancebecomesquality.annoyance.Nothing moves in the namespace.
from phonometry import psychoacousticsexports the same 60 names,
psychoacoustics.loudness_zwickerand the twelveother pre-split paths keep resolving with the usual notice until 5.0, and the
pre-3.2 flat paths reach their new home in one hop. The ISO 532-1 Annex B
fixture path in the moved test file was corrected: its guard test is there
precisely because a stale relative path once turned twenty-one oracle checks
into silent skips.
Summary by Sourcery
Introduce loudness and quality subpackages under phonometry.psychoacoustics while preserving the existing public API and deprecating only module paths.
Enhancements:
Documentation:
Tests:
Summary by CodeRabbit