Authors
Publication
Pub Details
Date
Pages
Last month we thought we were finished with the SOUND EFFECTS but we found a method of creating a simulated two-voice BEEP. So we are telling you how to do this effect that works on both the TS2068 and the SPECTRUM without any modification whatsoever.
So here it is:
First you need 2 variables to hold the addresses of the notes (number of the note in a number array) and 4 variables (2 for each voice) to hold the notes and durations.
What we will do is play the two notes at the same time by alternating the note being played. That is we play the first voice for say, 1/100th of a second and then we play the second voice for also 1/100th of a second. This will create the effect of two voices.
Let’s see what the program will look like:
6 LET A=0: LET A1=07 LET B=0: LET B1=0
10 LET V1=50000: LET V2=50250
20 GOSUB 100: GOSUB 200
30 LET A1=A1-1: IF A1=0 THEN GOSUB 100
35 LET B1=B1-1: IF B1=0 THEN GOSUB 200
42 IF A=255 THEN STOP
45 IF A>=254 AND B>=254 THEN PAUSE 1: GOTO 30
50 IF A>=254 THEN LET A=B55 IF B>=254 THEN LET B=A
60 BEEP .015,A-36: BEEP .015,B-36
70 GOTO 30
100 IF A=255 THEN RETURN
110 LET A=PEEK V1: LET A1=PEEK (V1+1): LET V1=V1+2
120 RETURN
200 IF B=255 THEN RETURN
210 LET B=PEEK V2: LET B1=PEEK (V2+1): LET V2=V2+2
220 RETURN
Line 6-20 will initialise the variables and get the first two notes.
Line 30-35 will decrease the counters for the duration of the notes and if a counter is equal to 0 then the computer gets the next note for the appropriate voice.
Line 42 checks if music over
Line 45 checks if both notes are rests and pauses for 1/60th of a second if so.
Line 50 checks if voice 1 is a pause and if so it assigns Variable A with the value of voice 2 so you will hear voice 2 alone
Line 55 same as Line 50 but will assign Variable B the value of voice 1 so you will hear voice 1 alone.
Line 60 plays the notes.
Line 70 completes the loop.
Line 100-220 will get the notes for the appropriate voice.
See it is pretty easy, isn’t it?
You will find this program right after INKEY$ on the cassette.
Also you can make a three voice music using this technique, just add the variables and lines you need and accelerate the tempo (BEEP .008 or faster).You will also find TRI-VOICE on the tape, it an example of 3 voice music.
Well, NOW it’s the last chapter in the series of the SOUND EFFECTS!
See you next month for more tips for the TS2068 and SPECTRUM!
Products
Downloadable Media
Image Gallery
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.