Skip to main content

Lightweight, pure-Python cross-platform audio playback library

Project description

pysoniq

Minimal, pure-Python cross-platform audio playback library.

  • Pure Python - No compiled extensions
  • Cross-platform - Windows, macOS, Linux
  • Minimal dependencies - Only numpy
  • Simple API - Play, pause, stop, loop

Installation

pip install pysoniq

Use in context

import pysoniq as ps
import numpy as np

# Play WAV file
ps.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)
ps.play(audio, samplerate=sr)

# Loop playback
ps.set_loop(True)
ps.play(audio, sr)

# Stop
ps.stop()

Features

Playback

ps.play(data, samplerate)  # Play audio
ps.stop()                   # Stop playback
ps.pause()                  # Pause
ps.resume()                 # Resume

Looping

ps.set_loop(True)   # Enable loop
ps.is_looping()     # Check status

Gain Control

ps.set_gain(0.5)           # 50% volume
ps.set_volume_db(-6.0)     # Set dB
audio = ps.adjust_gain_level(audio, 1.5)

Audio I/O

audio, sr = ps.load('file.wav')
ps.save('output.wav', audio, sr)

Platform Requirements

  • Windows: Built-in (winsound)
  • macOS: Built-in (afplay)
  • Linux: ALSA (aplay) - usually pre-installed

Limitations

  • WAV format only (for now)
  • Pause/resume uses time-based estimation
  • Gain changes apply on next loop iteration

License

MIT

Author

laelume

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

pysoniq-0.1.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

pysoniq-0.1.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file pysoniq-0.1.0.tar.gz.

File metadata

  • Download URL: pysoniq-0.1.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for pysoniq-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d95d0c30650ddb8848cf174784378263559c020e0d97b6ed6b133bfd4f023973
MD5 9adfa11dd3196ae2064a25bd376a55d0
BLAKE2b-256 61fb8c039e2f7f39f9c31627644fd65511fc91f2adb2a0a696dc505dc123ad2f

See more details on using hashes here.

File details

Details for the file pysoniq-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pysoniq-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for pysoniq-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9565ec9c73865b3b1d415ef56a66488546facd228dc55cb3c100a04f0adf88ff
MD5 3a7fa83af39fcb3e38c906d043ed5965
BLAKE2b-256 7fc94510ea4a81199bd2c39da0a791ad21d011498a70476048854eacbb8daf98

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