AudioLab

raw JSON →
0.5.1 verified Fri May 01 auth: no python

A Python library for audio processing and analysis. Version 0.5.1, updated periodically. Supports audio formats like WAV, MP3, FLAC; provides utilities for reading, writing, converting, and manipulating audio data.

pip install audiolab
error ModuleNotFoundError: No module named 'audiolab'
cause Library not installed or installed in a different environment.
fix
Run: pip install audiolab
error AttributeError: module 'audiolab' has no attribute 'audio_open'
cause Outdated version of audiolab (pre-0.5.0) or incorrect import path.
fix
Upgrade: pip install --upgrade audiolab. Use: from audiolab import audio_open
error ValueError: Unsupported audio format
cause File format not supported (e.g., .ogg, .aac) or file is corrupted.
fix
Convert to WAV or FLAC using ffmpeg or another tool.
gotcha audio_open returns a context manager that may not be re-entrant. Do not reuse the same file handle after closing.
fix Always use 'with' statement as shown in quickstart.
gotcha The library may not fully support all MP3 variants or high sample rates. Test with your specific files.
fix Convert problematic files to WAV or FLAC before processing.
breaking In version 0.5.0, the API changed: 'read' method now returns numpy array instead of list. Older code expecting list may break.
fix Update code to handle numpy arrays. Use .tolist() if list needed.

Basic example of opening an audio file and reading its data.

from audiolab import audio_open

# Open an audio file
with audio_open('example.wav') as f:
    # Read all frames as numpy array
    data = f.read_all()
    print('Audio data shape:', data.shape)
    print('Sample rate:', f.sampling_rate)
    print('Channels:', f.channels)