Skip to content

Latest commit

 

History

History
30 lines (19 loc) · 1.11 KB

File metadata and controls

30 lines (19 loc) · 1.11 KB

python-ffmpegio-example-audioplayer

A set of example Python scripts to use ffmpegio for audio playback, interfacing with various audio player packages.

simpleaudio_player.py

This script plays a test file using simpleaudio package's play_buffer() function.

The ffmpegio's stream reader populates the shared bytearray buffer incrementally as simpleaudio plays the buffer

pyaudio_player.py

This script plays a test file using pyaudio package's [callback IO mode] (https://people.csail.mit.edu/hubert/pyaudio/docs/#example-callback-mode-audio-i-o).

The pyaudio stream's callback function calls the read() function of the ffmpegio's stream reader.

Bonus

testfile_generator.py ^^^^^^^^^^^^^^^^^^^^^^^

Generate random test audio files (tone or noise) with ffmpegio.transcode() and ffmpegio.FilterGraph. The data is generated by FFmpeg's aevalsrc filter