Classic Computer Magazine Archive COMPUTE! ISSUE 70 / MARCH 1986 / PAGE 96

Experimenting With SID Sound

Mark A, Currie

This versatile program for the Commodore 64 lets you experiment with a wide variety of sound effects and listen to how they sound in a preprogrammed song.

The Commodore 64's SID (Sound Interface Device) chip offers the ability to create a great number of rich, distinctive sounds. But sound programming involves so many different parameters (controlling values) that testing even a few different combinations can consume a lot of time. This program lets you change and experiment with any of the SID parameters quickly and easily. Once you have designed a sound, you can test its actual effect by playing it in a preprogrammed song.

Type in and save a copy of the program before running it for the first time. When you type RUN, the main menu displays 12 choices:

  1. WAVEFORM
  2. PULSE WIDTH
  3. ATTACK/DECAY
  4. SUSTAIN/RELEASE
  5. LOUDNESS
  6. SYNCHRONIZE VI to V3
  7. RING MODULATION
  8. FILTERS
  9. PLAY MUSIC
  10. ZERO VARIABLES
  11. QUIT
  12. LIST OF EFFECTS

The first eight options let you design a sound by changing one or more of the SID chip's parameters. In each case, the computer tells you what range of values is allowed and prevents you from entering illegal values. If you select an option and decide not to change anything, press RETURN without entering any value. Let's look at each option in turn.

Option 1 lets you select one of four different SID waveforms—triangle, sawtooth, pulse, or noise. Each has its own distinctive tone. If you select the pulse waveform you must also set the pulse width to some nonzero value with Option 2. Options 3 and 4 permit you to adjust the ADSR (attack/decay/sustain/ release) envelope of the sound. Each of the four ADSR parameters can be set separately to any number from 0-15.

Attack controls the rate at which the sound rises from zero to full volume. Decay controls the rate at which it falls from the level it reached at the end of the attack cycle to the volume level set by the sustain setting. Sustain sets the volume level the note will maintain from the end of the decay cycle until the note is turned off. And release controls how fast the note fades away after it's turned off. Since all four ADSR settings contribute to the ultimate result, it may take some experimenting to find exactly the envelope you want. Option 5 sets the SID's master volume control, accepting values from 0 (silence) to 15.

As you may know, the SID chip has three separate voices or tone generators. Option 6 permits you to synchronize two of these voices (1 and 3), producing effects which neither voice could produce alone. Note that voice 3's frequency must be set to some nonzero value before synchronization can work. This program lets you set voice 3's frequency to an unchanging value or to values that vary along with voice l's frequency changes. Option 7 selects ring modulation: This effect is generated much like synchronization, but produces quite different effects. Again, you must set voice 3's frequency to a static value or an offset of the frequency for voice 1.

Note that while this program uses only voices 3 and 1 for synchronization and ring modulation, you may use these effects with other voice combinations in your own programs. In this case, voice 3's frequency affects voice 1. With the same techniques, you can affect voice 2 by voice l's frequency, or affect voice 3 by voice 2's frequency. No matter which combination is used, you must supply frequency values for both of the voices involved.

Option 8 controls the filter, allowing you to change six different parameters. You may turn four different types of filters on or off and set the overall cutoff frequency and resonance for the filters. Filtering permits only certain specified frequencies to pass unchanged. Frequencies outside the specified range are much quieter or inaudible. You can choose from four types of filters: low-pass, band-pass, high-pass, and notch-reject. When a filter is on, you can also choose an overall filter resonance value.

Resonance emphasizes frequencies near the cutoff frequency of the filter.

Customized Music

When you select Option 9, the program plays a song using the sound you have designed. Don't be discouraged if the results aren't exactly what you expect at first. Sometimes a minor change in only one or two parameters (particularly those controlling the ADSR envelope) makes a big difference in the ultimate effect.

Option 10 clears all sound parameters to zero to clear the slate for a new sound. Note that the SID chip produces silence when every parameter is zero: The least you must do to produce a sound is turn on a waveform, set the volume to a nonzero level, and define some sort of ADSR envelope. To help you get started, this program begins by choosing maximum volume, a pulse waveform (with pulsewidth of 2048), an attack value of 1, and a decay of 9.

After designing a sound that you like, you may wish to use it in a program of your own. Option 12 generates two lists for that purpose. The first list summarizes the sound parameters currently in effect. The second list includes all the SID control locations and indicates which values to POKE into each register to reproduce the current sound. Although this program makes only one voice audible, you can achieve even more interesting effects by activating more than one voice at a time.