Skip to content

Resolve Librosa and Audioread Warnings/Deprecations during Analysis #153

@seonghobae

Description

@seonghobae

Description

During the execution of the Python analysis engine (specifically in tests and CI), several warnings and deprecation messages are emitted that pollute logs and indicate potential future breakages or performance issues.

Root Causes to Investigate & Fix:

  1. librosa/core/spectrum.py: UserWarning: n_fft=1024 is too large for input signal of length=690 and length=345.
    • Occurs during chord recognition or pitch tracking when the input audio segment is too short for the default n_fft size.
    • Action: Dynamically adjust n_fft based on the input signal length to prevent this warning.
  2. audioread/rawread.py: DeprecationWarning: 'aifc', 'audioop', 'sunau' is deprecated and slated for removal in Python 3.13.
    • Occurs because librosa falls back to audioread which uses standard library modules deprecated in Python 3.13.
    • Action: Switch to a more modern audio loading backend like soundfile exclusively, or handle the fallback cleanly so that isn't triggered unnecessarily.
  3. librosa/core/audio.py: FutureWarning: librosa.core.audio.__audioread_load Deprecated as of librosa version 0.10.0.
    • Occurs due to audioread usage.
    • Action: Ensure soundfile handles all supported formats or suppress the fallback warning properly if intentional.
  4. bandscope_analysis/temporal/analyzer.py:42: UserWarning: PySoundFile failed. Trying audioread instead.
    • Occurs when testing test_temporal_analyzer_file_not_found or similar edge cases.
    • Action: Fix the test logic or the loading logic to throw a proper FileNotFoundError or custom error without falling through to audioread.

Definition of Done

All the above warnings and deprecation messages are resolved at their root cause so that pytest runs with zero warnings.

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