creating sounds on the Commodore 64. You have other tech-p-j niques available that can create some amazing sounds quite
' ' different from what you've heard so far. One such technique is
called additive synthesis.
j—■[ Additive synthesis, although probably a new term to you,
' is really very simple. It takes two sounds, usually produced by
two voices on the 64, and brings them together to form a pi totally new sound. It adds sounds to create a unique synthesis
U7
n
4
Advanced Functions
of the two. Both ring modulation and synchronization on the Commodore 64 are examples of additive synthesis.
Ring modulation. Ring modulation is a form of additive synthesis that significantly changes the tone quality of two sounds. Sounds created with ring modulation don't retain their original pitches. Instead, the sums and remainders of the two frequencies are kept. For example, if the first sound is a tone that vibrates at 500 vibrations per second (vps), and the sec ond tone vibrates at 300 vps, then the ring modulated tone is a combination of the sum (800 vps) and the difference (200 vps). It would be a sound whose tone vibrates at 1000 vps.
Most of the time, ring-modulated sounds are very dif ferent from the original tones. In fact, ring modulation can cre ate some of the most interesting and unusual sounds possible on your computer. To use ring modulation on the 64, you have to set bit 2 of the waveform control register (refer to Fig ure 4-3 for an illustration of one of the three registers), at the same time enabling the triangle waveform. To do this, just add 4 (bit 2's value) to the value you'd normally POKE to turn on the gate bit and enable the triangle waveform. In other words, you'd POKE location 54276 with 21 for voice 1 (1 for the gate bit, 4 for ring modulation, and 16 for the triangle waveform).
Next, you have to select a frequency for voice 3 by POKEing a number into one of the two pitch control registers. That's all you have to do with voice 3; you don't have to set voice 3's waveform, ADSR, or any other parameters.
The effect of ring modulation is most apparent when the tones are mixed as they sweep the scales. You can do this in one of three ways. The first way, shown in Program 4-8, selects a frequency for the triangle waveform and sets the pitch registers to that frequency. Then voice 3's frequency is rapidly changed by sweeping the possible values in the high
pitch control register. i i
Program 4'8* Ring Modulation—Sweeping Voice 3
For mistake-proof program entry, be sure to read "Automatic Proofreader/' Appendix C. I I
5 REM — INITIALIZE SOUND REGISTERS — :rem 0
6 REM :rem 26 . .
10 FOR R=54272 TO 54296:POKER,0:NEXT :rem 24 LJ
11 POKE 54296,15 :rem 45
12 POKE 54277,0:POKE 54278,240 :rem 44
13 POKE 54273,21 :rem 39 M
148
u
n
4
_ Advanced Functions
n
n
n n n n
n
14 REM :rem 73
15 REM ~ TURN ON RING MOD — :rem 244
16 REM :rem 75
17 POKE 54276,21 :rem 46
18 REM :rem 77
19 REM — SWEEP SCALES W/RING MOD — :rem 215
H 20 REM :rem 70
1 ] 30 FOR R=0 TO 255:POKE 54287,R:NEXT :rem 178
40 POKE 54276,16:POKE 54296,0 :rem 253
Line 17 turns the gate bit on, enables the triangle waveform, and selects ring modulation (1 + 16+4=21). The FOR-NEXT loop in line 30 creates values from 0 to 255, which are then POKEd into the high pitch control register of voice 3 (location 54287). The resulting sound is a combination of the sum and difference of the two frequencies produced by voices 1 and 3.
It's considerably different than if you simply played the two voices' pitches together.
The second method of using ring modulation sweeps the scales with the triangle waveform of voice 1 and leaves the frequency of voice 3 at a constant value. Program 4-9 shows this method.
Program 4*9♦ Ring Modulation—Sweeping Voice 1
For mistake-proof program entry, be sure to read "Automatic Proofreader," Appendix C.
5 REM — INITIALIZE SOUND REGISTERS — :rem 0
6 REM :rem 26
10 FOR R=54272 TO 54296:POKER,0:NEXT :rem 24
11 POKE 54296,15 :rem 45
12 POKE 54277,0:POKE 54278,240 :rem 44
13 POKE 54287,21 :rem 44
14 REM :rem 73
15 REM — TURN ON RING MOD.— :rem 244
16 REM :rem 75
17 POKE 54276,21 :rem 46
18 REM :rem 77
19 REM ~ SWEEP SCALES TRIANGLE WAVE — :rem 202
20 REM :rem 70
30 FOR R=0 TO 255:POKE 54273,R:NEXT :rem 173 40 POKE 54276,16:POKE 54296,0 :rem 253 Instead of sweeping the scale for voice 3's pitch value, now you're sweeping the values for voice l's frequency. The
changes in this routine from Program 4-8 are relatively minor;
149
4
Advanced Functions
lines 13 and 30 are the only ones which are different. You can experiment with the ring-modulated sound by using different pitch values in line 13. Change it to 50, for instance, and the sound is even more unusual.
The third method sweeps the scales using both the fre quency of voice 3 and voice 1.
Program 4" 10. Ring Modulation—Sweeping Both Voices
For mistake-proof program entry, be sure to read "Automatic Proofreader," Appendix C.
5 REM — INITIALIZE SOUND REGISTERS — :rera 0
6 REM :rem 26
10 FOR R=54272 TO 54296:POKER,0:NEXT :rem 24
11 POKE 54296,15 :rem 45
12 POKE 54277,0:POKE 54278,240 :rem 44
14 REM :rem 73
15 REM — TURN ON RING MOD — :rem 244
16 REM :rem 75
17 POKE 54276,21 :rem 46
18 REM :rem 77
19 REM — SWEEP BOTH VOICES — :rem 124
20 REM :rem 70
30 FOR R=0 TO 255:POKE 54273,R:POKE 54287,255-R:NE
XT :rem 103
40 POKE 54276,16:POKE 54296,0 :rem 253
Synchronization. Synchronization, another form of ad ditive sound synthesis, also adds two tones together to create a new and different effect. It occurs when two waveforms are linked to make the waveform of voice 1 dependent on whether it is in sync with the frequency of voice 3. Since the two wave forms are usually not in sync, the waveform is distorted. This produces unusual and interesting waveforms. With synchroni
zation in effect, the tone you'll hear depends on the pitch of < ,
voice 3, not of voice 1, as you'd normally find true. If you al- LJ
ter voice 3 and keep voice l's pitch at a constant value, the
pitch changes; however, if you change voice 1, and voice 3's r ,