Lightweight Pythonic cross-platform audio playback library
Project description
pysoniq
Minimal Pythonic cross-platform audio analysis, synthesis, and playback library.
- Cross-platform - Windows, macOS, Linux
- Minimal dependencies - numpy, scipy, wave, ffmpeg
- Simple API - Play, pause, stop, loop
Installation
pip install pysoniq
WIP: For MP3 support, install ffmpeg: https://ffmpeg.org/
Use in context
import pysoniq
import numpy as np
# Play WAV file
pysoniq.play('audio.wav')
# Play as numpy array
sr = 44100
t = np.linspace(0, 1.0, sr)
audio = 0.3 * np.sin(2 * np.pi * 440 * t)
pysoniq.play(audio, samplerate=sr)
# Loop playback
pysoniq.set_loop(True)
pysoniq.play(audio, sr)
# Stop
pysoniq.stop()
import pysoniq.fourier as pf
S = pf.magnitude_stft(audio, n_fft=2048)
S_db = pf.amplitude_to_db(S)
import pysoniq.audioblobs
# Make audio blobs for model input
X, y = make_audioblobs(
source = "path/to/wav_dir", # path to source audio (files or subdirs); output mirrors input tree
n_fft = 512, # number of fft bins (frequency resolution)
metric = "euclidean", # distance metric between samples
n_classes = 10, # arbitrary data-driven class prototype
aggregation = "frame", # segmentation resolution; supports frame and syllable
random_state = 42, # random seed for repeatability
verbose = True, # include logging
)
Platform Requirements
- Windows: Built-in (winsound)
- macOS: Built-in (afplay)
- Linux: ALSA (aplay) - usually pre-installed
- MP3: ffmpeg (install separately)
Limitations
- mp3 support is WIP
- Pause/resume uses time-based estimation
- Gain changes apply on next loop iteration
Author & License
Copyright 2025-2026 laelume. Licensed under MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pysoniq-0.1.9.tar.gz
(29.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
pysoniq-0.1.9-py3-none-any.whl
(31.5 kB
view details)
File details
Details for the file pysoniq-0.1.9.tar.gz.
File metadata
- Download URL: pysoniq-0.1.9.tar.gz
- Upload date:
- Size: 29.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f0b9bbb743385755138333b11ae4cc32d0e0c54d7cbbd5fa9011c35615f7e57
|
|
| MD5 |
649758b911be40c05beb4bd075032ee9
|
|
| BLAKE2b-256 |
9f3be7eecb832af5cded59ac3b5c0544dd1627a1a557637ae7be81e5ddce0b36
|
File details
Details for the file pysoniq-0.1.9-py3-none-any.whl.
File metadata
- Download URL: pysoniq-0.1.9-py3-none-any.whl
- Upload date:
- Size: 31.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4a5bad935a868a84ee4ea4be9870500d05c52272689e0c3ca0b1a7e68858968
|
|
| MD5 |
349eb5471623bf46b745ffae30973f77
|
|
| BLAKE2b-256 |
84b1724255b25993be814145eadf8100dfa583dd7aafc56a04447409f07813e8
|