Example MP3 playback code for the Bare Conductive Pi Cap. You need twelve MP3 files named TRACK000.mp3 to TRACK011.mp3 in a folder called tracks
inside this folder. When you touch electrode E0, TRACK000.mp3 will play. When you touch electrode E1, TRACK001.mp3 will play, and so on. Playback is polyphonic, which is nice.
picap-touch-mp3-py
│
└──tracks
TRACK000.mp3
TRACK001.mp3
TRACK002.mp3
TRACK003.mp3
TRACK004.mp3
TRACK005.mp3
TRACK006.mp3
TRACK007.mp3
TRACK008.mp3
TRACK009.mp3
TRACK010.mp3
TRACK011.mp3
- Requires python-dev (
apt-get install python-dev
) - Requires WiringPi (
apt-get install wiringpi
) - Requires Bare Conductive's MPR121 libary for WiringPi
- Requires python-pygame (
apt-get install python-pygame
)
- You should install this code as part of the Pi Cap Raspbian package:
sudo apt-get install picap
- However, if you are doing this yourself, clone the repository and follow the usage instructions.
python touch-mp3.py
N.B. must be run as root