Calculates coarse and fine tuning values for eight octaves of the equally tempered scale on the TS2068’s AY sound chip, plays the 96 notes with a table of their values, and can save the two arrays for use in music programs.
RUN it and wait a few seconds. When it stops, GO TO 9999 saves the arrays as PSG_ets (coarse, v) and PSG_ets#2 (fine, u). Element 37 is middle C.
Published in LISTing March 1986 (Sound: Exploring the PSG). The issue’s contents page credits the program to Peter Ross.
Source Code
1 PAPER 6: INK 0: BORDER 6: BRIGHT 0: FLASH 0: CLS : DIM v(96): DIM u(96): LET z=-40: DIM n(96)
10 LET x=1764000/16
20 LET b=27.5: LET s=2↑(1/12)
30 FOR i=3 TO 98
40 LET a=(b*s↑i)
70 LET a=x/a: LET c=INT (a/256)
80 LET f=INT (a-(c*256)+.5)
90 LET a=x/(c*256+f)
95 LET z=z+1: LET n(i-2)=z: LET u(i-2)=f: LET v(i-2)=c
100 PRINT AT 0,5;"EQUALLY TEMPERED SCALE";AT 11,11; INK 2; BRIGHT 1; FLASH 1;"PLEASE WAIT": NEXT i
105 RESTORE : LET Z=1: CLS : PRINT AT 0,0; BRIGHT 1; PAPER 7;" OCTVE NOTE FINE CRSE VAL#": LET L=0: FOR f=1 TO 96: LET L=L+1: FOR n=15 TO 0 STEP -2: SOUND 8,n;9,n;10,n: NEXT n: PAUSE 5: SOUND 8,15;9,15;10,15;7,56;2,u(f);3,v(f);4,u(f);5,v(f);1,v(f);0,u(f)
110 IF L>12 THEN LET Z=Z+1: LET L=1: RESTORE 180
115 READ N$: PRINT AT 1,3;" ";AT 1,3;Z;AT 1,9;" ";AT 1,9;N$;AT 1,15;" ";AT 1,15;U(F);AT 1,22;" ";AT 1,22;V(F);AT 1,28;" ";AT 1,28;F
120 PAUSE 5: NEXT F
180 DATA "C","C#","D","D#","E","F","F#","G","G#","A","A#","B"
199 PAPER 6: INK 0: BORDER 6: CLS : PRINT AT 2,1;"This program sets up two arraysto hold the coarse and fine tune values for the equally tempered scale."'"Array-u holds the value for the fine tune register."'"Array-v holds values for coarse tune reg."''
200 PRINT " The complete 8-octave range is set. This will allow the pro-grammer to easily create music programs in a similer fashion to using the British BEEP but with the sophistication of our PSG."
201 PRINT '" Simply GOTO 9999 to save the arrays";AT 20,0; BRIGHT 1; INK 4;"PSG ARRAY VAL OF 37=mid C = BEEP VAL OF 0"
300 STOP
9999 SAVE "PSG_ets" DATA v(): SAVE "PSG_ets#2" DATA u()Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.


