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.

Comments

  1. minifloat says:

    Why don’t you phantom power it?

  2. Tjoppen says:

    Giving lft a run for his money :)
    I was at Evoke and this was rather exciting at the compo. A well deserved 3rd place. I entered too, but unsurprisingly only placed 9th (somewhat drunk coding).
    To see the rest of the entries go to http://www.pouet.net/party.php?which=18&when=2012

  3. Juan says:

    Very nice, makes me think of keygens with accompany music and animation and the .exe is only a few kb.

  4. dirtyicedirtyice says:

    Reminds me of Bit banger

  5. Chewie RFC says:

    Demoscene for hardware geeks? Me gusta.

  6. Nate says:

    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. ;)

  7. riney says:

    3 voices in 32 bytes? Flippin’ awesome.

  8. anonymouse says:

    How hard would it be to add midi controll into the program, and have a super-barebones midi synth?

    • dop3j0e says:

      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.

      • anonymouse says:

        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?

      • dop3j0e says:

        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 ;)

  9. rtjure says:

  10. Forkboy says:

    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++;
    }
    }

    }

    • dop3j0e says:

      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.

  11. mur1010 says:

    Schön!

  12. madact says:

    I’m surprised Tristan Perich doesn’t get a mention here… granted, this has some smooth voices and he’s gone one up (or, 2 pins down) on 1 bit symphony… still.

    http://www.1bitsymphony.com/ http://www.1bitmusic.com/

  13. Alan says:

    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

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 91,826 other followers