Skip to main content

Audio Processing Meets Audio Intelligence.

Project description

๐ŸŽต AIAudio

Audio Processing Meets Audio Intelligence

An open-source Python library that starts as a lightweight audio toolkit and evolves into a full AI-powered audio intelligence platform โ€” covering everything from format conversion to transcription, noise removal, speaker detection, and semantic search.

Version PyPI Downloads Total Downloads Python License Tests Phase


Table of Contents


What is AIAudio?

AIAudio is a Python library designed to grow with you. At its core it is a simple, clean alternative to Pydub for audio manipulation โ€” no heavy dependencies, just numpy and scipy. As it matures it becomes an AI-powered platform that can transcribe speech, remove background noise, detect speakers, search audio archives by meaning, and generate meeting summaries โ€” all behind the same consistent API.

from aiaudio import Audio

# today
audio = Audio.load("meeting.mp3")
audio.slice(0, 60).export("intro.wav")

# tomorrow (coming phases)
audio.clean()
audio.transcribe()
audio.identify_speakers()
audio.summarize()
audio.export_report("meeting_report.md")

Current Features

# Feature Status
โœ… Load and export WAV files (native, zero extra deps) Available
โœ… Load and export MP3, FLAC, OGG, AAC, M4A via FFmpeg Available
โœ… Slice audio by time Available
โœ… Concatenate multiple audio files Available
โœ… Volume control (increase / decrease in dB) Available
โœ… Resampling (change sample rate) Available
โœ… Channel conversion (mono โ†” stereo) Available
โœ… CLI โ€” aiaudio command with 5 subcommands Available
๐Ÿ”œ Fade in / fade out / reverse / normalize / silence removal Phase 3
๐Ÿ”œ AI noise removal, echo reduction, audio cleanup Phase 4
๐Ÿ”œ Speech-to-text transcription Phase 5
๐Ÿ”œ Language detection Phase 5
๐Ÿ”œ Speaker diarization Phase 5
๐Ÿ”œ Audio embeddings and semantic search Phase 6
๐Ÿ”œ Summarization, topic extraction, action items Phase 7
๐Ÿ”œ Real-time streaming and live transcription Phase 8
๐Ÿ”œ Plugin architecture Phase 9
๐Ÿ”œ Agentic end-to-end audio pipelines Phase 10
๐Ÿ”œ GUI โ€” drag-and-drop format converter Phase 2.5

Installation

Core โ€” WAV support, zero heavy dependencies:

pip install aiaudio

With multi-format support (MP3, FLAC, OGG, AAC, M4A):

Requires FFmpeg installed on your system.

# Install FFmpeg first:
winget install ffmpeg          # Windows
brew install ffmpeg            # macOS
sudo apt install ffmpeg        # Ubuntu / Debian

# Then:
pip install aiaudio

With GUI (drag-and-drop format converter):

pip install "aiaudio[gui]"

With AI features (transcription, noise removal, embeddings):

pip install "aiaudio[ai]"

For development / contributing:

git clone https://github.com/shubham10divakar/aiaudio.git
cd aiaudio
pip install -e ".[dev]"
pytest   # 48 tests, all green

Quick Start

from aiaudio import Audio

# Load any format
audio = Audio.load("podcast.mp3")

print(audio)
# Audio(duration=1823.40s, sample_rate=44100Hz, channels=2)

# Trim to the first 5 minutes
intro = audio.slice(0, 300)

# Boost volume by 3 dB
intro = intro.increase_volume(3)

# Export as FLAC
intro.export("intro.flac")

Library API

Loading Audio

from aiaudio import Audio

# WAV โ€” native, no FFmpeg needed
audio = Audio.load("song.wav")

# Any other format โ€” requires FFmpeg
audio = Audio.load("podcast.mp3")
audio = Audio.load("interview.flac")
audio = Audio.load("recording.m4a")
audio = Audio.load("track.ogg")
audio = Audio.load("voice.aac")

Audio Properties

audio = Audio.load("song.wav")

audio.duration      # 183.42  (float, seconds)
audio.sample_rate   # 44100   (int, Hz)
audio.channels      # 2       (int, 1=mono / 2=stereo)

print(audio)
# Audio(duration=183.42s, sample_rate=44100Hz, channels=2)

Slicing

Extract any segment by start and end time in seconds.

audio = Audio.load("song.wav")

# Extract seconds 10โ€“20
clip = audio.slice(10, 20)

