Skip to main content

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.

Metadata

Release files for pysoniq 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysoniq 0.1.9
File Size Uploaded Provenance Actions
pysoniq-0.1.9.tar.gz 29.4 kB Without provenance Details for pysoniq-0.1.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pysoniq 0.1.9
File Interpreter ABI Platform Actions
pysoniq-0.1.9-py3-none-any.whl Python 3 none any Details for pysoniq-0.1.9-py3-none-any.whl

Total release size: 61.0 kB

Release files / pysoniq-0.1.9.tar.gz

Download URL pysoniq-0.1.9.tar.gz
Size 29.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0f0b9bbb743385755138333b11ae4cc32d0e0c54d7cbbd5fa9011c35615f7e57
BLAKE2b-256 checksum
How to use checksums
9f3be7eecb832af5cded59ac3b5c0544dd1627a1a557637ae7be81e5ddce0b36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / pysoniq-0.1.9-py3-none-any.whl

Download URL pysoniq-0.1.9-py3-none-any.whl
Size 31.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4a5bad935a868a84ee4ea4be9870500d05c52272689e0c3ca0b1a7e68858968
BLAKE2b-256 checksum
How to use checksums
84b1724255b25993be814145eadf8100dfa583dd7aafc56a04447409f07813e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Security for pysoniq 0.1.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page