--- title: "Better Programming!" type: "article" slug: "better-programming-7" url: "http://localhost/article/better-programming-7/" markdown_url: "http://localhost/article/better-programming-7.md" published_at: "2026-01-25T21:30:57+00:00" modified_at: "2026-06-21T23:23:00+00:00" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" excerpt: "This month I will talk about the 'REAL ECHO'. This one is a little more complicated than the 'FALSE ECHO' (NOV '86). To create a real echo means playing two notes but one slightly off! To create this effect we'll need a counter. It's quite easy, don't worry! First, you'll have to either put the…" category: - name: "Byte Power" slug: "byte-power" taxonomy: "category" url: "http://localhost/category/periodicals/byte-power/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "Full Text" slug: "fulltext" taxonomy: "post_tag" url: "http://localhost/tag/fulltext/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" - name: "Type-in program" slug: "type-in-program" taxonomy: "post_tag" url: "http://localhost/tag/type-in-program/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" indiv: - name: "Kristian Boisvert" slug: "boisvert-kristian" taxonomy: "indiv" url: "http://localhost/indiv/boisvert-kristian/" publication_r: id: 38570 title: "Byte Power 1st Class Magazine" type: "periodical" url: "http://localhost/periodical/byte-power-1st-class/" authors_r: - name: "Kristian Boisvert" slug: "boisvert-kristian" taxonomy: "indiv" url: "http://localhost/indiv/boisvert-kristian/" issues_articles: - id: 38575 title: "Byte Power Dec 86/Jan 87" type: "issue" url: "http://localhost/issue/byte-power-5/" pubdate: "December 1986/January 1987" archive_link: true article_media: - id: 63228 title: "Duet Example 2" type: "computer_media" url: "http://localhost/computer_media/duet-example-2/" - id: 63227 title: "Real Echo Example" type: "computer_media" url: "http://localhost/computer_media/real-echo-example/" --- # Better Programming! This month I will talk about the ‘REAL ECHO’. This one is a little more complicated than the ‘FALSE ECHO’ (NOV ’86). To create a real echo means playing two notes but one slightly off! To create this effect we’ll need a counter. It’s quite easy, don’t worry! First, you’ll have to either put the codes in a NUMBER ARRAY or in CODES, DATA statements won’t work. If you did it in DATA statements, you would need as much DATA statements as you have notes! Let’s see how it would be done: ``` 5 LET v1=60003: LET v2=60000 10 POKE v2,254: POKE v2+2,1 15 GOSUB 100: GOSUB 200 35 IF a1=255 AND b1=255 THEN STOP 40 LET a4=15: IF a1>=254 THEN LET a4=0 45 LET b4=12: IF b1>=254 THEN LET b1=0 50 SOUND 8,a4; 9,b4; 7,60; 0,a1; 1,a2; 2,b1; 3,b2 55 PAUSE 4 60 LET a3=a3-1: IF a3=0 THEN GOSUB 100 65 LET b3=b3-1: IF b3=0 THEN GOSUB 200 70 GOTO 35 100 LET a1=PEEK v1: LET a2=PEEK (v1+1): LET a3=PEEK (v1+2): LET v1=v1+3 110 IF a1<254 THEN SOUND 8,14 120 RETURN 200 LET b1=PEEK v2: LET b2=PEEK (v2+1): LET b3=PEEK (v2+2): LET v2=v2+3 210 IF b1<254 THEN SOUND 9,11 220 RETURN ``` NOW, let me explain in details: LINE 5:v1 is the address of the MAIN MUSIC and v2 is the address of the ECHO. NOTE: they are 3 bytes apart since the MAIN MUSIC starts first. The ECHO starts with a PAUSE (254, MUSIcomp data) LINE 10:This is to insure that the ECHO starts with a PAUSE (254). The second POKE can be altered (don’t use 0 or it’ll never stop!!!) v2 SHOULD ALWAYS BE 3 BYTES LESS THAN v1! LINE 15:This will get the first notes of MAIN MUSIC and ECHO. LINE 35:If a1 and b1 are both equal to 255 then it means that the music is over. (255 is, again, MUSIcomp data and can be changed for your own data)… a1 and b1 are defined in lines 100 to 200. LINE 40:a4 is the volume of MAIN MUSIC. If the value of a1 equal to a PAUSE (254) or END OF MUSIC (255) then the volume is completely cut off. LINE 45:Same as line 40 but the volume of the ECHO is much lower than the one for MAIN MUSIC. (The echo is never as loud, RIGHT?!?) LINE 50:This will play the notes! INE 55:This is the TEMPO, alter the value to suit your needs. LINE 60:This is the COUNTER! You decrement by one until it equals 0 then you get the next note. LINE 65:Exactly the same as line 60 but for the ECHO. LINE 70:Completes the loop! LINE 100:Get the next note and increment v1 by 3. LINE 110:Lowers the volume between two notes so that you can hear the separation. NOTE: I didn’t put 0 because it wouldn’t be as smooth! LINE 120:Returns from subroutine. LINE 200 to 220 are the same as 100 to 120 except that it is for the ECHO. What the program does is that it will play the note and decrement the counter by one until 0. Then the computer will get the next note to be played. It does this to both ‘voices’ at the same time until the music ends (255). It is the same principle for DUETS or TRIOS! You just have to change the addresses for the beginning of the ‘voices’. Ex:45000 could be voice 1 and 55000 could be voice 2. It would play two different notes of different duration at the same time as opposed to the ECHO which plays the same two notes of both the same duration but the ECHO being slightly off and not as loud! When a DUET or TRIO, what you should do is to put the CODES one after the other. First ‘voice 1’ (the whole data!) and then ‘voice 2’ and then ‘voice 3’ if you have one. You will find on the cassette two programs: the first one is called “REAL ECHO” and the second one “EXAMPLE 2”. The first one will play a music with the ECHO and the second one will play a DUET. To fully understand this technique, I suggest you study carefully these BASIC programs. The CODES were generated using MUSIcomp (NOV’86). Oh! I almost forgot! Try changing the values 15 and 12 in lines 40-45 to 9 and 6. You might like it! Well that’s it for this month! See you next time for CHAPTER 6 OF SOUND EFFECTS! Eric will talk about a 2 voice BEEP using a special routine.’Til then… If you have tips or questions send them to… ## Source Code: Duet Example 2 ``` 1 REM EXAMPLE 2 WRITTEN BY E & K BOISVERT ©1986 BYTE POWER MUSIC EVENING SONG BY R SCHUMANN 9 REM V1=ADDRESS OF VOICE 1 V2=ADDRESS OF VOICE 2 10 LET v1=60000: LET v2=60112 14 REM FIND FIRST NOTES OF VOICE 1 & 2 15 GO SUB 100: GO SUB 200 30 REM 255=END OF MUSIC 254=REST (PAUSE) (MUSIcomp COMPATIBLE DATA) 35 IF a1=255 THEN PAUSE 5: STOP 39 REM A4 & B4 ARE THE VOLUME OF VOICE 1 & 2 40 LET a4=15: IF a1=254 THEN LET a4=0 45 LET b4=15: IF b1=254 THEN LET b4=0 49 REM PLAY NOTES 50 SOUND 8,a4;9,b4;7,60;0,a1;1,a2;2,b1;3,b2 54 REM TEMPO (PAUSE 5) 55 PAUSE 5 59 REM A3 & B3 DURATION OF NOTE IF EQUAL 0 THEN FIND NEXT NOTE 60 LET a3=a3-1: IF a3=0 THEN GO SUB 100 65 LET b3=b3-1: IF b3=0 THEN GO SUB 200 69 REM COMPLETE LOOP 70 GO TO 35 100 REM FIND NOTE OF VOICE 1 AND ADD 3 TO V1 (NEXT NOTE OF VOICE 1) 105 LET a1=PEEK v1: LET a2=PEEK (v1+1): LET a3=PEEK (v1+2): LET v1=v1+3 109 REM LOWER VOLUME TO SEPARATE NOTES (NOT 0 FOR SMOOTHER DELIVERY) 110 SOUND 8,13: RETURN 200 REM FIND NOTE OF VOICE 2 AND ADD 3 TO V2 (NEXT NOTE OF VOICE 2) 205 LET b1=PEEK v2: LET b2=PEEK (v2+1): LET b3=PEEK (v2+2): LET v2=v2+3 209 REM LOWER VOLUME TO SEPARATE NOTES (NOT 0 FOR SMOOTHER DELIVERY) 210 SOUND 9,13: RETURN 8999 REM LOAD CODES FOR MUSIC 2 9000 LOAD ""CODE 6E4: RUN 9999 SAVE "EXAMPLE 2" LINE 9000: SAVE "MUSIC 2"CODE 6E4,224: VERIFY "EXAMPLE 2": VERIFY "MUSIC 2"CODE ``` ## Source Code: Real Echo Example ``` 1 REM REAL ECHO WRITTEN BY E & K BOISVERT ©1986 BYTE POWER TOCCATA BY Leonardo Leo 5 REM V1=ADDRESS OF MAIN MUSIC V2=ADDRESS OF ECHO AT FIRST V2 STARTS AT A PAUSE (DELAY OF ECHO) 6 LET v1=60003: LET v2=60000 9 REM POKE V2,254 FOR THE DELAY (PAUSE) POKE V2+2,1 DURATION OF DELAY 10 POKE V2,254: POKE V2+2,1 14 REM FIND FIRST NOTES OF VOICE 1 & 2 15 GO SUB 100: GO SUB 200 30 REM 255=END OF MUSIC 254=REST (PAUSE) (MUSIcomp COMPATIBLE DATA) 35 IF a1=255 AND B1=255 THEN STOP 39 REM A4 & B4 ARE THE VOLUME OF VOICE 1 & 2 40 LET a4=15: IF a1>=254 THEN LET a4=0 43 REM VOLUME OF VOICE 2 (ECHO) HAS TO BE LOWER TO CREATE EFFECT 45 LET b4=12: IF b1>=254 THEN LET b4=0 49 REM PLAY NOTES 50 SOUND 8,a4;9,b4;7,60;0,a1;1,a2;2,b1;3,b2 54 REM TEMPO (PAUSE 4) 55 PAUSE 4 59 REM A3 & B3 DURATION OF NOTE IF EQUAL 0 THEN FIND NEXT NOTE 60 LET a3=a3-1: IF a3=0 THEN GO SUB 100 65 LET b3=b3-1: IF b3=0 THEN GO SUB 200 69 REM COMPLETE LOOP 70 GO TO 35 100 REM FIND NOTE OF VOICE 1 AND ADD 3 TO V1 (NEXT NOTE OF VOICE 1) 105 LET a1=PEEK v1: LET a2=PEEK (v1+1): LET a3=PEEK (v1+2): LET v1=v1+3 109 REM LOWER VOLUME (IF NOT PAUSE OR END) TO SEPARATE NOTES (NOT 0 FOR SMOOTHER DELIVERY) 110 IF A1<254 THEN SOUND 8,14 120 RETURN 200 REM FIND NOTE OF VOICE 2 AND ADD 3 TO V2 (NEXT NOTE OF VOICE 2) 205 LET b1=PEEK v2: LET b2=PEEK (v2+1): LET b3=PEEK (v2+2): LET v2=v2+3 209 REM LOWER VOLUME (IF NOT PAUSE OR END) TO SEPARATE NOTES (NOT 0 FOR SMOOTHER DELIVERY) 210 IF B1<254 THEN SOUND 9,11 220 RETURN 8999 REM LOAD CODES FOR MUSIC 9000 LOAD ""CODE 60003: RUN 9999 SAVE "REAL ECHO" LINE 9000: SAVE "MUSIC"CODE 60003,895: VERIFY "REAL ECHO": VERIFY "MUSIC"CODE ```