# Extract the first 30 seconds
intro = audio.slice(0, 30)

# Extract the last 60 seconds
outro = audio.slice(audio.duration - 60, audio.duration)

clip.export("clip.wav")

Note: All operations return a new Audio object โ€” the original is never modified.


Concatenation

Join any number of Audio objects using the + operator. Both sides must have the same sample rate.

intro = Audio.load("intro.wav")
main  = Audio.load("main.wav")
outro = Audio.load("outro.wav")

full = intro + main + outro

print(full.duration)  # sum of all three
full.export("full_episode.wav")

Mismatched sample rates raise a clear error:

a = Audio.load("44100hz.wav")   # 44100 Hz
b = Audio.load("22050hz.wav")   # 22050 Hz

a + b
# ValueError: Sample rates must match: 44100 vs 22050
# Fix: b = b.resample(44100)

Volume Control

Adjust loudness in decibels. Positive dB = louder, negative dB = quieter. Clipping is handled automatically.

audio = Audio.load("quiet_recording.wav")

louder  = audio.increase_volume(6)    # +6 dB  (~2ร— louder)
quieter = audio.decrease_volume(3)    # -3 dB  (~half as loud)

# Or pass a negative number directly
softer = audio.increase_volume(-6)

louder.export("louder.wav")

Resampling

Change the sample rate โ€” useful before export or when concatenating clips with different rates.

audio = Audio.load("hifi.wav")   # 48000 Hz

# Downsample for voice / podcast use
voice = audio.resample(16000)
web   = audio.resample(22050)
cd    = audio.resample(44100)

voice.export("voice.wav")

Channel Conversion

Convert between mono and stereo.

stereo = Audio.load("stereo.wav")

# Stereo โ†’ mono (averages both channels)
mono = stereo.set_channels(1)

# Mono โ†’ stereo (duplicates the single channel)
back = mono.set_channels(2)

mono.export("mono.wav")

Exporting

Export to any supported format. The format is inferred from the file extension. WAV works with no extra dependencies; all other formats require FFmpeg.

audio = Audio.load("input.mp3")

audio.export("output.wav")    # native, no FFmpeg
audio.export("output.mp3")    # requires FFmpeg
audio.export("output.flac")   # requires FFmpeg
audio.export("output.ogg")    # requires FFmpeg
audio.export("output.aac")    # requires FFmpeg
audio.export("output.m4a")    # requires FFmpeg

Chaining Operations

All methods return a new Audio object, so you can chain freely:

from aiaudio import Audio

result = (
    Audio.load("raw_interview.mp3")
    .slice(30, 1800)           # skip intro, take 30 min
    .set_channels(1)           # convert to mono
    .resample(16000)           # downsample for speech processing
    .decrease_volume(2)        # slightly quieter
)

result.export("interview_processed.wav")

CLI Reference

After installing AIAudio the aiaudio command is available globally in your terminal.

aiaudio --help
aiaudio --version

aiaudio info

Display metadata about an audio file.

aiaudio info <file>
$ aiaudio info podcast.mp3

File:        podcast.mp3
Duration:    1823.40s
Sample rate: 44100 Hz
Channels:    2

aiaudio slice

Extract a segment of audio by start and end time in seconds.

aiaudio slice <file> <start> <end> -o <output>
# Extract seconds 60โ€“120
aiaudio slice podcast.mp3 60 120 -o segment.wav

# Extract the first 30 seconds
aiaudio slice podcast.mp3 0 30 -o intro.wav

# Extract minutes 5โ€“10
aiaudio slice podcast.mp3 300 600 -o middle.wav

aiaudio volume

Increase or decrease volume in decibels.

aiaudio volume <file> <db> -o <output>
# Louder (+5 dB)
aiaudio volume quiet.wav 5 -o louder.wav

# Quieter (-3 dB)
aiaudio volume loud.wav -3 -o quieter.wav

aiaudio concat

Join two or more audio files in order.

aiaudio concat <file1> <file2> ... -o <output>
# Join two files
aiaudio concat intro.wav main.wav -o full.wav

# Join three or more
aiaudio concat intro.wav part1.wav part2.wav outro.wav -o episode.wav

aiaudio convert

Convert audio to a different format. Requires FFmpeg. The output format is inferred from the output file's extension.

aiaudio convert <file> -o <output> [--sample-rate HZ] [--channels {1,2}]
# MP3 โ†’ FLAC
aiaudio convert podcast.mp3 -o podcast.flac

