Python audio processing libraries

Updated Nov 2026

Python audio processing libraries read, write, and transform sound files and sample arrays. Most decode audio into a NumPy array of samples that analysis and resampling code can operate on. These libraries let speech pipelines, music apps, and machine learning models prepare audio for analysis.

Popularity

PyAV, whose count also covers video work, has the most monthly downloads in this comparison, at 52.3M.

LibraryMonthly downloadsStarsLast releaseLicense
PyAV
52.3M
3.3KOct 2026BSD-3-Clause
SoundFile
35.5M
874Jun 2026BSD-3-Clause
pydub
17.2M
9.8KMar 2021MIT
Python-SoXR
13.9M
119May 2026LGPL-2.1-or-later
ffmpeg-python
11.1M
11.0KJul 2019Apache-2.0
librosa
11.1M
9.0KNov 2026ISC
audioread
7.4M
540Oct 2025MIT
TorchAudio
5.8M
3.0KOct 2026BSD-2-Clause
Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Libraries and code examples

Binds the FFmpeg libraries for Python.

Downloads / mo
52.3M
Stars
3.3K
Last release
19.0.2
License
BSD-3-Clause

Quickstart

From container.html
$ pip install av
import av
with av.open('input.wav') as container:
    frame = next(container.decode(audio=0))
    samples = frame.to_ndarray()

PyAV examples

From open-source projects on GitHub

Reads and writes audio files.

Downloads / mo
35.5M
Stars
874
Last release
0.14.0
License
BSD-3-Clause
Runs on
libsndfile

Strengths

  • Reads and writes sound files. Use soundfile.read and soundfile.write for supported audio formats.
  • Processes audio in blocks. Read short overlapping blocks without loading the entire recording.

Limitations

  • Raw audio needs format details. Specify the sample rate, channel count, and subtype when opening headerless audio.

Quickstart

From latest.md
$ pip install soundfile
import soundfile as sf
samples, sample_rate = sf.read('input.wav')

SoundFile examples

From open-source projects on GitHub

Represents audio with immutable AudioSegment objects.

Downloads / mo
17.2M
Stars
9.8K
Last release
0.25.1
License
MIT

Strengths

  • Slices clips by time. Select a section of audio using millisecond-based slices.
  • Mixes clips on a timeline. Overlay clips at a chosen position with background-gain control.

Limitations

  • Compressed formats need ffmpeg. Install ffmpeg to open or save formats such as MP3.

Quickstart

From README.markdown
$ pip install pydub
from pydub import AudioSegment
audio = AudioSegment.from_wav('input.wav')

pydub examples

From open-source projects on GitHub

Converts one-dimensional audio between sample rates.

Downloads / mo
13.9M
Stars
119
Last release
1.1.0
License
LGPL-2.1-or-later

Quickstart

From soxr.html
$ pip install soxr
import numpy as np
import soxr
samples = np.zeros(48000, dtype=np.float32)
converted = soxr.resample(samples, 48000, 16000)

Python-SoXR examples

From open-source projects on GitHub

Builds FFmpeg commands with complex filtering from Python.

Downloads / mo
11.1M
Stars
11.0K
Last release
0.2.0
License
Apache-2.0

Quickstart

From README.md
$ pip install ffmpeg-python
import ffmpeg
ffmpeg.input('input.wav').output('output.flac').run()

ffmpeg-python examples

From open-source projects on GitHub

Provides algorithms for audio and music signal processing.

Downloads / mo
11.1M
Stars
9.0K
Last release
1.0.1
License
ISC

Strengths

  • Analyzes rhythm and onset strength. Estimate beat positions and build onset-strength features from audio.
  • Loads audio for analysis. Decode audio into a floating-point waveform.

Limitations

  • Loading resamples audio by default. Pass sr=None to keep the file’s original sample rate.
  • Loading mixes channels by default. Pass mono=False when each input channel must stay separate.

Quickstart

From README.md
$ pip install librosa
import librosa
samples, sample_rate = librosa.load('input.wav', sr=None)

librosa examples

From open-source projects on GitHub

Decodes audio across platforms through several backend libraries.

Downloads / mo
7.4M
Stars
540
Last release
3.1.0
License
MIT

Quickstart

From README.md
$ pip install audioread
import audioread
with audioread.audio_open('input.wav') as audio:
    sample_rate = audio.samplerate

audioread examples

From open-source projects on GitHub

Provides audio processing tools for the PyTorch ecosystem.

Downloads / mo
5.8M
Stars
3.0K
Last release
2.11.1
License
BSD-2-Clause
Runs on
PyTorch

Strengths

  • Resamples PyTorch waveforms. Resample waveform tensors through functional or reusable transform APIs.
  • Runs resampling on GPUs. Use tensor convolution to resample audio on compatible GPU hardware.

Limitations

  • Audio decoding needs TorchCodec. Install TorchCodec for load and save, or use its classes directly.
$ pip install torch==2.11.1 torchaudio==2.11.1
import torch
from torchaudio.transforms import Resample
waveform = torch.zeros(1, 16000)
converted = Resample(orig_freq=16000, new_freq=8000)(waveform)

TorchAudio examples

From open-source projects on GitHub

FAQ

SoundFile suits reading and writing audio files as NumPy arrays. librosa suits music and audio analysis. pydub suits slicing, joining, and converting audio clips.

librosa provides algorithms for audio and music signal processing, such as spectrograms, beat tracking, and pitch features.

pydub represents audio as immutable AudioSegment objects that support slicing, concatenation, and format conversion. It uses FFmpeg to read formats other than WAV.

TorchAudio provides audio loading, transforms, and models for PyTorch. Its transforms run on tensors inside training pipelines.

ffmpeg-python builds FFmpeg command lines with filter graphs from Python. PyAV binds the FFmpeg libraries directly for frame-level access.

For coding agents

Found your audio processing library? Help your agent use it.

Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.

Run in your terminal

claude plugin install exa@claude-plugins-official