The SeaPlayer library for async/sync playback audio.
The module is still under DEVELOPMENT, so I do not recommend using it in your projects.
- β - fully supported
- β - not supported
- π - partial support (supported, but with nuances)
It is based on the sounddevice and soundfile module.
soundfile, in turn, is a wrapper of the C/C++ library libsndfile, which has limitations in file reading formats. More info...
Formats | Support |
---|---|
Microsoft WAV | β |
SGI / Apple AIFF / AIFC | β |
Sun / DEC / NeXT AU / SND | β |
Headerless RAW | β |
Paris Audio File (PAF) | π |
Commodore Amiga IFF / SVX | π |
Sphere Nist WAV | π |
IRCAM SF | π |
Creative VOC | π |
Sound forge (W64) | β |
GNU Octave 2.0 (MAT4) | β |
GNU Octave 2.1 (MAT5) | β |
Portable Voice Format (PVF) | π |
Fasttracker 2 XI | β |
Apple CAF | β |
Sound Designer II (SD2) | π |
Free Lossless Audio Codec FLAC | π |
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)
if __name__ == '__main__':
main()
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)
streamer.stop()
file.close()
if __name__ == '__main__':
main()