Classic Computer Magazine Archive COMPUTE! ISSUE 52 / SEPTEMBER 1984 / PAGE 146

SYSound

Mike Steed

The Commodore 64 has an amazing sound chip, and anyone who has heard it knows this. However, anyone who has tried to program it may have been surprised or discouraged, because everything had to be done with POKEs. That is, until now. "SYSound" will make creating sounds much easier, using absolutely no POKEs at all. Also included is an example program to show how easy programming 64 music can be.

Type in Program 1 and be sure to save a copy before running it. Program 1 loads in SYSound, which is a machine language program, and one typing mistake can crash SYSound when you use it. You may wish to save a copy of just the machine language once it's loaded, if you have a machine language monitor. Program 1 will specify the start and end addresses.

To use SYSound, all you need to do is type SYS 49152 followed by any of several possible parameters, each separated by a comma. The number 49152 could (and probably should) be put into a variable, such as S or SOUND.

A list of possible parameters for the SYS statement and their meanings follows:

10 S = 54272 : FOR I = 0 TO 24 : POKE S + I, 0 : NEXT

Once a parameter has been entered, it need not be entered the next time the routine is used. For example, if all your sound effects are going to be done with voice 1, at volume 15, with the sawtooth waveform, attack 0, decay 9, and sustain and release 0, you could set all these at the beginning of your program:

10 S = 49152 : SYS S, C, V1, L15, WS, D9

(All parameters default to zero initially, so A, S, and R needn't be entered.) Then all that would need to be done to play a note would be:

20 SYS S, F5000

(Any valid numeric expression may be used after the parameter letter.) Also, if a parameter is entered more than once, only the last case will be considered. For example, SYS S, WS, WT, A0, A6 is effectively the same as SYS S, WT, A6.

Program 2 provides an example of SYSound in action, and 'shows how much simpler music programming can be accomplished.