{"id":22614695,"url":"https://github.com/romanin-rf/seaplayer-audio","last_synced_at":"2025-04-10T23:52:10.101Z","repository":{"id":263330116,"uuid":"811439194","full_name":"romanin-rf/seaplayer-audio","owner":"romanin-rf","description":"A library for async/sync playback audio.","archived":false,"fork":false,"pushed_at":"2025-01-10T17:12:19.000Z","size":4051,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T23:52:05.266Z","etag":null,"topics":["asynchronous","audio","io","module","python","seaplayer","synchronous"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/seaplayer-audio","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/romanin-rf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-06T15:46:36.000Z","updated_at":"2025-01-03T21:28:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"b61fa9dc-d7a9-46be-baec-4ed0d17d2216","html_url":"https://github.com/romanin-rf/seaplayer-audio","commit_stats":null,"previous_names":["romanin-rf/seaplayer-audio"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romanin-rf%2Fseaplayer-audio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romanin-rf%2Fseaplayer-audio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romanin-rf%2Fseaplayer-audio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romanin-rf%2Fseaplayer-audio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/romanin-rf","download_url":"https://codeload.github.com/romanin-rf/seaplayer-audio/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248317706,"owners_count":21083528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asynchronous","audio","io","module","python","seaplayer","synchronous"],"created_at":"2024-12-08T18:11:39.049Z","updated_at":"2025-04-10T23:52:10.083Z","avatar_url":"https://github.com/romanin-rf.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# seaplayer-audio\r\n## Description\r\nThe SeaPlayer library for async/sync playback audio.\r\n\r\n\u003e ***The module is still under DEVELOPMENT, so I do not recommend using it in your projects.***\r\n\r\n## Supported formats\r\n\r\nIt is based on the [sounddevice](https://github.com/spatialaudio/python-sounddevice) and [soundfile](https://github.com/bastibe/python-soundfile) module. \r\n\r\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)\r\n\r\n## Usage (synchronously)\r\n\r\n#### Through context manager\r\n```python\r\nimport time\r\nfrom seaplayer_audio import CallbackSoundDeviceStreamer, FileAudioSource\r\n\r\n\r\ndef main():\r\n    with FileAudioSource('example.mp3') as source:\r\n        with CallbackSoundDeviceStreamer() as streamer:\r\n            while len(data := source.readline(1)) \u003e 0:\r\n                streamer.send( data )\r\n                time.sleep(0.01) # Optional\r\n\r\n\r\nif __name__ == '__main__':\r\n    main()\r\n```\r\n\r\n#### Through cycle\r\n```python\r\nimport time\r\nfrom seaplayer_audio import CallbackSoundDeviceStreamer, FileAudioSource\r\n\r\n\r\ndef main():\r\n    file = FileAudioSource('example.mp3')\r\n    streamer = CallbackSoundDeviceStreamer()\r\n    streamer.start()\r\n    while len(data := source.readline(1)) \u003e 0:\r\n        streamer.send( data )\r\n        time.sleep(0.01) # Optional\r\n    streamer.stop()\r\n    file.close()\r\n\r\n\r\nif __name__ == '__main__':\r\n    main()\r\n```\r\n\r\n## Usage (asynchronously)\r\n\r\n#### Through context manager\r\n```python\r\nimport asyncio\r\nfrom seaplayer_audio import AsyncCallbackSoundDeviceStreamer, AsyncFileAudioSource\r\n\r\n\r\nasync def main():\r\n    async with AsyncFileAudioSource('example.mp3') as source:\r\n        async with AsyncCallbackSoundDeviceStreamer() as streamer:\r\n            while len(data := await source.readline(1)) \u003e 0:\r\n                await streamer.send( data )\r\n                await asyncio.sleep(0.01) # Optional\r\n\r\n\r\nif __name__ == '__main__':\r\n    asyncio.run(main())\r\n```\r\n\r\n#### Through cycle\r\n```python\r\nimport asyncio\r\nfrom seaplayer_audio import AsyncCallbackSoundDeviceStreamer, AsyncFileAudioSource\r\n\r\n\r\nasync def main():\r\n    file = FileAudioSource('example.mp3')\r\n    streamer = CallbackSoundDeviceStreamer()\r\n    await streamer.start()\r\n    while len(data := await source.readline(1)) \u003e 0:\r\n        await streamer.send( data )\r\n        await asyncio.sleep(0.01) # Optional\r\n    await streamer.stop()\r\n    await file.close()\r\n\r\n\r\nif __name__ == '__main__':\r\n    asyncio.run(main())\r\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromanin-rf%2Fseaplayer-audio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fromanin-rf%2Fseaplayer-audio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromanin-rf%2Fseaplayer-audio/lists"}