Making Chiptunes With 32 Bytes Of RAM

Ah, chiptunes. One of the few remaining human endeavours where less RAM, less storage space, and fewer capabilities are actually considered an improvement. [dop3joe] over at the Stuttgart hackerspace Shackspace sent in a tiny chiptune playing circuit using the most bare-bones hardware we’ve ever seen.

The Noiseplug, as [dop3joe] calls it, is based on a very, very small 6 pin ATtiny9. With 1 kB of Flash memory and only 32 bytes of RAM [dop3joe] was able to create a small device inside an RCA jack that plays chiptunes whenever it is powered by a battery.

If you’d like to make your own noise plug, [dop3j0e] put all the code up in his Git. There are two relevant pieces of software for this build: a Windows app to create the chiptunes, and the ATtiny9 firmware itself. Of course to program the tiny, you’ll have to deal with the Atmel TPI, so here’s the application note (PDF).

Oh, [dop3joe] won third place at the Evoke demoscene party last weekend with the Noiseplug. Awesome.

25 thoughts on “Making Chiptunes With 32 Bytes Of RAM

  1. Virgin platform? I don’t think I’ve ever seen a demo on an ATTiny before, congrats!

    Pixelj.am (which happens at Notacon every spring) saw a few virgin platforms broken in this year, including the Vectrex. It was a few years ago that I first saw Milkymist, another hardware demo platform but pretty much the polar opposite in terms of raw power. ;)

    1. This specific microcontroller has no UART, which makes MIDI a little tricky — you’d have to receive MIDI data in software. Also, I’m not sure whether the necessary code would fit into Flash next to the sound generation. Plus, you probably need extra parts to be electrically compatible to the MIDI cable.

      Bottom line — it might work, and a MIDI plug probably has enough space for the extra parts. With a somewhat larger controller (like ATtiny25), I’m sure it’ll be possible.

      1. Thanks for the reply. I’d have a go at doing it, but my coding probably isn’t up to it yet (I’m currently trying to work my way on from picaxe)
        PS; as for a use for another voice or two, what about percussion?

      2. Right, percussion was top on my list of “would have been cool” features, so scratch “no ideas”, actually, and replace by “no time” — I finished the asm code one hour before the competition deadline ;)

  2. What a great post! For the windows app you can smooth out the playback by loading the buffer while waiting for the previous buffer to play. Something like this:


    while (!(GetAsyncKeyState(VK_ESCAPE) & 1))
    {

    waveOutPrepareHeader(out, &bufs[i], sizeof(WAVEHDR));
    waveOutWrite(out, &bufs[i], sizeof(WAVEHDR));

    i ^= 1;

    j = 0;
    max = 0;
    data = (uint8_t *)bufs[i].lpData;

    while(waveOutUnprepareHeader(out,&bufs[i],sizeof(WAVEHDR)) == WAVERR_STILLPLAYING)
    {
    if (j max)
    {
    max = data[j];
    // printf(“%x\n”, max);
    }
    j++;
    }
    }

    }

    1. It’s smooth for me; that’s why I’m using two buffers. I wait for a buffer to finish playing, then fill it while the other buffer plays and start waiting for that buffer.

  3. I have gone through the attiny program and am having trouble figuring out how to change the song. I think I can get the song on the windows program but then is it simply a matter of copy and pasting into the attiny program? Thanks for your time and have a great day,

    -Alan

Leave a Reply to dirtyicedirtyiceCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.