this repo holds a python script that randomly plays sounds when triggered by a GPIO pin (such as on a raspberry pi). it uses gpiozero to poll the GPIO and pygame to play the sounds (since playsound doesn't work on raspberry pi's).
- clone this repository to a folder.
- [Optional] setup a virtual environment.
python -m venv .venv. ./.venv/bin/activate(or./.venv/bin/activate.baton Windows)
pip install -r requirements.txt- create a
soundsfolder and put sounds (OGG or WAV, per pygame docs) in it, or else editapp.pyto point to a different sounds folder. python app.py