Manike Mage Hithe in Arduino MIDI Piano tone

Let’s play the famous cover song by Yohani Manike Mage Hithe in Arduino MIDI Piano tone. With a buzzer and Arduino board we can play any song’s piano tone.

Manike Mage Hithe MIDI Piano tone

What is Arduino MIDI Piano tone

Any piano key sound is in a particular frequency & the duration of the sound is determined by how long you are keeping pressed that key. This simple logic is used in this program of Arduino MIDI Piano tone.

Here in the code, we have used the Arduino library tone function to generate sound via a buzzer or 8-ohm speaker. This function takes 3 arguments- output pin no, frequency & duration of the tone.

At the start of the program, we are declaring piano key note frequency i.e. B0, C1, etc. Then in the melody array, we are given the note name & the duration of the tone like 4 for the quarter note, 8 for the eighteenth, etc. If you don’t know music generation notes, just take this value as the low number is for the long duration and the higher number is for the short duration. Later this will convert into mili seconds.

We are also using a tempo variable to control the speed of the tone. If you want to play the MIDI tone faster increase the value and decrease it for slower playback.

Connect Speaker with Arduino

Here we are using Digital pin no 9 for speaker output. If you want to change the pin, just change the value of the buzzer variable. Connect one terminal of speaker to the pin D9 & another pin to the Ground of Arduino Uno.

Arduino MIDI Piano tone

Manike Mage Hithe in Arduino Code

Share with Friends
0 0 votes
Notify of
Inline Feedbacks
View all comments