Picture of Arduino Chiptunes
I am not a big fan of programming. I may like it but, I try to keep it down to a 555 timer like in this ible. However, when it comes to synths, well, I just NEED programming. One day, while exploring Synthesizers, I came across something known as chiptunes.

I decided to listen and found the music just totally awesome. And so I tried to make it with Arduino. Unfortunately, it didn't fit the Arduino code. Fortunately, Stimmer in the Arduino Forums had ported Linus Åkesson's Hardware Chiptune Project and made it to fit the Arduino.


And now, here is that project.

Step 1: Gains and Losses.

You will gain:
A machine capable of playing a tune every time you push a button to activate it.

You will lose: (Materials)
An Arduino
A speaker+possibly an amp
2 jumper wires (If your speaker doesn't already have them)
1-40 of 45Next »
KomeylD1 month ago
i'm new to arduino.

i received this error in compiling:

Arduino: 1.6.5 (Windows 8.1), Board: "Arduino Uno"

In file included from ChiptunesLightsLinus.ino:9:0:
ChiptunesLightsLinus:19: error: variable 'songdata' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
variable 'songdata' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

I got the same error, and got it to compile by adding the keyword "const" at the beginning of the line so it looks like this: const byte songdata[] PROGMEM = {

I have to hunt down a speaker, though, so I don't know if the code actually works, just that it compiles.

Rodrigomecanica made it!1 month ago
It's so funny
_Ry_3 months ago

Thank you, blinkyblinky

On 1.6.4 I changed "byte songdata[] PROGMEM = {"

to "const PROGMEM byte songdata[] = {"

and it compiled for me.


ChrisF17 _Ry_2 months ago

Making this change allowed it to compile on mine, but the code seems to do absolutely nothing.

SteelTurtle3 months ago

First of all, thank you very much for guide.

Is there a way to add a loop, so that the music repeats itself when it's over?


Magitor4 months ago

i got:
In file included from chiptune.ino:10:0:

chiptune.ino:20:17: error: variable 'songdata' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

Error compiling is what my arduino says

Arduino 1.6.0 and beyond has problems with older code because some variable declarations have changed; revert back to Arduino 1.0.6 or something older and it should work but not before arduino 1.0 though.

Just the other day I was trying to compile some other code and found out that instead of just byte [variable name] I have to declare byte PROGMEM [variable name] in order to make it work; something similar may have happened with the Octosynth code so try an older build of Arduino such as Arduino 1.0.6 or prior.
hoàng huyđ5 months ago

How i can do it with LEONARDO?????
Can you help me in Code?

blinkyblinky (author)  hoàng huyđ5 months ago

It should work without problems. If so, try an older version of Arduino such as 1.0.6 as I have been finding out that Arduino 1.6.1 has some issues with older code.

blackcamo5 months ago

for those looking to buy arduino cheap...


Di Immortales7 months ago

oh and if u cant make the code can you give me the web address to stimmers website thanks

Di Immortales7 months ago

could you please update your code it does not work. thanks!

dheidrich9 months ago

Genius! It works finely. THX very much. Please more songs like this one!

Jean_Rolszt made it!1 year ago

Very cool :D

joesinstructables made it!1 year ago

Thanks for posting this. Is there a library somewhere of other tunes?

chiptune.MOV(516x290) 12 KB
teknohawk2 years ago
I want the entire song to start over. Thanks.
teknohawk2 years ago
I am absolutely astounded! I cannot believe this amazing Instructable. One question though, is there a way to add a "void loop() {" Function? If so, can you please tell me how?
blinkyblinky (author)  teknohawk2 years ago
Do you want the song to loop itself or do you just want a void loop?
aaronXtreme2 years ago
the code did not work.it plays for out 3 seconds the makes a fuzzy sound that doesnt end.
is he code mesed up or what. help.
tim1273 years ago
Couldn't you just plug in a 1/4in guitar cable with the wire exposed on one end for an amp?
blinkyblinky (author)  tim1272 years ago
Further later on, I did just that except with the 3.5mm cable.
freakbyte2 years ago
Hi, I just wanted to thank you for this, and say that the leds are on pin 12 and 10 if you didn't know already. Just found out while looking trough the code :)
powerman6663 years ago
How do you generate the data for the songs? I have a great Idea for storing them on an SD card for playback.
randofo3 years ago
Very awesome.

You need to add a VCF next or at least a simple low pass filter. Check out the right side of this schematic.

You can simply make buy an 1/8" plug from Radioshack and solder two wires onto it. Then, get a small test amp from Radioshack (about $15) and plug the jack into that.

Also, check out the book Handmade Electronic Music if you have not done so already.

randofo randofo3 years ago
Also, where is the song data from? How was it generated?
Ora randofo3 years ago
This is the original project that this is a ported version of: http://www.linusakesson.net/hardware/chiptune.php

Here's the thread with the port: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1265488118

I tried downloading the tracker from the original project page, but I have no idea how to actually get the tracker to run...
blinkyblinky (author)  Ora3 years ago
You need a Linux OS like Ubuntu or similar. I am running OpenSuse 11.3 but it should be very similar. You will need to install libSDL next. Then Open a terminal and use the 'change directory' command (cd) to get to where you hid the file on your computer. Next go to the same place using the GUI of your OS and read the readme file.

I don't have the file with me but I can say you execute it with something like this (again check the readme file for a more accurate command): ./tracker test2.song It should open up as a tracker.

I don't know much aside from the fact you can make it play, idle or editable. Then use the app here. You will need gcc and java for it to run.

Here is how you use the tracker.

blinkyblinky (author)  randofo3 years ago
I think it from the data in the code that is sort of like a table. I tried altering half the data and it gave me some pretty weird sounds.
blinkyblinky (author)  randofo3 years ago
Yeah, I have an amp...I also have the jack...just didn't know how to explain on my ible.
origamic123 years ago
Nice. I got it to work.
blinkyblinky (author)  origamic123 years ago
You're welcome.
Higgs Boson3 years ago
this was very cool. I cannot imagine having to write out all of the code. Thank god for copy paste.
blinkyblinky (author)  Higgs Boson3 years ago
I know right? I am not the writer, though. The Arduino code is by Stimmer in the Arduino Forums.
Axlzero4513 years ago
I instantly recognized the song the second it started in the video. I've been wanting to build one of those for years now. For all those who haven't heard of this before: http://www.youtube.com/watch?v=_uU4BzSQQmY
blinkyblinky (author)  Axlzero4513 years ago

I couldn't get the LEDs though...

Bongmaster3 years ago
where did u get the code?
blinkyblinky (author)  Bongmaster3 years ago
In a mystical book in my basement that writes code for me.

Just kidding.

I got it in the Arduino forums.
1-40 of 45Next »