September 1, 2007 1:1 am - NON, tech
Development log: Rambling about chiptunes
Not many updates lately, thanks to lots of work and little time to write.
Plus, I've been dusting off an old game project that I mean to finish this time. It's that clone of Heiankyo Alien I've talked about on the site before. I could take a screenshot, but I'm not quite comfortable with the graphics yet. I'm aiming to build all parts of the game myself - design, code, graphics, music, sound effects. Which is tricky for me, because I'm pretty much a straight-up developer. I don't have much experience with art or music composition (despite having spent years playing the violin and viola).
So, today I want to talk about music.
I thought about using the NES's 2A03 sound chip for my synthesis, but I think the sound is too recognizable and too limited in certain ways for my project. If I use that, it will sound like a NES game. There's really no way around it. My game doesn't look like a NES game; the number of colors and the resolution would place it on a level of technology closer to an arcade or PC Engine game. The benefit is that I'd only be working with two square waves, a triangle wave, a noise channel, and PCM samples if I decided to use them.
I wanted a sound that was less common, more interesting, more distinct than that. Modern NES composition tools support a lot of the add-on sound hardware that was found in some Famicom cartridges - and the Famicom Disk System. Some of these allow the composer to use custom waveforms to build interesting and new sounds - and cater specifically to a style of music. The trouble was, coming into this, I knew next to nothing about waveforms or volume envelopes. I started playing around with tools like Pxtone's voice editor and Mumem, and listening to lots and lots of NSFs. Eventually, after just messing around with envelopes and playing around with waveforms in real time (Pxtone's voice editor is GREAT for that), I think I'm getting the idea. I still don't know that much, but I'm getting the idea of how a waveform and a volume envelope combine to approximate an instrument (or a hi-hat, or gunfire, or whatever). Don't ask me to explain real FM synthesis.
I got it in my head that I'd try using the Namco 106 sound expansion chip, since it sounds very similar to the PC Engine's PSG sound chip. But after I ran into technical limitations in modern composition tools, I decided to give the actual PC Engine's sound chip a shot. The PC Engine/TG-16's PSG has six sound channels that support a custom waveform. They can play tones, noise, or PCM samples. It supports more samples per waveform and better sample resolution than the Namco 106 expansion, too, for nicer and smoother synthesis. You can still make it sound like a NES if you want, too, by just setting up channels with square and triangle waveforms. But the versatility and distinct sounds possible are what I'm going for here.
MML/MCK (Music Macro Language) has become a popular way to compose NES music. You use assembly language-like commands to set up your sound channels and then type out music that looks like this: c d e f8 g8 a2. There's a bunch of syntax that allows you to use music-like notation, which is good for me, since I still have some of that music theory rattling around in my head. Plus, its resemblance to a programming language rings familiar in other ways for me. Some people prefer to use tools called trackers for chiptune composition, but the way they work is too far divorced from both sheet music and programming language code (at least as far as I can tell) that I don't like them too much. With MML, I'm at home.
I got HuSIC, the PC Engine adaptation of the ppmck MML compiler package, running on my Mac, finally. A cool guy named boukichi has done some awesome work in bringing these tools to OS X - including an IDE of sorts for MML composition. It comes prepackaged with ppmck out of the box for making NES music, but you can add configurations to make it work with other flavors of MML - like HuSIC. So, in this very speedy and friendly environment, I banged out a test tune today. It's part of the town music from the first Ys game. (Download: mp3, HES with source [play on your HES player of choice]) It's just the basics: three instruments with separate waveforms/volume envelopes, and simple noise-channel drums. This isn't composition, but I'll need to get comfy with the tools before the creative juices flow, so this is my first big step.
I'm liking the idea of making devlog entries like this, so watch for more in the future.

Yeah, it was an interesting read. I like the idea of you having complete creative control and doing everything by yourself. I would like to do a game like that too, but I'm not sure I could ever produce something that sounds close to music.