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.
Learn how to the run Pi Cap script at start-up
Follow this tutorial to set up your Pi Cap with a Raspberry Pi 1 A+/B+, Raspberry Pi 2 or Raspberry Pi 3.
Follow this tutorial to set up your Pi Cap with a Raspberry Pi Zero.
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:
In this tutorial, we are using the network connection to work with the Pi Cap. If you are using a screen with your Raspberry Pi, all the steps here will also apply that method.
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.
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/Python/picap-touch-mp3-py/tracks”. Remove all of the tracks by entering “rm *.MP3”. You can now copy the new MP3 files into this folder.
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/Python/picap-touch-mp3-py/tracks/”. You need to enter the password of the Pi. This should copy all the files.
Run the code
Now we can test our work! SSH back into the Pi, and enter “PiCapExamples/Python/picap-touch-mp3-py/run”; the Pi will run the code and touching the electrodes will play your new sounds!
In this tutorial, we used the Python code, but the same methods apply to the C++ or Node example programs, just make sure to head to the correct folder location.