# WAV โ†’ MP3, downsampled to 22050 Hz
aiaudio convert recording.wav -o recording.mp3 --sample-rate 22050

# Stereo FLAC โ†’ mono WAV at 16 kHz (ready for speech processing)
aiaudio convert stereo.flac -o mono_16k.wav --sample-rate 16000 --channels 1

# M4A โ†’ OGG
aiaudio convert audiobook.m4a -o audiobook.ogg

Roadmap

AIAudio is built in phases. Each phase is independently useful and ships as a working release.

Phase Feature Description
โœ… 1 Core Audio Engine Load, slice, concat, volume, export (WAV)
โœ… 1.1 CLI aiaudio command with 5 subcommands
โœ… 2 Multi-Format Support MP3, FLAC, OGG, AAC, M4A via FFmpeg
๐Ÿ”œ 2.5 GUI Drag-and-drop browser-based format converter
๐Ÿ”œ 3 Audio Effects Fade in/out, speed change, reverse, normalize, silence removal
๐Ÿ”œ 4 AI Enhancement Noise removal, echo reduction, voice cleanup
๐Ÿ”œ 5 Speech Intelligence Transcription, language detection, speaker diarization
๐Ÿ”œ 6 Embeddings & Search Semantic audio search โ€” find content by meaning
๐Ÿ”œ 7 AI Workflows Summarization, topic extraction, action items, meeting minutes
๐Ÿ”œ 8 Streaming Live mic input, real-time transcription and noise reduction
๐Ÿ”œ 9 Plugin Architecture Custom effects, models, and exporters via @plugin decorator
๐Ÿ”œ 10 Agentic Platform Full pipeline: clean โ†’ transcribe โ†’ diarize โ†’ summarize โ†’ report

Phase 3 preview โ€” Audio Effects

audio = Audio.load("recording.wav")

audio.fade_in(2000)       # 2-second fade in
audio.fade_out(3000)      # 3-second fade out
audio.normalize()         # peak normalize to 0 dBFS
audio.reverse()           # reverse the audio
audio.speed(1.5)          # 1.5ร— speed (no pitch change)
audio.remove_silence()    # strip silent gaps

Phase 4 preview โ€” AI Enhancement

audio = Audio.load("noisy_podcast.mp3")

clean = audio.remove_noise()    # deep learning noise suppression
clean = audio.remove_echo()     # echo / reverb reduction
clean = audio.clean()           # full pipeline: noise + echo + background

clean.export("podcast_clean.mp3")

Phase 5 preview โ€” Speech Intelligence

audio = Audio.load("interview.mp3")

transcript = audio.transcribe()
# "Welcome to the show. Today we are talking about..."

lang = audio.detect_language()
# "en"

speakers = audio.identify_speakers()
# [{"speaker": "A", "start": 0.0, "end": 12.4},
#  {"speaker": "B", "start": 12.4, "end": 28.1}, ...]

Phase 6 preview โ€” Embeddings & Search

audio = Audio.load("podcast.mp3")

# Semantic search across your audio
audio.search("discussion about climate change")
# [{"start": 342.1, "end": 398.6, "score": 0.94}, ...]

# Generate an embedding vector for downstream ML
embedding = audio.embed()   # numpy array

Phase 7 preview โ€” AI Workflows

audio = Audio.load("team_meeting.mp3")

print(audio.summarize())
# "The team discussed Q3 targets, identified a blocker in the
#  API integration, and agreed to reconvene Thursday."

print(audio.extract_actions())
# ["John to send API docs by Wednesday",
#  "Sarah to review the staging environment",
#  "Team sync scheduled for Thursday 10am"]

audio.generate_minutes()   # returns structured markdown

Phase 10 preview โ€” Agentic Pipeline

audio = Audio.load("board_meeting.mp3")

audio.clean()
audio.transcribe()
audio.identify_speakers()
audio.extract_actions()
audio.summarize()
audio.export_report("board_meeting_report.md")

# Produces a complete markdown report:
# - Full transcript with speaker labels
# - Executive summary
# - Action items by owner
# - Key topics and timestamps

Project Structure

