Playing Songs with Arduino

A malayalam song has become viral in my state and I thought of doing that song with an Arduino. I’ve already done a song like this earlier and made a tutorial and DIY  Hacking published it! (tutorial in this link)  In this post, I’ll be explaining what exactly I did when I made it.

Arduino speaker

One day I saw the toneMelody example file in Arduino and I tried it and found it interesting. A short melody was coming out of the speaker. The program created tones with a function, ‘tone( )’. It generated a square wave of the specified frequency on a pin. A duration could be specified for this. The Arduino pin was connected to a speaker to play the tones. And I thought, why couldn’t I make a full song? So I modified the code and made a song and showed everyone and they liked it and asked me how I made ‘that particular song’. So I made a tutorial of how I made it.

Here’s what I did. I changed the melody[] and noteDurations[] arrays in that file to play that song.  It is similar to how ringtones were written in old Nokia cell phones. So how did I get all the notes? I played the song on the guitar and I wrote the notes of the song and created the the melody[array with those.  I also created noteDurations[ ] according to the length of each music note. Then I connected the Speaker to PIN3 and GND and uploaded the code.

Arduino speaker

That’s it. The song was being played on the speaker. In this new song video that I made, I also played chords of the song on my guitar along with the Arduino music. Here’s the link to my video:

Arduino file link (Download & extract the zip file and run it.)

It was just a fun project and I’ll be posting new projects soon and also writing about my old projects that I did. Stay tuned.


One thought on “Playing Songs with Arduino

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s