Skip to main content

Simple audio processing library.

Project description

soundpython

soundpython is a Python library for audio file processing that provides a simple, intuitive interface for working with audio data. It supports various audio formats and offers functionality for both mono and stereo audio manipulation.

Features

  • Load and save audio in multiple formats (MP3, WAV, OGG, FLAC)
  • Convert between mono and stereo audio
  • Manipulate individual audio channels
  • Extract portions of audio by time
  • Concatenate audio files
  • Automatic audio normalization
  • Comprehensive metadata handling

Requirements

  • Python 3.10 or higher
  • NumPy 2.2.1 or higher
  • FFmpeg (must be installed and available in system PATH)

Installation

Install the package using pip:

pip install soundpython

Usage

Here are some common usage examples:

from soundpython import Audio

# Load an audio file
audio = Audio.from_file("song.mp3")

# Convert stereo to mono
mono_audio = audio.to_mono()

# Extract left channel from stereo audio
left_channel = audio.get_channel(0)

# Extract portions of audio by time
intro = audio.slice(end_seconds=30.0)  # First 30 seconds
chorus = audio.slice(60.0, 90.0)       # 30-second clip from 1:00 to 1:30
outro = audio.slice(180.0)             # Everything after 3:00

# Concatenate audio segments
combined = intro.concat(chorus)

# Save in different formats
audio.save("output.wav")
audio.save("output.mp3")

Audio Metadata

The library provides detailed metadata about audio files through the AudioMetadata class:

# Access audio metadata
print(f"Sample rate: {audio.metadata.sample_rate}Hz")
print(f"Channels: {audio.metadata.channels}")
print(f"Duration: {audio.metadata.duration_seconds:.2f}s")
print(f"Bit depth: {audio.metadata.bits_per_sample} bits")

Development

To set up the development environment:

  1. Install uv
  2. Clone the repository
  3. Install development dependencies:
uv sync --dev
  1. Run tests:
uv run pytest

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

soundpython-0.1.1.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

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

soundpython-0.1.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file soundpython-0.1.1.tar.gz.

File metadata

  • Download URL: soundpython-0.1.1.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.28

File hashes

Hashes for soundpython-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a8bb92e57c7f3f0dcbb8cd4973fbceb045c92779a40c9816d7d4d737ad29aa47
MD5 2c0407e185ce6e5a9907646cb625aadc
BLAKE2b-256 15c0c09f1a40743c51ac77d34584aec0a259613413a317d5ef6392d447118a7c

See more details on using hashes here.

File details

Details for the file soundpython-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for soundpython-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 546e7fb02587f89ed2ea5e529f62049d49e5214c961347bc7cb7cbfb1393d3c3
MD5 04f7e2f52dea143da91d5fa544bf3d5d
BLAKE2b-256 976d19e901d1dbc574de5343e664c4f46a9997191197ab0df93817f26910e001

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