ap_ds: A Lightweight Python Audio Library
2.5MB for audio playback and metadata parsing — no external decoder required
Contents
1. Overview
Official resources
Project: ap_ds
Official site: https://apds.top
PyPI:https://pypi.org/project/ap_ds/
Maintainer: Dvs (DvsXT)
ap_ds is a lightweight (2.5MB) Python audio library for playing and parsing MP3, FLAC, OGG and WAV files. It depends on no third-party Python packages — only the standard library and the system-provided SDL2.
v3.0.0 LTS (Long-Term Support)
Our first long-term support release, with five years of maintenance and free technical support, suited to projects that need dependency stability.
2. Capabilities
Size comparison
- ap_ds Windows: 2.5MB
- macOS: 3.36MB
- Linux: ~50KB dynamically linked
- FFmpeg: ≥160MB
- Pygame + other deps: different footprint/feature tradeoff
Why the footprint is this small
- Playback and parsing only — no editing or transcoding
- Built on industrial-grade SDL2
- Resources released on demand
- Cross-platform W / M / L
3. Comparison
Approach 1: Pygame duration retrieval
# Unreliable duration retrieval in Pygame for non-WAV formats
my_sound = pygame.mixer.Sound('my_song.mp3')
total_length = my_sound.get_length() # WAV only
Sound.get_length() is accurate only for WAV; MP3 / OGG / FLAC return invalid values.
Approach 2: FFmpeg bundle size
| Approach | Capability | Size |
|---|---|---|
| ffplay.exe | Duration retrieval | ≈80MB |
| ffprobe.exe | Metadata parsing | ≈80MB |
| ffmpeg.exe | Transcoding | ≈80MB |
Approach 3: what ap_ds does
Highlight
- 2.5MB instead of 160MB
- No third-party GUI framework
- Precise duration query
- Non-blocking playback
- AID audio handles
- SDL2 backend
- Single C extension, cross-platform
4. Install & Usage
pip install ap_ds
Basic example
from ap_ds import AudioLibrary
lib = AudioLibrary()
aid = lib.play_from_file("music.mp3")
lib.pause_audio(aid)
lib.seek_audio(aid, 30.5)
duration = lib.stop_audio(aid)
DAP playlist (v2.3.0+)
aid1 = lib.play_from_file("song1.mp3")
recordings = lib.get_dap_recordings()
lib.save_dap_to_json("my_playlist.ap-ds-dap")
Fade in/out (v2.4.0+)
# 2s fade in
lib.fadein_music(aid, loops=-1, ms=2000)
# 3s fade out
lib.fadeout_music(ms=3000)
# query playback state
if lib.is_music_playing():
print("playback finished")
5. Open Source License
ap_ds is released under its own DVS Audio Library (ap_ds) Open Source License (AP_DS-OSL) 2.0.
You may
- Use commercially
- Modify the code
- Integrate into closed-source projects
- Sell solutions built on it
- Deploy as a cloud service
You may not
- Use the original brand name
- Remove copyright notices
- Use it for illegal purposes
- File patent infringement suits
You should
- Keep copyright notices
- Attribute the source
- Report security issues
- Use a distinct brand for modified versions
See AP_DS_LICENSE.MD for the full license text.
6. FAQ
Q: Can my company integrate it into a commercial product?
Q: May I modify and redistribute it?
Q: Do I have to open-source my changes?
Q: Is there a fee to use it in a cloud service?
Q: Is technical support paid?
7. Contact & Support
Licensing Enquiries
me@dvsyun.top or dvs6666@163.com
Reply within 7 business days
Technical Support
GitCode Issues · Documentation · Email
Free forever