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 and soundfile module.
soundfile, in turn, is a wrapper of the C library libsndfile, which has limitations in file reading formats. More info...
Usage (synchronously)
Through context manager
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
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
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
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())
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
seaplayer_audio-0.5.12.tar.gz
(12.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file seaplayer_audio-0.5.12.tar.gz.
File metadata
- Download URL: seaplayer_audio-0.5.12.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/1.8.5 CPython/3.12.8 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26f35548da716cda8980a4b38d96e95dbfbc7fdd97b238ef79a9b8c602bbd37c
|
|
| MD5 |
26222593452a11cf20e7b1a61eabf7cf
|
|
| BLAKE2b-256 |
2e2d5213277d2719e214dc1222a712333fd6db02ac7fe18bd758fd9270a9cd8c
|
File details
Details for the file seaplayer_audio-0.5.12-py3-none-any.whl.
File metadata
- Download URL: seaplayer_audio-0.5.12-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/1.8.5 CPython/3.12.8 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e6ad2956244f9818ba057c4e5be5921aecc416747bcafd36cd42e92902b98c4
|
|
| MD5 |
0b2050d886e58da4f53845cff25518bb
|
|
| BLAKE2b-256 |
dcfa8b62c9e75265c1ba4f91488f0a727ce127350153824b91fc9d83fc2a6090
|