Here is my first attempt at JAVA code, it works with Sun's Java tester application, but the output seems to stutter sometimes when printing the output to the screen using the Netscape Navigator 3.0. If the output is incomplete, just hit run again. Enjoy and let me know what you think.

There are two choices for attenuator slope. The fixed slope takes the total attenuation, and divides it by the number of steps (minus one), and then rounds it to the nearest twentieth of a dB. The second choice is my favorite way to construct a stepped attenuator, it uses three different logarithmic slopes. The first 60% of the attenuator uses a shallow slope, then the next 25% uses a slope twice as steep, then the final 15% uses a slope three times as steep. The advantage of this design is that you have coarse steps at the bottom of the attenuator where there isn't a need for small steps (the music is very quiet). With the attenuator in the middle range, the steps are much more fine, so there is more control over the level of the music. So the attenuator has fine steps in the frequently used range, but still attenuates quite a bit when needed. It's essentially optimizing the steps available.