aiaudio/
โ”‚
โ”œโ”€โ”€ core/
โ”‚   โ”œโ”€โ”€ audio.py        # Audio class โ€” the main user-facing object
โ”‚   โ”œโ”€โ”€ loader.py       # Format detection, WAV read, FFmpeg decode
โ”‚   โ”œโ”€โ”€ exporter.py     # WAV write, FFmpeg encode
โ”‚   โ””โ”€โ”€ ffmpeg.py       # FFmpeg subprocess bridge (probe, load, export)
โ”‚
โ”œโ”€โ”€ cli/
โ”‚   โ””โ”€โ”€ main.py         # aiaudio CLI โ€” argparse subcommands
โ”‚
โ”œโ”€โ”€ effects/            # Phase 3 โ€” fade, normalize, reverse, silence
โ”œโ”€โ”€ ai/                 # Phases 4โ€“7 โ€” enhancer, whisper, diarization, LLM
โ”œโ”€โ”€ gui/                # Phase 2.5 โ€” Gradio format converter
โ”œโ”€โ”€ plugins/            # Phase 9 โ€” plugin registry
โ””โ”€โ”€ utils/

tests/
โ”œโ”€โ”€ test_core.py        # Phase 1 โ€” 22 tests
โ”œโ”€โ”€ test_cli.py         # Phase 1.1 โ€” 9 tests
โ””โ”€โ”€ test_phase2.py      # Phase 2 โ€” 17 tests (8 skipped if FFmpeg absent)

setup.py
pyproject.toml
README.md
AIAUDIO_PLAN.md         # full phased plan with API sketches and UI mockups

Design Principles

Immutable API Every method returns a new Audio object. The original is never modified, so you can branch freely without defensive copying.

original = Audio.load("song.wav")
louder   = original.increase_volume(6)   # new object
clip     = original.slice(10, 20)        # original still untouched

Lean core, optional extras The core library installs in seconds โ€” only numpy and scipy. Heavy ML dependencies (PyTorch, Whisper, Demucs) only arrive when you opt in:

pip install aiaudio           # core only (~10 MB)
pip install "aiaudio[ai]"     # adds torch + whisper + more

One code path The CLI and (future) GUI are thin orchestration layers. All logic lives in the Audio class. There is no special-casing for how a request arrived.

Float32 internally Samples are normalised to [-1.0, 1.0] on load regardless of source bit depth. All DSP math operates in float32. Conversion back to int16 happens only on WAV export.

Format-transparent Audio.load("file.mp3") and Audio.load("file.wav") have identical return types and behave identically. The format routing is invisible to the caller.


Running Tests

# Run all tests
pytest

# Verbose output
pytest -v

# With coverage report
pytest --cov=aiaudio --cov-report=term-missing

# Core only (no FFmpeg needed)
pytest tests/test_core.py tests/test_cli.py -v

FFmpeg integration tests skip automatically if FFmpeg is not installed โ€” they do not fail.

48 passed, 8 skipped   โ† skipped = FFmpeg not present
56 passed, 0 skipped   โ† when FFmpeg is installed

Contributing

Contributions are welcome. The project follows a phase-by-phase build order โ€” see AIAUDIO_PLAN.md for the full roadmap and API design for upcoming phases.

  1. Fork the repo and create a branch from main
  2. Install dev dependencies: pip install -e ".[dev]"
  3. Make your changes and add tests
  4. Ensure all tests pass: pytest
  5. Open a pull request

License

MIT โ€” free to use, modify, and distribute.


Built with โค๏ธ โ€” AIAudio: Audio Processing Meets Audio Intelligence

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

aiaudio-1.0.0.tar.gz (23.8 kB view details)

Uploaded Source

Built Distribution

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

aiaudio-1.0.0-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file aiaudio-1.0.0.tar.gz.

File metadata

  • Download URL: aiaudio-1.0.0.tar.gz
  • Upload date:
  • Size: 23.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for aiaudio-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c9f340e2a6969a58a949dd72d252eadeac5b4359d6769d04f5ddc73359352be6
MD5 45c2d70d649329f0e87bbf3488ce28e1
BLAKE2b-256 d7c09b163b3f8037b0fbf13bf8013f7a254c36761a5cb223526179eca3e5f305

See more details on using hashes here.

File details

Details for the file aiaudio-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: aiaudio-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for aiaudio-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 16078517cb7187e72be9856e66f492eb0cd38b5dfc3833f71a04bd20f4078843
MD5 add6cdb78d3d9785f60a29ffc5cb56d0
BLAKE2b-256 e669422db512cca308b99349f96ea7dc6c9cd495f17dccb5db78fa61cf417db8

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