Prototype of an algorithmic pocket player.

Prototype of an algorithmic pocket player.

I was invited to give a workshop regarding sound art in Super Public Art School that is held at Titanik-gallery in Turku. As I have been working lately with microcontroller based sound synthesis I searched for a good topic around this area. So the idea to build pocket sized audio players came a long. So here we go.

From prehistorical computer era, one of the first applications outside of the scope of actual computation has been how to generate music with a machine only capable of conducting logical operations. Nowadays computer are faster than engineers of early 20th century could hope for and interest in this low level hacking has mostly ended. But during last few years, as the usage of ultrasmall but equally slow computers – microcontrollers – has rapidly grown amongst  non-engineers: artists, hackers and makers, again larger number or people are trying to synthesize music with fairly limited tools.

The final product in this workshop is a stand alone pocket player that plays through these one line symphonys indefinetly while the power is switched on. At first attendees will search an interesting line of code. Then a pocket sized player device is built. Last step is to insert the line of code to the player.

Naturally attendees can modify this project to suit their needs. Here is some video of my simple and minimalistic proto version.

I’m hoping that the subject of this workshop scales up nicely depending of each individual participant. It is not necessary to understand much if nothing on either the electronic or programming side of this project to be able to finish it. But if one is more advanced there are zillion of things one can expand this project to make it more meaningful for oneself.


There are few projects I would like to mention here as they will form a bases of our pocket player.

2009-2010 Tristan Perich released his piece 1-Bit Symphony that gathered wide international attention. The piece is a microcontroller based electronic circuit built inside a CD-case. The microcontroller executes a program that will produce a piece qualifying as a symphony in real time.

2011 Finnish demoscene artist VIznut proposed a metodology with which to create a musical composition with just one line of code. This inspired people around the globe to search lines of code producing interesting musical pieces.

I can’t ignore the classic pocket player hit Buddha Machine here neither. This is project created by Christiaan Virant who has been able to sell thousands of these during last couple of years. On the video is some random dude demonstrating the usage and features of one of these.

One Line Symphony

We start by searching a decent line of code producing our symphony. There is lots of detail information about the theory behind the code at VIznut’s blog, but mostly the ‘composing’ phase is about random experiments. Though it is good to know the fundamentals of bitmath. Mostly to avoid spelling errors within the code. One can find online sound generator for testing out different lines. Although the microcontroller of our pocket player is not able to generate awfully long lines, so it makes sense to keep lines rather short.


The hardware is a circuit designed around ATMega328 microcontroller. It is basically a minimal version of Arduino board. Each board will have at least following components:

  • ATMega328 (or ATMega168 (or ATMega8))
  • 28 pin DIP socket (optional)
  • 100n capacitor
  • 2 x 22pF capacitors
  • 16MHz crystal
  • piezo speaker
  • 2xAA battery holder
  • piece of perfboard
  • metal wire

When working with battery power, we could probably skip all caps, but then again we want to be safe here. Note that this is very minimal setup, you will not be able to reprogram the chip through this circuit and the circuit does not include any input interface (such as button etc.). One can find a schematic of this ǔber simple schematic below:

We will use perfboard to build this circuit on. There are other ways to build this circuit also. One can for instance use stripboard or even solder everything straight to the DIP socket as shown in here. One possible layout for perfboard installation could be one below (note that PCB is illustrated from the top side of the PCB while your soldering will be going on at the bottom side!)

Programming The Microcontroller

This workshop is not about AVR programming but for those who are interested, I provide some information about how to program this device. For the rest of you I will simply burn the chip by using the line of code you were able to find.

The circuit presented above does not have any interface for programming so one needs to either use another board (for instance an Arduino board) to program the chip before attaching it to the socket or solder in additional headers through which connect a separate programmer device. If one wants to use FTDI cable etc. one probably wants to make sure that the ATMega chip has an Arduino bootloader burned to it. If you are using an ISP programmer, this is not required. If you are not interested in reprogramming the chip after the device is finished, forget this whole chapter.

If one is interested in tweaking the code for the ATMega chip, it can be downloaded from here. You can open this up by using Arduino IDE that you may download from here. Here is version that will iterate through a set of one liners when power is switched on and off.

The code updates audio output sample (around) 8000 times per second. We will simply update the sample when update occurs by using the one liner figured out above. In main loop we are not doing anything. So main loop would be good place to tweak parameters through different input methods.


During two short sessions participants built their own pocket players. Some of the participants augmented the design with multiple algorithimic one liners, using either potentiometer or eeprom-hack to select the loop. There were also some attempts to modify the one line code parameters in real time by using potentiometer. Here is a short video of three pocket players trio concerto:

Thanks for everyone who participated and made this workshop possible!

« »