Ad: Click Here

Mapping the Atari cover

APPENDIX SIX

Sound And Music

Sound on the Atari can be quite sophisticated or quite simple, depending on your needs and programming abilities. Simple sounds may be input using the SOUND command; you enter the voice (zero to three), the pitch (zero to 255), the distortion (even numbers from zero to fourteen) and the volume (one to fifteen) in this manner: SOUND 0,121,10,8 This will give you a pure tone middle C, moderate volume. The SOUND command is only one way to adjust your music or sound in the Atari. You can also POKE directly into the POKEY registers to effect changes. For example, you can increase the normal five octave range to nine by setting the proper bits in location 53768. This method reduces the number of voices to two or three, but does give you quite a range. You can use all sorts of tricks with filters, clock channels, and poly counters, as described in the POKEY locations. For the best description of sound control technique, see De Re Atari. Here are the pitch values for the major notes when used with a pure tone in the sound command: Note Octave 1 2 3 4 5 C 14 29 60 121* 243 B 15 31 64 128 255 A# or Bb 16 33 68 136 A 17 35 72 144 G# or Ab 18 37 76 153 G 19 40 81 162 F# or Gb 21 42 85 173 F 22 45 91 182 E 23 47 96 193 D# or Eb 24 50 102 204 D 26 53 108 217 C# or Db 27 57 114 230 You can see that the intervals between notes increase as the pitch decreases (the larger the number, the lower the pitch). Middle C is marked with "*". Here's a simple routine to test pitch and distortion with one voice: 5 PRINT CHR$(125): POKE 752,2 10 A = 0: B = O: C = 0 20 SOUND 0,A,B,C: POSITION 0,0 30 PRINT "PITCH", "DISTORTION", "VO LUME" 35 POSITION 0,2: PRINT A, B;" ",, C;" " 40 IF STICK(0) = 14 THEN A = A + 1: IF A > 255 THEN A = 0: GOTO 20 50 IF STICK(0) = 13 THEN A = A - 1: IF A < 0 THEN A = 255: GOTO 20 60 IF STICK(0) = 7 THEN B = B + 2: IF B > 14 THEN B = 0: GOTO 20 70 IF STICK(0) = 11 THEN B = B - 2: IF B < 0 THEN B = 14: GOTO 20 80 IF STRIG(0) = 0 THEN C = C + 1: IF C > 15 THEN C = 0: GOTO 20 90 GOTO 20 DOWNLOAD PITCH.BAS You move the stick up or down to change pitch, right or left to change the distortion level. Press the trigger to change the volume level. See Softside, #30 for a similar program using all four voices and Santa Cruz's Tricky Tutorial #6 (sound). You should also examine Atari's Music Composer cartridge; it is not only a fine program, but it also has excellent documentation on music, sound, and composition. There are two excellent programs from APX, Sound Editor and Insomnia, both of which allow you to create sounds to include in your programs (not tunes however). Insomnia is particularly interesting in that it creates sound which is played during the VBLANK intervals.

Return to Table of Contents | Previous Chapter | Next Chapter