Friday, February 18, 2005

I'm 37....I'm not old!

Happy Birthday to me! I've been waiting for about 6 months to use that line (from "Monty Python and the Holy Grail" , a fine flick if you like that sort of thing)

I haven't switched to a new blog yet, since I've been sidetracked by the idea of using some kind of wiki/blog combination. The blog will remain here until I make up my mind.

Tuesday, February 15, 2005

Square-wave aliasing

So, I spent a bit of time addressing this problem.

Thank for the comments! First, I did notice that certain frequencies are more problematic than others. Higher frequencies tend to have stronger harmonics which fold over. However, if you have a tone that divides evenly into (sampling_rate/2), the folded harmonics land on top of the non-folded ones, so it sounds ok. Still, it's not right, but it sounds ok. I also know that I could process things at a higher sampling rate internally, and post filter it.

What was bothering me was this - in the "synthesis" problem, I know _everything_ about the waveform I'm trying to generate. So, it seems that using that information from N previous samples, I should be able to come up with a "optimal" solution in some sense.

As it turns out, one approach is to apply a window filter to the previous bit or bits, before generating the samples. The simplest thing is to use a one-bit-long rectangular filter. This is easy - and definitely sounds better than doing nothing. But it doesn't do a very good job as a low pass filter. For one thing, the cutoff frequency is fs, not fs/2 - but it does roll off well before that. Some of the other modules in the discrete sound system do this already as well.

Finally, I experimented a bit using a low-pass filter based on a Kaiser window. This gives great results, but you really need to use at least a few more of the previous sample bits to get decent results. 10 or so is darned near perfect.

Anyways, I'll probably look at some other approaches, including optimal low-pass filter designs, but in the end I'm not sure it's worth doing much more than a rectangular window.

A fine excuse to learn more signal processing, anyways!

Blockade.c sound again

MAME 0.92 has my simple code for doing the square wave sound. I was hoping to do some sampling of the noise-generator circuit this weekend. However, I made a stupid mistake and ended up messing up my Comotion and Minesweeper boards. :( Nothing serious, but I need to order some parts to get that part of the circuit working again.

You can hear the aliasing distortion that I was talking about in Minesweeper, since it generates high-pitched tones. I'm still working on that, since it's turned into a fun math exercise..worthy of a seperate post...

Sunday, February 06, 2005

Blockade.c sound, new blog in the works

Well, I've got partial sound working in blockade.c. Definitely better than silence!

I'm trying to come up with some simple way to deal with the aliasing distortion you get from generating high-frequency square waves the "simple way". This is really apparent in Minesweeper.

For the mathematically inclined, the problem is described and completely solved by the approach in this paper:

However, it's a pretty heavy-duty approach - probably too unwieldy for MAME.

I'm also getting ready to move to a blog based on Movable Type. I really want "categories", so that I can blog about anything and not alienate the people only interested in MAME. :) I grabbed and I hope to set up shop there within a week or so. I'm going to move my content there as well.

Tuesday, February 01, 2005

Amutech Minesweeper Cocktail/Standaround

Well, I got a PCB from eBay. As suspected, it is an exact clone of the Gremlin blockade hardware, except for the connectors. The program roms are the same as our existing set, but the graphics are slightly different. (The scores can be displayed in four different directions).

So, it turns out that fixing the port settings in drivers/blockade.c enables 4 player mode. I did this, along with some general cleanup. I'll submit the updated driver soon, but I'd like to try and add some sound first.

Now if only a 4-player blasto would show up...

I'm on the blog bus now too. Hi Tim!

Fun with FPGAs - recreating the Atari TIA, Part 1

I have been playing with recreating the Atari TIA chip as used in the original 2600 in an FPGA.  I know this has been done a few times alrea...