playsound3


Nameplaysound3 JSON
Version 2.2.2 PyPI version JSON
download
home_pageNone
SummaryCross-platform library to play audio files
upload_time2024-09-15 11:05:10
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.
            # 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

Once installed, you can use the playsound function to play sound files:

```python
from playsound3 import playsound

playsound("/path/to/sound/file.mp3")

# or use directly on URLs
playsound("http://url/to/sound/file.mp3")
```

## Documentation

The `playsound3` module contains a single function named `playsound`:

```python
def playsound(sound, block=True, backend=None) -> None:
    """Play a sound file using an audio backend availabile in your system.

    Args:
        sound: Path or URL to the sound file. Can be a string or pathlib.Path.
        block: If True, the function will block execution until the sound finishes playing.
               If False, sound will play in a background thread.
        backend: Name of the audio backend to use. Use None for automatic selection.
    """
    ...
```

It requires one argument: `sound` - 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.
You can manually specify a backend by passing its name as the third argument.
You can browse available backends by using `playsound3.AVAILABLE_BACKENDS`.
It is recommended to use the default value of `None` to let the library choose the best backend available.

## Supported systems

* **Linux** using one of the below backends, whichever is available:
    * GStreamer
    * FFmpeg
    * aplay for .wav and mpg123 .mp3
* **Windows** using winmm.dll (built-in on Windows)
* **OS X** using afplay utility (built-in on OS X)

## Fork information

This repository was originally forked from [playsound](https://github.com/TaylorSMarks/playsound) library created by Taylor Marks. The original library is unfortunately not maintained anymore and doesn't accept pull requests. This library: `playsound3` is a major rewrite of the original, including its own set of tests hosted using GitHub Actions. 

Compared to the original, `playsound3`:
* drops support for Python 2
* adheres to the latest PEP standards
* offers multiple backends with a fallback mechanism if the default backend is not available
* is accepting contributions

            

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/1c/0d/4f7d9f77679f362d07e2ff40f4810ab23507fe361a6efe2a224ad19b57dc/playsound3-2.2.2.tar.gz",
    "platform": null,
    "description": "# 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\nOnce installed, you can use the playsound function to play sound files:\n\n```python\nfrom playsound3 import playsound\n\nplaysound(\"/path/to/sound/file.mp3\")\n\n# or use directly on URLs\nplaysound(\"http://url/to/sound/file.mp3\")\n```\n\n## Documentation\n\nThe `playsound3` module contains a single function named `playsound`:\n\n```python\ndef playsound(sound, block=True, backend=None) -> None:\n    \"\"\"Play a sound file using an audio backend availabile in your system.\n\n    Args:\n        sound: Path or URL to the sound file. Can be a string or pathlib.Path.\n        block: If True, the function will block execution until the sound finishes playing.\n               If False, sound will play in a background thread.\n        backend: Name of the audio backend to use. Use None for automatic selection.\n    \"\"\"\n    ...\n```\n\nIt requires one argument: `sound` - the path to the file with the sound you'd like to play.\nThis should be a local file or a URL.\nThere's an optional second argument: `block` which is set to `True` by default.\nSetting it to `False` makes the function run asynchronously.\nYou can manually specify a backend by passing its name as the third argument.\nYou can browse available backends by using `playsound3.AVAILABLE_BACKENDS`.\nIt is recommended to use the default value of `None` to let the library choose the best backend available.\n\n## Supported systems\n\n* **Linux** using one of the below backends, whichever is available:\n    * GStreamer\n    * FFmpeg\n    * aplay for .wav and mpg123 .mp3\n* **Windows** using winmm.dll (built-in on Windows)\n* **OS X** using afplay utility (built-in on OS X)\n\n## Fork information\n\nThis repository was originally forked from [playsound](https://github.com/TaylorSMarks/playsound) library created by Taylor Marks. The original library is unfortunately not maintained anymore and doesn't accept pull requests. This library: `playsound3` is a major rewrite of the original, including its own set of tests hosted using GitHub Actions. \n\nCompared to the original, `playsound3`:\n* drops support for Python 2\n* adheres to the latest PEP standards\n* offers multiple backends with a fallback mechanism if the default backend is not available\n* is accepting contributions\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Cross-platform library to play audio files",
    "version": "2.2.2",
    "project_urls": {
        "Documentation": "https://github.com/sjmikler/playsound3?tab=readme-ov-file#documentation",
        "Issues": "https://github.com/sjmikler/playsound3/issues",
        "Repository": "https://github.com/sjmikler/playsound3"
    },
    "split_keywords": [
        "audio",
        " media",
        " mp3",
        " music",
        " play",
        " playsound",
        " song",
        " sound",
        " wav",
        " wave"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fe959d8c747f2c642f0deb62af01e8eb6aeeba9582dc73166d300814eeb59c9f",
                "md5": "1997c9c0f7613bd4137926d1b6b87b95",
                "sha256": "b562de6bd6333d1cfe83d79c2258b75474e8d18c165a07ce0eeb63b321611b96"
            },
            "downloads": -1,
            "filename": "playsound3-2.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1997c9c0f7613bd4137926d1b6b87b95",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 6530,
            "upload_time": "2024-09-15T11:05:07",
            "upload_time_iso_8601": "2024-09-15T11:05:07.723195Z",
            "url": "https://files.pythonhosted.org/packages/fe/95/9d8c747f2c642f0deb62af01e8eb6aeeba9582dc73166d300814eeb59c9f/playsound3-2.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1c0d4f7d9f77679f362d07e2ff40f4810ab23507fe361a6efe2a224ad19b57dc",
                "md5": "cd6a230aeb0b2db6015dce05d9da1506",
                "sha256": "a28c8a4a66105ba98eee7bbdd5e851ca9618c62a6df5da536d5f790ebc7cc159"
            },
            "downloads": -1,
            "filename": "playsound3-2.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "cd6a230aeb0b2db6015dce05d9da1506",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 10198,
            "upload_time": "2024-09-15T11:05:10",
            "upload_time_iso_8601": "2024-09-15T11:05:10.809460Z",
            "url": "https://files.pythonhosted.org/packages/1c/0d/4f7d9f77679f362d07e2ff40f4810ab23507fe361a6efe2a224ad19b57dc/playsound3-2.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-15 11:05:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sjmikler",
    "github_project": "playsound3?tab=readme-ov-file#documentation",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "playsound3"
}
        
Elapsed time: 0.39119s