Cross-platform library to play audio files
Project description
This repository was forked from TaylorSMarks/playsound
playsound3
Cross platform library to play sound files in Python.
Installation
Install via pip:
pip install playsound3
Quick Start
Once installed, you can use the playsound function to play sound files:
from playsound3 import playsound
playsound("/path/to/sound/file.mp3")
# or use directly on URLs
playsound("http://url/to/sound/file.mp3")
Documentation
The playsound module contains only one thing - the function (also named) playsound:
def playsound(sound, block: bool = True) -> None:
"""Play a sound file using an audio backend availabile in your system.
Args:
sound: Path to the sound file. Can be either an str or pathlib.Path.
block: If True, the function will block execution until the sound finishes playing.
"""
It requires one argument - the path to the file with the sound you'd like to play. This should be a local file or a URL. There's an optional second argument, block, which is set to True by default. Setting it to False makes the function run asynchronously.
Supported systems
- Linux, using GStreamer (built-in on Linux distributions)
- Windows, using winmm.dll (built-in on Windows)
- OS X, using afplay utility (built-in on OS X)
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
playsound3-2.1.1.tar.gz
(9.3 kB
view hashes)
Built Distribution
Close
Hashes for playsound3-2.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16195664b79ef1c34359d7be82bbaa8157c8df05a4047aec66070333d7d9c3cb |
|
MD5 | fd335c2a4adb890c303ff8484978eef6 |
|
BLAKE2b-256 | c9ffeea84ca6d7385e88a325dfbd317c9d5ccd2c4deb0e0c1f477828ae26753c |