seaplayer-audio


Nameseaplayer-audio JSON
Version 0.5.5 PyPI version JSON
download
home_pagehttps://github.com/romanin-rf/seaplayer-audio
SummaryA library for async/sync playback audio.
upload_time2024-12-30 23:13:25
maintainerNone
docs_urlNone
authorRomanin
requires_python>=3.10
licenseMIT
keywords seaplayer audio sound stream play playback read io
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # seaplayer-audio
## Description
The SeaPlayer library for async/sync playback audio.

> ***The module is still under DEVELOPMENT, so I do not recommend using it in your projects.***

## Supported formats

It is based on the [sounddevice](https://github.com/spatialaudio/python-sounddevice) and [soundfile](https://github.com/bastibe/python-soundfile) module. 

[soundfile](https://github.com/bastibe/python-soundfile), in turn, is a wrapper of the C library [libsndfile](https://github.com/libsndfile/libsndfile), which has limitations in file reading formats. [More info...](https://libsndfile.github.io/libsndfile/formats.html)

## Usage (synchronously)

#### Through context manager
```python
import time
from seaplayer_audio import CallbackSoundDeviceStreamer, FileAudioSource


def main():
    with FileAudioSource('example.mp3') as source:
        with CallbackSoundDeviceStreamer() as streamer:
            while len(data := source.readline(1)) > 0:
                streamer.send( data )
                time.sleep(0.01) # Optional


if __name__ == '__main__':
    main()
```

#### Through cycle
```python
import time
from seaplayer_audio import CallbackSoundDeviceStreamer, FileAudioSource


def main():
    file = FileAudioSource('example.mp3')
    streamer = CallbackSoundDeviceStreamer()
    streamer.start()
    while len(data := source.readline(1)) > 0:
        streamer.send( data )
        time.sleep(0.01) # Optional
    streamer.stop()
    file.close()


if __name__ == '__main__':
    main()
```

## Usage (asynchronously)

#### Through context manager
```python
import asyncio
from seaplayer_audio import AsyncCallbackSoundDeviceStreamer, AsyncFileAudioSource


async def main():
    async with AsyncFileAudioSource('example.mp3') as source:
        async with AsyncCallbackSoundDeviceStreamer() as streamer:
            while len(data := await source.readline(1)) > 0:
                await streamer.send( data )
                await asyncio.sleep(0.01) # Optional


if __name__ == '__main__':
    asyncio.run(main())
```

#### Through cycle
```python
import asyncio
from seaplayer_audio import AsyncCallbackSoundDeviceStreamer, AsyncFileAudioSource


async def main():
    file = FileAudioSource('example.mp3')
    streamer = CallbackSoundDeviceStreamer()
    await streamer.start()
    while len(data := await source.readline(1)) > 0:
        await streamer.send( data )
        await asyncio.sleep(0.01) # Optional
    await streamer.stop()
    await file.close()


if __name__ == '__main__':
    asyncio.run(main())
```
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/romanin-rf/seaplayer-audio",
    "name": "seaplayer-audio",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "seaplayer, audio, sound, stream, play, playback, read, io",
    "author": "Romanin",
    "author_email": "60302782+romanin-rf@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/f1/8d/16cfcfce35e0c360afe3c39629af08a8e32b6564a0fcabfb5e7d42286783/seaplayer_audio-0.5.5.tar.gz",
    "platform": null,
    "description": "# seaplayer-audio\n## Description\nThe SeaPlayer library for async/sync playback audio.\n\n> ***The module is still under DEVELOPMENT, so I do not recommend using it in your projects.***\n\n## Supported formats\n\nIt is based on the [sounddevice](https://github.com/spatialaudio/python-sounddevice) and [soundfile](https://github.com/bastibe/python-soundfile) module. \n\n[soundfile](https://github.com/bastibe/python-soundfile), in turn, is a wrapper of the C library [libsndfile](https://github.com/libsndfile/libsndfile), which has limitations in file reading formats. [More info...](https://libsndfile.github.io/libsndfile/formats.html)\n\n## Usage (synchronously)\n\n#### Through context manager\n```python\nimport time\nfrom seaplayer_audio import CallbackSoundDeviceStreamer, FileAudioSource\n\n\ndef main():\n    with FileAudioSource('example.mp3') as source:\n        with CallbackSoundDeviceStreamer() as streamer:\n            while len(data := source.readline(1)) > 0:\n                streamer.send( data )\n                time.sleep(0.01) # Optional\n\n\nif __name__ == '__main__':\n    main()\n```\n\n#### Through cycle\n```python\nimport time\nfrom seaplayer_audio import CallbackSoundDeviceStreamer, FileAudioSource\n\n\ndef main():\n    file = FileAudioSource('example.mp3')\n    streamer = CallbackSoundDeviceStreamer()\n    streamer.start()\n    while len(data := source.readline(1)) > 0:\n        streamer.send( data )\n        time.sleep(0.01) # Optional\n    streamer.stop()\n    file.close()\n\n\nif __name__ == '__main__':\n    main()\n```\n\n## Usage (asynchronously)\n\n#### Through context manager\n```python\nimport asyncio\nfrom seaplayer_audio import AsyncCallbackSoundDeviceStreamer, AsyncFileAudioSource\n\n\nasync def main():\n    async with AsyncFileAudioSource('example.mp3') as source:\n        async with AsyncCallbackSoundDeviceStreamer() as streamer:\n            while len(data := await source.readline(1)) > 0:\n                await streamer.send( data )\n                await asyncio.sleep(0.01) # Optional\n\n\nif __name__ == '__main__':\n    asyncio.run(main())\n```\n\n#### Through cycle\n```python\nimport asyncio\nfrom seaplayer_audio import AsyncCallbackSoundDeviceStreamer, AsyncFileAudioSource\n\n\nasync def main():\n    file = FileAudioSource('example.mp3')\n    streamer = CallbackSoundDeviceStreamer()\n    await streamer.start()\n    while len(data := await source.readline(1)) > 0:\n        await streamer.send( data )\n        await asyncio.sleep(0.01) # Optional\n    await streamer.stop()\n    await file.close()\n\n\nif __name__ == '__main__':\n    asyncio.run(main())\n```",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A library for async/sync playback audio.",
    "version": "0.5.5",
    "project_urls": {
        "Homepage": "https://github.com/romanin-rf/seaplayer-audio",
        "Repository": "https://github.com/romanin-rf/seaplayer-audio"
    },
    "split_keywords": [
        "seaplayer",
        " audio",
        " sound",
        " stream",
        " play",
        " playback",
        " read",
        " io"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "36230ed599bf7473b224604a9a9b2b6360231983ccc2d91066afc5aaeeeb3b01",
                "md5": "2a73dbe88ca576ed92e8a2c4684bd99a",
                "sha256": "53506c10005488986f622f7c255aae092053e89b03638d422a528c2ed49cd744"
            },
            "downloads": -1,
            "filename": "seaplayer_audio-0.5.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2a73dbe88ca576ed92e8a2c4684bd99a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 18473,
            "upload_time": "2024-12-30T23:13:23",
            "upload_time_iso_8601": "2024-12-30T23:13:23.271116Z",
            "url": "https://files.pythonhosted.org/packages/36/23/0ed599bf7473b224604a9a9b2b6360231983ccc2d91066afc5aaeeeb3b01/seaplayer_audio-0.5.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f18d16cfcfce35e0c360afe3c39629af08a8e32b6564a0fcabfb5e7d42286783",
                "md5": "fda645a8d2809723e6695981d21d522f",
                "sha256": "3402fe7f27bdcfb894d8d1e8335f1e549262f5a7ea54d53df25f495e0de191c0"
            },
            "downloads": -1,
            "filename": "seaplayer_audio-0.5.5.tar.gz",
            "has_sig": false,
            "md5_digest": "fda645a8d2809723e6695981d21d522f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 12392,
            "upload_time": "2024-12-30T23:13:25",
            "upload_time_iso_8601": "2024-12-30T23:13:25.511802Z",
            "url": "https://files.pythonhosted.org/packages/f1/8d/16cfcfce35e0c360afe3c39629af08a8e32b6564a0fcabfb5e7d42286783/seaplayer_audio-0.5.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-30 23:13:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "romanin-rf",
    "github_project": "seaplayer-audio",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "seaplayer-audio"
}
        
Elapsed time: 1.19007s