Nav

How to make a MIDI piano with the Pi Cap

Learn how to make a MIDI piano with the Pi Cap

The Pi Cap is great for adding sound to your Raspberry Pi projects and creating a MIDI piano with the Pi Cap is easily done! All you need is a Raspberry Pi, a Pi Cap, some Electric Paint and a piece of paper. For this tutorial, we SSH into the Pi to create the piano, but 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.

Learn how to create a power switch for the Raspberry Pi

How to make a power switch for the Raspberry Pi

Learn how to the run Pi Cap script at start-up

How to run Pi Cap script at start-up

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:

Setting up your Pi Cap on the Raspberry Pi 1, 2 or 3

Setting up your Pi Cap on the Raspberry Pi Zero

Links

Step 2

Download FluidSynth and the project

Once you have SSH’d into the Pi, download FluidSynth by entering “sudo apt-get install fluidsynth”. This will install the library that you need.

Next, download the MIDI piano code by entering “git clone https://github.com/BareConductive/picap-midi-cpp”. You can find the project on our GitHub page.

Links

Step 3

Test the code

When you have downloaded the project, connect some speakers or headphones to the Raspberry Pi. If you are using a Pi Zero, connect the speakers or headphones to the Pi Cap. Run the code by entering “./picap-midi-cpp/run”. Try touching the electrodes, you should be able to hear the piano keys!

If you want to quit the code hit the CTRL + C keys. If you want to change the keys that are used, open the main code with “nano ./picap-midi-cpp/midi.cpp”. At the bottom of the code you can find the lines “cout << “noteon 0 ” << 71-i << ” 100″ << endl;” and below you can find the corresponding line with “noteoff”. The 71 here refers to a piano key, by changing it to a number between 11 and 127, you can change the set of keys that are playing.

Links

Step 4

Attach piano keys

The electrodes of the Pi Cap are simulating the piano keys and you can use any conductive materials to connect to the electrodes. For example, you could use Electric Paint, crocodile clips, or copper tape.

For this tutorial, we have screen printed 12 piano keys with Electric Paint. To find out how to screen print with Electric Paint, have a look at our screen printing tutorial. You can download the piano stencil as part of the digital toolkit. We then cold soldered the Pi Cap to the piano. For more information about cold soldering, you can read the cold soldering tutorial. It’s easier to unplug the Pi if you are cold soldering to the Pi Cap.

Links

Step 5

Run the code

Plug the board back in, power it up and run the code. When you now touch the Electric Paint, you should hear the piano keys!

To take this project further we suggest looking into launching the code at start-up and adding a power switch to the Pi.

We’d love to see your creations, so feel free to send us images or videos at info@bareconductive.com or via Instagram or Twitter.

Links
MIDI piano with the Pi Cap and Raspberry Pi Zero

Suggested Tutorials

Learn how to create a power switch for the Raspberry Pi

How to make a power switch for the Raspberry Pi

Learn how to the run Pi Cap script at start-up

How to run Pi Cap script at start-up

Categories

Bare Conductive

Instructions

Pi Cap

Date Posted

2018/09/18

Rating

0.00 avg. rating (0% score) - 0 votes