Help Multiplexius become a real-world plushie!

We only have until September 26.

Music downloads
Scene productions
Chip music
Hardware projects

Power Ninja Action Challenge

Here's another ATmega88-based hardware chiptune, this time composed for Little Computer People 2009. It was my contribution to the "other music" compo, and won the 1st place.

Link love to virt whose incredible chip tunes never cease to amaze and inspire.

The microcontroller runs at 8 MHz and emits a 44.1 kHz mono signal. This means that each new sample has to be generated in at most 181 clock cycles, which is tight but quite possible. As you can hear, there's enough processing power for five channels (triangle, two pulses, noise and DPCM samples, just like on the NES).

The binary image occupies 5480 bytes of flash. Output appears on PORTD, where you simply attach an R-2R ladder and a DC-blocking capacitor.

Posted Sunday 19-Jul-2009 17:47

Discuss this page

Disclaimer: I am not responsible for what people (other than myself) write in the forums. Please report any abuse, such as insults, slander, spam and illegal material, and I will take appropriate actions. Don't feed the trolls.

Jag tar inget ansvar för det som skrivs i forumet, förutom mina egna inlägg. Vänligen rapportera alla inlägg som bryter mot reglerna, så ska jag se vad jag kan göra. Som regelbrott räknas till exempel förolämpningar, förtal, spam och olagligt material. Mata inte trålarna.

Anonymous
Tue 18-Aug-2009 23:13
Hello Linus,
Are you planning to release your source code (even without music)?

8 more comments hidden. Click to show all.

lft
Linus Åkesson
Thu 18-Mar-2010 20:35

lft wrote:

This means we get a nasty carrier wave at about 31 kHz (with lots of overtones), which has to be filtered out. But the audio is generated at 44100 samples per second, so frequencies up to about 22 kHz should be left alone by the filter. Such a steep low-pass filter (almost no attenuation at 22 kHz, almost complete attenuation at 31 kHz) can't be realized with passive components.

But 31 kHz isn't audiable by human ears, is it? :)

Correct. But it would still interfere with the other sound. Suppose you play two sine waves through a loudspeaker, one at 31 kHz and one at 5 kHz. You would hear it as a single sine wave at 18 kHz, which would beat (grow stronger and fainter) at 26 kHz (which wouldn't sound like beating but rather like a timbral change, since it's such a high frequency... but you get the point). Furthermore, if you had a 31 kHz wave present in a signal, and that signal were sampled at 44 kHz because you routed the audio into a digital soundcard, then the 31 kHz would get reflected at the Nyquist frequency and appear as 9 kHz in the recorded audio. While a soundcard would filter its input, the filtering would be inaccurate for the same reason I gave above; it's difficult to filter out 31 kHz completely and retain 22 kHz unattenuated.
kingofthespill
Sun 25-Jul-2010 00:23
Very cool! BTW I love your website, many excellent projects.

I was wondering if you did anything special to keep the noise low. I think the audio is significantly clearer than on some of your other projects, like the "Swan".

I've experimented with sound using several different AVRs PWM, R2R, and an 8-bit DAC and have found it difficult to get beyond telephone quality. I noticed they all generate noise on the power line, and the distortion varies a little from chip to chip. For what it's worth the Attiny45 does have high frequency PWM via an internal PLL, but it makes a distorted square wave (to my ears at least).
Anonymous
Tue 17-Jan-2012 00:58
Hello Linus,
Your work is very impressive *and* inspiring!
I'm trying to reproduce your work, but without copying your code. I want to "reinvent the wheel" and learn some stuff along the way :D I understand the physics of sound, but I'm no musician! My first implementation on an AT90S2313 @ 8MHz (I know it's old but I like challenges --just like you do ;) has two pulse waves, a 4bit triangle and noise. I guess this sounds good for a first attempt, but the sound is... "flat" and boring. I thought of implementing some simple effects (vibrato and pitch bend), but when I did, the sound become noisy! My code is too slow...

Does your code apply a certain effect on each channel, or I'ts capable of changing the effects from note to note?

Is your code capable of playing music on all channels simultaneously?

I hope my questions are making sense and I thank you in advance for any answer (and your time of course)!

Panagiotis :)
Anonymous
Fri 13-Feb-2015 00:29

lft wrote:

Thanks! Yes, I compose the music as well.
Impressive.