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
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()

Features

Playback

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

Looping

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

Gain Control

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

Audio I/O

audio, sr = pysoniq.load('file.wav')
pysoniq.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.4.tar.gz (12.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.4-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pysoniq-0.1.4.tar.gz
  • Upload date:
  • Size: 12.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.4.tar.gz
Algorithm Hash digest
SHA256 ebd488016c5ec0db40f1c5a8f7eb6d2811857a156ffd55cd321b3906b4e11417
MD5 3d2fb42bfa3358d4546071d7f106143a
BLAKE2b-256 89970ffa9f0da722b27f9a2a18e9664bcf6a675499e462164f724e70674d1bd7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysoniq-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 13.9 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f32eeada6dcf73acd87dad9d4e7eb37f5b8adf2081345fe702ba66055cb9473c
MD5 8d08c6df284a414ffa7302deaaebc6a5
BLAKE2b-256 58b8ffa1218e66a7346975fa5ebdf0c16338e8b47e5f4bdd5cbda49f408e2da6

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