- The Noiseplug
- An ATtiny9 microcontroller that plays a chiptune.
- Because 32 bytes of RAM should be enough for everyone.
- There are two versions of the noiseplug program here:
- win/ A win32/C version that I used to prototype the chiptune and the audio generation
- avr/ The avr/asm version that makes up the ATtiny9 firmware
- Whenever I decided to change the algorithms to make them easier or smaller to code in asm, I first prototyped the change in the win32/C version to see if it would work. Thus, the C and asm versions are very much in sync with each other, so you can hold them side by side while you try and understand the uncommented gibberish I wrote ;)
- Also, I made a humongous amount of small commits so whenever something broke, I could go back to a known working state. It might be very interesting to check out the progression of changes, especially during the hot assembler coding phase at the hotel room between 11am and 6pm on Saturday.
- You will also see that during that last phase, for example, when I had the bass down pat, I put some more asm-related thought into the arpeggio part of the C prototype before implementing the arpeggio in asm. That way, I could then just write down the asm code line by line and it would work more or less on the first shot. I heartily recommend this approach to everyone going on a similar endeavour.
- If you want to try it on real hardware, just wire up pin 1 of an ATtiny9 (an ATtiny10 should also work) to the signal pin of an audio plug and connect the grounds together. The audio signal is generated by PWMing the supply voltage, so be sure your playback device can take 3V, or 5V if you power the uC from USB.
- Have fun with the source -- I had fun (well, most of the time ;) creating it!