How to change the tracks on the Pi Cap
Find out how to change the tracks on the Pi Cap
One of our most popular examples for the Pi Cap is touch-mp3, which allows you to play different audio tracks by touching the Pi Cap’s electrodes. By default, it is set up with 12 different instrument sound effects, but in this tutorial, we will show you how to change these 12 tracks to whatever you like.
First, we will gather together the audio files on our computer. We will then SSH into the Pi, to remove the currently existing files. Next, we will copy the files from our computer to the Pi via SSH.
If you don’t want to use SSH and the terminal, you can also use a monitor, keyboard and mouse connected to your Raspberry Pi to move the files manually.
Step 1 Set-up the Pi Cap
If you haven’t set up your Pi Cap then make sure to complete one of our set up tutorials first:
Step 2 Prepare the tracks
First, make sure that you have all the tracks you want the Pi Cap to play saved onto the computer that you will SSH into the Pi from.
There are two conditions for the tracks to work with the Pi Cap: They all need to be MP3 tracks and they need to have specific names so that they match with the electrodes on the Pi Cap. The track that is going to be played with electrode E0 needs to be named TRACK000.mp3, the second TRACK001.mp3 for E1 and so on, up to TRACK011.mp3 for E11. If your sound files aren’t in the MP3 format, you can use any online converter, for example, Media.io.
Step 3 Prepare the Pi
After you’ve SSH’d into the Pi (see the setup tutorials above for more info on how to do this), head to the right folder by entering “cd PiCapExamples/cpp/picap-touch-mp3-cpp/tracks”. Remove all of the tracks by entering “rm *.MP3”. You can now copy the new MP3 files into this folder.
Step 4 Copy files from your computer to the Pi
Back on your computer, you can copy the files to the Pi. Open your Terminal window and head to the folder where you have saved the tracks. Then, simply enter “scp *.mp3 email@example.com:PiCapExamples/cpp/picap-touch-mp3-cpp/tracks/”. You need to enter the password of the Pi. This should copy all the files.
Step 5 Run the code
Now we can test our work! SSH back into the Pi, and enter “PiCapExamples/cpp/picap-touch-mp3-cpp/run”; the Pi will run the code and touching the electrodes will play your new sounds!
In this tutorial, we used the C++ code, but the same methods apply to the Python or Node example programs, just make sure to head to the correct folder location.