Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Expanded Audio Format Support with Soundfile #8

Merged
merged 2 commits into from
May 11, 2024

Conversation

mbsantiago
Copy link
Owner

This pull request significantly enhances the audio loading capabilities of our soundevent library.

Key Improvements:

  • Expanded Format Support:
    • Previously, soundevent only supported WAV files. We've now integrated the soundfile library, enabling support for a wide array of lossless and lossy audio formats (FLAC, MP3, etc.), making the library more versatile and accommodating a broader range of use cases.
    • We excluded a few formats that did not allow reading audio clips without loading the entire file, ensuring efficient processing of large recordings.
  • Efficient Metadata Retrieval & Clip Reading: Critical metadata (duration, sample rate, channels, etc.) can be obtained quickly without fully loading the audio file. Additionally, you can now read specific audio clips from a file without loading it entirely. This is crucial when working with large audio files, as it significantly improves performance.
  • Standardized Audio Attributes: The audio.attributes module now defines standardized attributes for audio arrays, aligning with the new arrays module and promoting consistency throughout the codebase.
  • Consolidated Audio Operations: We've created a dedicated audio.operations module for audio-specific array operations (filtering, resampling, PCEN), resulting in a cleaner code organization.
  • Improved PCEN Implementation: The PCEN (Per-Channel Energy Normalization) transform has been reimplemented to adhere more closely to the original paper, eliminating the dependency on librosa.
  • Enhanced Audio File Identification: The audio.is_audio_file function now recognizes all supported formats. We've also added a "strict" mode for more thorough file validation using soundfile.
  • New Utility Function: A new audio.get_audio_files function allows easy recursive iteration over all audio files within a directory.

Breaking Changes:

  • The MediaInfo object has been modified to include format and subtype fields (replacing format and bit_depth). This change was necessary to accommodate the wider range of audio formats. While it's a breaking change, it significantly improves the library's flexibility.

Additional Notes:

@mbsantiago mbsantiago linked an issue May 11, 2024 that may be closed by this pull request
Copy link

codecov bot commented May 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.21%. Comparing base (f9a6d1a) to head (fb4943d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main       #8      +/-   ##
==========================================
+ Coverage   86.87%   88.21%   +1.33%     
==========================================
  Files         106      102       -4     
  Lines        3154     2995     -159     
  Branches      492      470      -22     
==========================================
- Hits         2740     2642      -98     
+ Misses        321      283      -38     
+ Partials       93       70      -23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mbsantiago mbsantiago merged commit c8fa490 into main May 11, 2024
7 checks passed
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.

Enhancement Proposal - Adding FLAC File Support to load_audio Function
1 participant