playsound3


Nameplaysound3 JSON
Version 3.2.6 PyPI version JSON
download
home_pageNone
SummaryCross-platform library to play audio files
upload_time2025-08-21 15:18:59
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT License
keywords audio media mp3 music play playsound song sound wav wave
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            > **Version 3.0.0**
>
> New functionalities:
> * stop sounds by calling `sound.stop()`
> * check if sound is still playing with `sound.is_alive()`

# playsound3

[![PyPi version](https://img.shields.io/badge/dynamic/json?label=latest&query=info.version&url=https%3A%2F%2Fpypi.org%2Fpypi%2Fplaysound3%2Fjson)](https://pypi.org/project/playsound3)
[![PyPI license](https://img.shields.io/badge/dynamic/json?label=license&query=info.license&url=https%3A%2F%2Fpypi.org%2Fpypi%2Fplaysound3%2Fjson)](https://pypi.org/project/playsound3)

Cross platform library to play sound files in Python.

## Installation

Install via pip:

```
pip install playsound3
```

## Quick Start

After installation, playing sounds is simple:

```python
from playsound3 import playsound

# Play sounds from disk
playsound("/path/to/sound/file.mp3")

# or play sounds from the internet.
playsound("http://url/to/sound/file.mp3")

# You can play sounds in the background
sound = playsound("/path/to/sound/file.mp3", block=False)

# and check if they are still playing
if sound.is_alive():
    print("Sound is still playing!")

# and stop them whenever you like.
sound.stop()
```

## Reference

### playsound

```python
def playsound(
    sound: str | Path,
    block: bool = True,
    backend: str | None = None,
) -> Sound
```

`sound` (required) \
The audio file you want to play (local or URL).

`block` (optional, default=`True`)\
Determines whether the sound plays synchronously (blocking) or asynchronously (background).

`backend` (optional, default=`None`) \
Specify which audio backend to use.
If `None`, the best backend is determined automatically.

To see a list of backends supported by your system:

```python
from playsound3 import AVAILABLE_BACKENDS, DEFAULT_BACKEND

print(AVAILABLE_BACKENDS)  # for example: ["gstreamer", "ffmpeg", ...]
print(DEFAULT_BACKEND)  # for example: "gstreamer"
```

### Sound

`playsound` returns a `Sound` object for playback control:

| Method        | Description                               |
|---------------|-------------------------------------------|
| `.is_alive()` | Checks if the sound is currently playing. |
| `.wait()`     | Blocks execution until playback finishes. |
| `.stop()`     | Immediately stops playback.               |

## Supported systems

* **Linux**
    * GStreamer
    * ALSA (aplay and mpg123)
* **Windows**
    * WMPlayer
    * winmm.dll
* **macOS**
    * AppKit
    * afplay
* **Multiplatform**
    * FFmpeg

## Supported audio formats

The bare minimum supported by every backend are `.mp3` and `.wav` files.
Using them will keep your program compatible across different systems.
To see an exhaustive list of extensions supported by a backend, refer to their respective documentation.

## Fork information

This repository was originally forked from [playsound](https://github.com/TaylorSMarks/playsound) library created by Taylor Marks.
The original library is not maintained anymore and doesn't accept pull requests.
This library is a major rewrite of its original.

Feel free to create an issue or contribute to `playsound3`!

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "playsound3",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "Szymon Mikler <sjmikler@gmail.com>",
    "keywords": "audio, media, mp3, music, play, playsound, song, sound, wav, wave",
    "author": null,
    "author_email": "Szymon Mikler <sjmikler@gmail.com>, Taylor Marks <taylor@marksfam.com>",
    "download_url": "https://files.pythonhosted.org/packages/28/4d/3880fd3e97d4655955d0ada4f2745453eb87d9615062ec41953717579b13/playsound3-3.2.6.tar.gz",
    "platform": null,
    "description": "> **Version 3.0.0**\n>\n> New functionalities:\n> * stop sounds by calling `sound.stop()`\n> * check if sound is still playing with `sound.is_alive()`\n\n# playsound3\n\n[![PyPi version](https://img.shields.io/badge/dynamic/json?label=latest&query=info.version&url=https%3A%2F%2Fpypi.org%2Fpypi%2Fplaysound3%2Fjson)](https://pypi.org/project/playsound3)\n[![PyPI license](https://img.shields.io/badge/dynamic/json?label=license&query=info.license&url=https%3A%2F%2Fpypi.org%2Fpypi%2Fplaysound3%2Fjson)](https://pypi.org/project/playsound3)\n\nCross platform library to play sound files in Python.\n\n## Installation\n\nInstall via pip:\n\n```\npip install playsound3\n```\n\n## Quick Start\n\nAfter installation, playing sounds is simple:\n\n```python\nfrom playsound3 import playsound\n\n# Play sounds from disk\nplaysound(\"/path/to/sound/file.mp3\")\n\n# or play sounds from the internet.\nplaysound(\"http://url/to/sound/file.mp3\")\n\n# You can play sounds in the background\nsound = playsound(\"/path/to/sound/file.mp3\", block=False)\n\n# and check if they are still playing\nif sound.is_alive():\n    print(\"Sound is still playing!\")\n\n# and stop them whenever you like.\nsound.stop()\n```\n\n## Reference\n\n### playsound\n\n```python\ndef playsound(\n    sound: str | Path,\n    block: bool = True,\n    backend: str | None = None,\n) -> Sound\n```\n\n`sound` (required) \\\nThe audio file you want to play (local or URL).\n\n`block` (optional, default=`True`)\\\nDetermines whether the sound plays synchronously (blocking) or asynchronously (background).\n\n`backend` (optional, default=`None`) \\\nSpecify which audio backend to use.\nIf `None`, the best backend is determined automatically.\n\nTo see a list of backends supported by your system:\n\n```python\nfrom playsound3 import AVAILABLE_BACKENDS, DEFAULT_BACKEND\n\nprint(AVAILABLE_BACKENDS)  # for example: [\"gstreamer\", \"ffmpeg\", ...]\nprint(DEFAULT_BACKEND)  # for example: \"gstreamer\"\n```\n\n### Sound\n\n`playsound` returns a `Sound` object for playback control:\n\n| Method        | Description                               |\n|---------------|-------------------------------------------|\n| `.is_alive()` | Checks if the sound is currently playing. |\n| `.wait()`     | Blocks execution until playback finishes. |\n| `.stop()`     | Immediately stops playback.               |\n\n## Supported systems\n\n* **Linux**\n    * GStreamer\n    * ALSA (aplay and mpg123)\n* **Windows**\n    * WMPlayer\n    * winmm.dll\n* **macOS**\n    * AppKit\n    * afplay\n* **Multiplatform**\n    * FFmpeg\n\n## Supported audio formats\n\nThe bare minimum supported by every backend are `.mp3` and `.wav` files.\nUsing them will keep your program compatible across different systems.\nTo see an exhaustive list of extensions supported by a backend, refer to their respective documentation.\n\n## Fork information\n\nThis repository was originally forked from [playsound](https://github.com/TaylorSMarks/playsound) library created by Taylor Marks.\nThe original library is not maintained anymore and doesn't accept pull requests.\nThis library is a major rewrite of its original.\n\nFeel free to create an issue or contribute to `playsound3`!\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Cross-platform library to play audio files",
    "version": "3.2.6",
    "project_urls": {
        "Documentation": "https://github.com/sjmikler/playsound3/blob/main/README.md#quick-start",
        "Home": "https://github.com/sjmikler/playsound3",
        "Issues": "https://github.com/sjmikler/playsound3/issues"
    },
    "split_keywords": [
        "audio",
        " media",
        " mp3",
        " music",
        " play",
        " playsound",
        " song",
        " sound",
        " wav",
        " wave"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7bea44040163f32d2602774737bf37d3bcb577e645b567f3e2da51a78f23425a",
                "md5": "ecb09f3e5e0f8c38191627f5de0230a6",
                "sha256": "638c059cb7d2581ca6caf5ea561d801bbdb44b5346e1c888fb702fd15a88aa49"
            },
            "downloads": -1,
            "filename": "playsound3-3.2.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ecb09f3e5e0f8c38191627f5de0230a6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 9464,
            "upload_time": "2025-08-21T15:18:57",
            "upload_time_iso_8601": "2025-08-21T15:18:57.529202Z",
            "url": "https://files.pythonhosted.org/packages/7b/ea/44040163f32d2602774737bf37d3bcb577e645b567f3e2da51a78f23425a/playsound3-3.2.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "284d3880fd3e97d4655955d0ada4f2745453eb87d9615062ec41953717579b13",
                "md5": "7a8d9646bc84eb3ba731d779e452b39d",
                "sha256": "a036b586c1e2592cef42eb6e06b28516f6a97f2e71034164186da7e9c2b84553"
            },
            "downloads": -1,
            "filename": "playsound3-3.2.6.tar.gz",
            "has_sig": false,
            "md5_digest": "7a8d9646bc84eb3ba731d779e452b39d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 608111,
            "upload_time": "2025-08-21T15:18:59",
            "upload_time_iso_8601": "2025-08-21T15:18:59.329606Z",
            "url": "https://files.pythonhosted.org/packages/28/4d/3880fd3e97d4655955d0ada4f2745453eb87d9615062ec41953717579b13/playsound3-3.2.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-21 15:18:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sjmikler",
    "github_project": "playsound3",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "playsound3"
}
        
Elapsed time: 3.48232s