Skip to content

romanin-rf/seaplayer-audio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  • βœ… - 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 πŸŒ—

Usage

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)


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)
    streamer.stop()
    file.close()


if __name__ == '__main__':
    main()