Note: This repository forks simpleaudio. The original simpleaudio repository can only play .wav file, so I use ffmpeg that could play all kinds of audio files.
The playaudio package provides cross-platform audio playback capability using ffmpeg for Python 3 on OSX, Windows, and Linux.
if you are on Ubuntu,first you should run this code in order to prevent compile errors.:
sudo apt-get install libasound2-dev
Download this repository and reach the directory, run
python setup.py build python setup.py install
on Windows: download ffmpeg and add ffmpeg.exe path to environment variables.
on MacOS:
brew install ffmpeg
on Ubuntu:
sudo apt install ffmpeg
run this code to check if you have installed ffmpeg successfully.:
ffmpeg -version
import playaudio as sa
wave_obj = sa.WaveObject.from_wave_file("path/to/file.wav")
play_obj = wave_obj.play()
play_obj.wait_done()
Jonas Kalderstam
Christophe Gohlke
Tom Christie
Many others for their contributions, documentation, examples, and more.