Makey Makey Fruit Piano

by Digijeunes in Circuits > Microcontrollers

5860 Views, 7 Favorites, 0 Comments

Makey Makey Fruit Piano

fruit_piano.PNG

Learn the basics of coding by making a simple music synthesizer where each ‘fruit’ represents a key.

Materials

Materials

  • Computer with scratch offline editor
  • Makey makey (or DIY makeymakey with Arduino Leonardo) + USB cable
  • 5 alligator clips
  • 5 fruits or conductive items

Activity

fruit_piano.PNG

The activity consists in turning fruits into a keyboard to play music with.

To get started, plug the makey makey (or DIY makey makey with Arduino Leonardo) to your computer and connect all bananas (or other conductive items) to the board via alligator clips.

fruit_piano2.PNG

Each fruit is connected to makey makey arrows, space or click buttons.

We will start by using these 5 keys.

You can now launch scratch and start writing your code. To start with, go to “Events” (light brown) section.

fruit_piano3.PNG

Next pick the “when green flag clicked” and the “forever” block.

In order to create an action, choose the “if then” block from the Control category.

fruit_piano4.PNG

“If then”, is the most common function used in coding and is used to create an interaction between your code and the outside world.

Since the activity consists in creating a piano we would like that sounds were triggered when a certain key were pressed.Under the sensing section, you will find the “Key _ pressed?” block.

Click on the small black arrow and select the key you need.

We have a condition (If then), we have chosen a key, we only need to add a sound.

fruit_piano5.PNG

To add a sound, go to the Sound (purple) section, and choose one block “play note _ for _ beats”.

fruit_piano11.PNG

At this stage your code will look like this:

fruit_piano6.PNG

Your code is already functional, you can test it by clicking on the green flag on the top of the screen.

fruit_piano7.PNG

You now need to add extra keys in order to have more piano notes altogether.

Right click on the “If then” block and a small menu will pop up. Click on “duplicate” and paste it below the first conditional. Repeat the operation for each key.

fruit_piano8.PNG

Your piano is now ready, you just need to tune it ! You need to determine the exact sound of each note. By clicking on each note, a small keyboard will pop up, which will enable you to select the note that you are looking for.

fruit_piano9.PNG

The Piano sounds funny? It’s perfectly normal! some chords played together sound well and some other don’t… So it’s time for a little bit of music theory, don’t be scared it will be fast and fun.

Here is an example of how different cords can produce different feelings depending on the order in which they are played: https://en.wikipedia.org/wiki/I%E2%80%93V%E2%80%9...

Other happy chords?

73 Songs You Can Play With The Same Four Chords

Do you want to change instrument?

It’s easy in Scratch. You can find plenty of instruments available in a list located in the Sound (purple) section.

fruit_piano10.PNG

Example of a finished code:

To go further...This code is using 4 chords and one key for change instrument. The same like a piano use pedal for change the tuning, if one key (space in this case) is pressed the code play the sound of a ‘guitar’ and when the key is released the sound is the one of ‘lead synth’.
Now you have the possibility to create a more interesting instrument. In the next lessons you will discover the Operator (light green) section, and add more possibilities and effects.

Stay tuned ;-)

Notes and References

This tutorial has been developed as part of the i Tech project, co-financed by the Erasmus + Programme of the European Union.

For more details, contact info@digijeunes.com.