Skip to main content

Tools for processing audio signals

Project description

Audio Toolset

CI Workflow status CD Workflow status GitHub Release PyPI - Version Python Version from PEP 621 TOML

Python library and command line interface for processing audio signals.

audio_toolset provides an intuitive and flexible way to process audio files in Python. Each Channel object handles a single mono audio file, allowing you to apply filters, EQ, dynamic processing, gain adjustments, noise reduction, and more.

[!TIP] Stereo files can be handled by first splitting them into mono channels using split_to_mono and then recombining them with join_to_stereo. see example below

Installation

pip install audio-toolset

Examples

Quickstart

from audio_toolset.channel import Channel

track = Channel("my_audio.wav")

track.lowpass(cutoff_frequency=12000)  # Remove harsh highs
track.highpass(cutoff_frequency=80)  # Remove low-end rumble
track.normalize(target_db=-1)  # Normalize

track.write("my_audio_processed.wav")

Command line interface

All methods in Channel are exposed as subcommands in the audio-toolset CLI and can be chained in any order. this command will produce an identical result to the python script above

audio-toolset --source my_audio.wav \
  lowpass --cutoff-frequency 12000 \
  highpass --cutoff-frequency 80 \
  normalize --target-db -1 \
  write --output-path my_audio_processed.wav

Process multiple files

This is very handy when you need to apply the same processing to multiple files, for example a directory with sound effects.

import pathlib

from audio_toolset.channel import Channel

input_dir = pathlib.Path("input_audio")
output_dir = pathlib.Path("cleaned_audio")
output_dir.mkdir(exist_ok=True)

for wav_file in input_dir.glob("*.wav"):
    track = Channel(wav_file)

    track.lowpass(cutoff_frequency=12000)  # Remove harsh highs
    track.highpass(cutoff_frequency=80)  # Remove low-end rumble
    track.normalize(target_db=-1)  # Normalize

    track.write(output_dir / wav_file.name)

Working with stereo files

from audio_toolset.audio_data import AudioData, join_to_stereo
from audio_toolset.channel import Channel

# Load stereo audio file
stereo_data = AudioData.read_from_file("my_audio.wav")

# Split stereo into left and right channels
left_data, right_data = stereo_data.split_to_mono()
left_channel = Channel(left_data)
right_channel = Channel(right_data)

# Process each channel
for track in [left_channel, right_channel]:
    track.lowpass(cutoff_frequency=12000)  # Remove harsh highs
    track.highpass(cutoff_frequency=80)  # Remove low-end rumble
    track.normalize(target_db=-1)  # Normalize

# Combine channels back to stereo and save
join_to_stereo(left_channel.audio_data, right_channel.audio_data).write_to_file(
    "my_audio_processed.wav"
)

Features

  • High level Channel object for simple user interface
  • Load audio from a file or AudioData
  • Gain processing
    • gain, normalize, fade
  • Filters
    • lowpass, highpass, eq_band
    • noise_reduction (spectral gating)
  • Dynamics
    • compressor, limiter, soft_clipping
  • Plotting tools (see examples)
    • plot_signal - generate signal time and frequency plot
    • Dynamic plots - compressor, limiter can generate attenuation plots
    • Bode plots - lowpass, highpass, eq_band can generate filter bode plots

Plotting

audio_toolset provides multiple plotting tools to visualize signals, filters, and dynamics. All plots are generated interactively using Plotly and can be saved as images from the interactive viewer.

Signal Plots

Use plot_signal() to visualize the time-domain and frequency-domain representation of an audio channel.

signal-plot

2. Filter (Bode) Plots

Filter plots show the frequency response (Bode plot) of filters applied using eq_band(plot_filter_bode=True), highpass(plot_filter_bode=True), or lowpass(plot_filter_bode=True).

lowpass-plot

parametric-eq-plot

3. Dynamics Plots

Dynamics plots visualize the response of compressors and limiters applied to a channel. Generated by compressor(plot_compressor_response=True) or limiter(plot_limiter_response=True)

compressor-plot

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

audio_toolset-0.2.2.tar.gz (41.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

audio_toolset-0.2.2-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file audio_toolset-0.2.2.tar.gz.

File metadata

  • Download URL: audio_toolset-0.2.2.tar.gz
  • Upload date:
  • Size: 41.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.15

File hashes

Hashes for audio_toolset-0.2.2.tar.gz
Algorithm Hash digest
SHA256 5a24209fb3b7e73f178e80fcebdfc3e06e9ddfbc3a7935d8b421e51e59151d5f
MD5 fa195edb8ea460c2f4b9c8d31ded121f
BLAKE2b-256 3cc533d684852fd8e7c83c042a356f8bc6cb9bf1bddce9cb15f3b2f421be69d0

See more details on using hashes here.

File details

Details for the file audio_toolset-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for audio_toolset-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d61ea3869ea1b26b8f2f361793a28bb04cd7d955ad9c6f5d3aa6be7a63a5e8e8
MD5 56414baa978966a23335be74ceec4391
BLAKE2b-256 4cae4c070e617f1130b85dc7b114cb46c1ec26fac13300943ed8382c89c966a7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page