Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_54.ADF » V/+SYNCH1
V/+SYNCH1
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_54.ADF |
Filename: | V/+SYNCH1 |
Read OK: | ✔ |
File size: | 11E1 bytes |
Load address: | 56204556 |
Exec address: | 59532B2E |
Duplicates
There are 3 duplicate copies of this file in the archive:
- AEW website » eug » eug_3_5_discs_Eug-54_A-EUG54.adf » V/+SYNCH1
- AEW website » eug » eug_5_25_discs_Eug-54_D-EUG54.dsd » V.+SYNCH1
- Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_54.ADF » V/+SYNCH1
- Personal collection » Acorn ADFS disks » Greaseweazled » adfs_EUG_54.adf » V/+SYNCH1
File contents
SYNCHRONISING WORDS AND MUSIC By Brian Boyde-Shaw THE Electron's ability to play music whilst it is performing other actions is very useful, but it can make it difficult to synchronise the music with the appearance of words on the screen. Brian Boyde-Shaw gives the low down on putting words to your music. Note that the demonstration programs are stored in the U directory in the file "RHYME". TRYING to print out the words of a song while it plays through your Electron's speaker is no easy task. Because of the way in which sound commands are handled by the Electron, there is a tendency for the words and the music to become totally separated. In the program in this article the sound is broken down into single notes, and combined with text - words or part words - so that the text is being written on the screen at the same time as you hear the corres- ponding note. The aim of the program is to play a simple nursery rhyme, one note at at a time as the words are displayed on the screen. The nursery rhyme we have chosen here is 'One, two, three, four, five'. The methods used, however, can easily be adapted to any musical piece. Let's first look at a procedure to carry out this routine. As there are twenty four notes in the rhyme, we can conveniently read in the word or part word, the pitch of the note and the note's duration, from DATA statements. 4000DATA one,88,8,two,88,8,three,80,4,four,72,4,five,72,8 4010DATA once,80,4,I,88,4,caught,92,4,a,100,4,fish,100,4,a,92,4,li ve,92,8 4020DATA six,92,8,seven,92,8,eight,88,4,nine,80,4,ten,80,8 4030DATA then,72,4,I,68,4,let,60,4,it,68,4,go,80,4,a,72,4,gain,72, 8 We can then print the word in the centre of the screen, play the note, and clear the screen. Then do it all again until we reach the end of the rhyme. 1000DEF PROCwords 1010FOR R=1 TO 24 1020READ WORD$,PITCH,DUR 1030PRINT TAB(15,15)WORD$ 1040SOUND 1,-15,PITCH,DUR 1050T%=TIME:REPEATUNTIL TIME>T%+5*DUR 1060CLS 1070NEXT R 1080ENDPROC This procedure is designed to work in Mode 4, but could be adapted for any other mode, providing that the parameters of the TAB statement (line 1030) are adjusted according to the appropriate line width. Line 1050 will need some explanation. We need a delay loop to display the word on the screen for the time that the note sounds. If we allowed the program to continue without this delay loop, the screen would clear, then the next word would be printed, and so on, and so on, until all the words had been displayed, but the music would have hardly started. On the Electron, sounds are placed in a queue ready for processing. This takes up very little of the computer's time. Drawing and printing onto the screen, however, does take a while, so the two can get out of step. You can try this procedure without this line to see (and hear) this effect. We must delay the printing of the 'next' word until the note has finished playing, and line 1050 does this. As the duration of the note (DUR from the data statements) is in twentieths of a second - for the SOUND statement - this delay must be converted to the units of hundredth of a second - the units of TIME. Line 1050 makes the conversion and de- lays the next word from appearing on the screen. For the first note, for example, the SOUND statement requires, a duration value of 8. The delay loop, however, requires a value of 40 hundredth of a second. Line 1050 makes the conversion with the formula: DELAY=DUR*5 You could, of course, put both timing codes separately into the data statements, but this would mean more effort typing in the music, and be wasteful of memory into the bargain. We now have a simple procedure to show how words and music can be connected, but there are other more exciting ways of doing this. We can allow the text to build up on the screen, word by word, until the com- plete verse is displayed. The same data statements can't be used because we need punctuation on the screen now that we are to have the whole verse visible at once. When we include punctuation in data we have to wrap the data in inverted commas. Another snag is that we have to provide some means of telling the computer to start a new line for each line of the verse and that "alive" and "again" are two notes each but only one word. We need to introduce a coding system into our data. This article continued in the file V.+SYNCH2. First published ELBUG 2.1. Reproduced EUG #54.
00000000 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000010 20 20 20 20 53 59 4e 43 48 52 4f 4e 49 53 49 4e | SYNCHRONISIN| 00000020 47 20 57 4f 52 44 53 20 41 4e 44 20 4d 55 53 49 |G WORDS AND MUSI| 00000030 43 0d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |C. | 00000040 20 20 20 20 20 20 20 20 20 20 20 42 79 20 42 72 | By Br| 00000050 69 61 6e 20 42 6f 79 64 65 2d 53 68 61 77 0d 0d |ian Boyde-Shaw..| 00000060 54 48 45 20 45 6c 65 63 74 72 6f 6e 27 73 20 61 |THE Electron's a| 00000070 62 69 6c 69 74 79 20 74 6f 20 70 6c 61 79 20 6d |bility to play m| 00000080 75 73 69 63 20 77 68 69 6c 73 74 20 69 74 20 69 |usic whilst it i| 00000090 73 20 70 65 72 66 6f 72 6d 69 6e 67 20 6f 74 68 |s performing oth| 000000a0 65 72 20 0d 61 63 74 69 6f 6e 73 20 69 73 20 76 |er .actions is v| 000000b0 65 72 79 20 75 73 65 66 75 6c 2c 20 62 75 74 20 |ery useful, but | 000000c0 69 74 20 63 61 6e 20 6d 61 6b 65 20 69 74 20 64 |it can make it d| 000000d0 69 66 66 69 63 75 6c 74 20 74 6f 20 73 79 6e 63 |ifficult to sync| 000000e0 68 72 6f 6e 69 73 65 20 74 68 65 0d 6d 75 73 69 |hronise the.musi| 000000f0 63 20 77 69 74 68 20 74 68 65 20 61 70 70 65 61 |c with the appea| 00000100 72 61 6e 63 65 20 6f 66 20 77 6f 72 64 73 20 6f |rance of words o| 00000110 6e 20 74 68 65 20 73 63 72 65 65 6e 2e 20 42 72 |n the screen. Br| 00000120 69 61 6e 20 42 6f 79 64 65 2d 53 68 61 77 20 67 |ian Boyde-Shaw g| 00000130 69 76 65 73 0d 74 68 65 20 6c 6f 77 20 64 6f 77 |ives.the low dow| 00000140 6e 20 6f 6e 20 70 75 74 74 69 6e 67 20 77 6f 72 |n on putting wor| 00000150 64 73 20 74 6f 20 79 6f 75 72 20 6d 75 73 69 63 |ds to your music| 00000160 2e 20 4e 6f 74 65 20 74 68 61 74 20 74 68 65 20 |. Note that the | 00000170 64 65 6d 6f 6e 73 74 72 61 74 69 6f 6e 0d 70 72 |demonstration.pr| 00000180 6f 67 72 61 6d 73 20 61 72 65 20 73 74 6f 72 65 |ograms are store| 00000190 64 20 69 6e 20 74 68 65 20 55 20 64 69 72 65 63 |d in the U direc| 000001a0 74 6f 72 79 20 69 6e 20 74 68 65 20 66 69 6c 65 |tory in the file| 000001b0 20 22 52 48 59 4d 45 22 2e 0d 0d 54 52 59 49 4e | "RHYME"...TRYIN| 000001c0 47 20 74 6f 20 70 72 69 6e 74 20 6f 75 74 20 74 |G to print out t| 000001d0 68 65 20 77 6f 72 64 73 20 6f 66 20 61 20 73 6f |he words of a so| 000001e0 6e 67 20 77 68 69 6c 65 20 69 74 20 70 6c 61 79 |ng while it play| 000001f0 73 20 74 68 72 6f 75 67 68 20 79 6f 75 72 0d 45 |s through your.E| 00000200 6c 65 63 74 72 6f 6e 27 73 20 73 70 65 61 6b 65 |lectron's speake| 00000210 72 20 69 73 20 6e 6f 20 65 61 73 79 20 74 61 73 |r is no easy tas| 00000220 6b 2e 20 42 65 63 61 75 73 65 20 6f 66 20 74 68 |k. Because of th| 00000230 65 20 77 61 79 20 69 6e 20 77 68 69 63 68 20 73 |e way in which s| 00000240 6f 75 6e 64 0d 63 6f 6d 6d 61 6e 64 73 20 61 72 |ound.commands ar| 00000250 65 20 68 61 6e 64 6c 65 64 20 62 79 20 74 68 65 |e handled by the| 00000260 20 45 6c 65 63 74 72 6f 6e 2c 20 74 68 65 72 65 | Electron, there| 00000270 20 69 73 20 61 20 74 65 6e 64 65 6e 63 79 20 66 | is a tendency f| 00000280 6f 72 20 74 68 65 20 77 6f 72 64 73 0d 61 6e 64 |or the words.and| 00000290 20 74 68 65 20 6d 75 73 69 63 20 74 6f 20 62 65 | the music to be| 000002a0 63 6f 6d 65 20 74 6f 74 61 6c 6c 79 20 73 65 70 |come totally sep| 000002b0 61 72 61 74 65 64 2e 0d 20 20 20 49 6e 20 74 68 |arated.. In th| 000002c0 65 20 70 72 6f 67 72 61 6d 20 69 6e 20 74 68 69 |e program in thi| 000002d0 73 20 61 72 74 69 63 6c 65 20 74 68 65 20 73 6f |s article the so| 000002e0 75 6e 64 20 69 73 20 62 72 6f 6b 65 6e 20 64 6f |und is broken do| 000002f0 77 6e 20 69 6e 74 6f 20 73 69 6e 67 6c 65 0d 6e |wn into single.n| 00000300 6f 74 65 73 2c 20 61 6e 64 20 63 6f 6d 62 69 6e |otes, and combin| 00000310 65 64 20 77 69 74 68 20 74 65 78 74 20 2d 20 77 |ed with text - w| 00000320 6f 72 64 73 20 6f 72 20 70 61 72 74 20 77 6f 72 |ords or part wor| 00000330 64 73 20 2d 20 73 6f 20 74 68 61 74 20 74 68 65 |ds - so that the| 00000340 20 74 65 78 74 0d 69 73 20 62 65 69 6e 67 20 77 | text.is being w| 00000350 72 69 74 74 65 6e 20 6f 6e 20 74 68 65 20 73 63 |ritten on the sc| 00000360 72 65 65 6e 20 61 74 20 74 68 65 20 73 61 6d 65 |reen at the same| 00000370 20 74 69 6d 65 20 61 73 20 79 6f 75 20 68 65 61 | time as you hea| 00000380 72 20 74 68 65 20 63 6f 72 72 65 73 2d 0d 70 6f |r the corres-.po| 00000390 6e 64 69 6e 67 20 6e 6f 74 65 2e 0d 20 20 20 54 |nding note.. T| 000003a0 68 65 20 61 69 6d 20 6f 66 20 74 68 65 20 70 72 |he aim of the pr| 000003b0 6f 67 72 61 6d 20 69 73 20 74 6f 20 70 6c 61 79 |ogram is to play| 000003c0 20 61 20 73 69 6d 70 6c 65 20 6e 75 72 73 65 72 | a simple nurser| 000003d0 79 20 72 68 79 6d 65 2c 20 6f 6e 65 20 6e 6f 74 |y rhyme, one not| 000003e0 65 20 61 74 0d 61 74 20 61 20 74 69 6d 65 20 61 |e at.at a time a| 000003f0 73 20 74 68 65 20 77 6f 72 64 73 20 61 72 65 20 |s the words are | 00000400 64 69 73 70 6c 61 79 65 64 20 6f 6e 20 74 68 65 |displayed on the| 00000410 20 73 63 72 65 65 6e 2e 0d 20 20 20 54 68 65 20 | screen.. The | 00000420 6e 75 72 73 65 72 79 20 72 68 79 6d 65 20 77 65 |nursery rhyme we| 00000430 20 68 61 76 65 20 63 68 6f 73 65 6e 20 68 65 72 | have chosen her| 00000440 65 20 69 73 20 27 4f 6e 65 2c 20 74 77 6f 2c 20 |e is 'One, two, | 00000450 74 68 72 65 65 2c 20 66 6f 75 72 2c 20 0d 66 69 |three, four, .fi| 00000460 76 65 27 2e 20 54 68 65 20 6d 65 74 68 6f 64 73 |ve'. The methods| 00000470 20 75 73 65 64 2c 20 68 6f 77 65 76 65 72 2c 20 | used, however, | 00000480 63 61 6e 20 65 61 73 69 6c 79 20 62 65 20 61 64 |can easily be ad| 00000490 61 70 74 65 64 20 74 6f 20 61 6e 79 20 6d 75 73 |apted to any mus| 000004a0 69 63 61 6c 0d 70 69 65 63 65 2e 0d 20 20 20 4c |ical.piece.. L| 000004b0 65 74 27 73 20 66 69 72 73 74 20 6c 6f 6f 6b 20 |et's first look | 000004c0 61 74 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 |at a procedure t| 000004d0 6f 20 63 61 72 72 79 20 6f 75 74 20 74 68 69 73 |o carry out this| 000004e0 20 72 6f 75 74 69 6e 65 2e 20 41 73 20 74 68 65 | routine. As the| 000004f0 72 65 0d 61 72 65 20 74 77 65 6e 74 79 20 66 6f |re.are twenty fo| 00000500 75 72 20 6e 6f 74 65 73 20 69 6e 20 74 68 65 20 |ur notes in the | 00000510 72 68 79 6d 65 2c 20 77 65 20 63 61 6e 20 63 6f |rhyme, we can co| 00000520 6e 76 65 6e 69 65 6e 74 6c 79 20 72 65 61 64 20 |nveniently read | 00000530 69 6e 20 74 68 65 20 77 6f 72 64 0d 6f 72 20 70 |in the word.or p| 00000540 61 72 74 20 77 6f 72 64 2c 20 74 68 65 20 70 69 |art word, the pi| 00000550 74 63 68 20 6f 66 20 74 68 65 20 6e 6f 74 65 20 |tch of the note | 00000560 61 6e 64 20 74 68 65 20 6e 6f 74 65 27 73 20 64 |and the note's d| 00000570 75 72 61 74 69 6f 6e 2c 20 66 72 6f 6d 20 44 41 |uration, from DA| 00000580 54 41 0d 73 74 61 74 65 6d 65 6e 74 73 2e 0d 20 |TA.statements.. | 00000590 20 20 20 20 20 34 30 30 30 44 41 54 41 20 6f 6e | 4000DATA on| 000005a0 65 2c 38 38 2c 38 2c 74 77 6f 2c 38 38 2c 38 2c |e,88,8,two,88,8,| 000005b0 74 68 72 65 65 2c 38 30 2c 34 2c 66 6f 75 72 2c |three,80,4,four,| 000005c0 37 32 2c 34 2c 66 69 76 65 2c 37 32 2c 38 0d 20 |72,4,five,72,8. | 000005d0 20 20 20 20 20 34 30 31 30 44 41 54 41 20 6f 6e | 4010DATA on| 000005e0 63 65 2c 38 30 2c 34 2c 49 2c 38 38 2c 34 2c 63 |ce,80,4,I,88,4,c| 000005f0 61 75 67 68 74 2c 39 32 2c 34 2c 61 2c 31 30 30 |aught,92,4,a,100| 00000600 2c 34 2c 66 69 73 68 2c 31 30 30 2c 34 2c 61 2c |,4,fish,100,4,a,| 00000610 39 32 2c 34 2c 6c 69 0d 20 20 20 76 65 2c 39 32 |92,4,li. ve,92| 00000620 2c 38 0d 20 20 20 20 20 20 34 30 32 30 44 41 54 |,8. 4020DAT| 00000630 41 20 73 69 78 2c 39 32 2c 38 2c 73 65 76 65 6e |A six,92,8,seven| 00000640 2c 39 32 2c 38 2c 65 69 67 68 74 2c 38 38 2c 34 |,92,8,eight,88,4| 00000650 2c 6e 69 6e 65 2c 38 30 2c 34 2c 74 65 6e 2c 38 |,nine,80,4,ten,8| 00000660 30 2c 38 20 20 20 20 20 20 0d 20 20 20 20 20 20 |0,8 . | 00000670 34 30 33 30 44 41 54 41 20 74 68 65 6e 2c 37 32 |4030DATA then,72| 00000680 2c 34 2c 49 2c 36 38 2c 34 2c 6c 65 74 2c 36 30 |,4,I,68,4,let,60| 00000690 2c 34 2c 69 74 2c 36 38 2c 34 2c 67 6f 2c 38 30 |,4,it,68,4,go,80| 000006a0 2c 34 2c 61 2c 37 32 2c 34 2c 67 61 69 6e 2c 37 |,4,a,72,4,gain,7| 000006b0 32 2c 0d 20 20 20 38 0d 0d 57 65 20 63 61 6e 20 |2,. 8..We can | 000006c0 74 68 65 6e 20 70 72 69 6e 74 20 74 68 65 20 77 |then print the w| 000006d0 6f 72 64 20 69 6e 20 74 68 65 20 63 65 6e 74 72 |ord in the centr| 000006e0 65 20 6f 66 20 74 68 65 20 73 63 72 65 65 6e 2c |e of the screen,| 000006f0 20 70 6c 61 79 20 74 68 65 20 6e 6f 74 65 2c 0d | play the note,.| 00000700 61 6e 64 20 63 6c 65 61 72 20 74 68 65 20 73 63 |and clear the sc| 00000710 72 65 65 6e 2e 20 54 68 65 6e 20 64 6f 20 69 74 |reen. Then do it| 00000720 20 61 6c 6c 20 61 67 61 69 6e 20 75 6e 74 69 6c | all again until| 00000730 20 77 65 20 72 65 61 63 68 20 74 68 65 20 65 6e | we reach the en| 00000740 64 20 6f 66 20 74 68 65 0d 72 68 79 6d 65 2e 0d |d of the.rhyme..| 00000750 20 20 20 20 20 20 31 30 30 30 44 45 46 20 50 52 | 1000DEF PR| 00000760 4f 43 77 6f 72 64 73 20 20 20 0d 20 20 20 20 20 |OCwords . | 00000770 20 31 30 31 30 46 4f 52 20 52 3d 31 20 54 4f 20 | 1010FOR R=1 TO | 00000780 32 34 0d 20 20 20 20 20 20 31 30 32 30 52 45 41 |24. 1020REA| 00000790 44 20 57 4f 52 44 24 2c 50 49 54 43 48 2c 44 55 |D WORD$,PITCH,DU| 000007a0 52 0d 20 20 20 20 20 20 31 30 33 30 50 52 49 4e |R. 1030PRIN| 000007b0 54 20 54 41 42 28 31 35 2c 31 35 29 57 4f 52 44 |T TAB(15,15)WORD| 000007c0 24 0d 20 20 20 20 20 20 31 30 34 30 53 4f 55 4e |$. 1040SOUN| 000007d0 44 20 31 2c 2d 31 35 2c 50 49 54 43 48 2c 44 55 |D 1,-15,PITCH,DU| 000007e0 52 0d 20 20 20 20 20 20 31 30 35 30 54 25 3d 54 |R. 1050T%=T| 000007f0 49 4d 45 3a 52 45 50 45 41 54 55 4e 54 49 4c 20 |IME:REPEATUNTIL | 00000800 54 49 4d 45 3e 54 25 2b 35 2a 44 55 52 0d 20 20 |TIME>T%+5*DUR. | 00000810 20 20 20 20 31 30 36 30 43 4c 53 0d 20 20 20 20 | 1060CLS. | 00000820 20 20 31 30 37 30 4e 45 58 54 20 52 0d 20 20 20 | 1070NEXT R. | 00000830 20 20 20 31 30 38 30 45 4e 44 50 52 4f 43 0d 0d | 1080ENDPROC..| 00000840 54 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 69 |This procedure i| 00000850 73 20 64 65 73 69 67 6e 65 64 20 74 6f 20 77 6f |s designed to wo| 00000860 72 6b 20 69 6e 20 4d 6f 64 65 20 34 2c 20 62 75 |rk in Mode 4, bu| 00000870 74 20 63 6f 75 6c 64 20 62 65 20 61 64 61 70 74 |t could be adapt| 00000880 65 64 20 66 6f 72 20 0d 61 6e 79 20 6f 74 68 65 |ed for .any othe| 00000890 72 20 6d 6f 64 65 2c 20 70 72 6f 76 69 64 69 6e |r mode, providin| 000008a0 67 20 74 68 61 74 20 74 68 65 20 70 61 72 61 6d |g that the param| 000008b0 65 74 65 72 73 20 6f 66 20 74 68 65 20 54 41 42 |eters of the TAB| 000008c0 20 73 74 61 74 65 6d 65 6e 74 20 28 6c 69 6e 65 | statement (line| 000008d0 0d 31 30 33 30 29 20 61 72 65 20 61 64 6a 75 73 |.1030) are adjus| 000008e0 74 65 64 20 61 63 63 6f 72 64 69 6e 67 20 74 6f |ted according to| 000008f0 20 74 68 65 20 61 70 70 72 6f 70 72 69 61 74 65 | the appropriate| 00000900 20 6c 69 6e 65 20 77 69 64 74 68 2e 0d 20 20 20 | line width.. | 00000910 4c 69 6e 65 20 31 30 35 30 20 77 69 6c 6c 20 6e |Line 1050 will n| 00000920 65 65 64 20 73 6f 6d 65 20 65 78 70 6c 61 6e 61 |eed some explana| 00000930 74 69 6f 6e 2e 20 57 65 20 6e 65 65 64 20 61 20 |tion. We need a | 00000940 64 65 6c 61 79 20 6c 6f 6f 70 20 74 6f 20 64 69 |delay loop to di| 00000950 73 70 6c 61 79 0d 74 68 65 20 77 6f 72 64 20 6f |splay.the word o| 00000960 6e 20 74 68 65 20 73 63 72 65 65 6e 20 66 6f 72 |n the screen for| 00000970 20 74 68 65 20 74 69 6d 65 20 74 68 61 74 20 74 | the time that t| 00000980 68 65 20 6e 6f 74 65 20 73 6f 75 6e 64 73 2e 20 |he note sounds. | 00000990 49 66 20 77 65 20 61 6c 6c 6f 77 65 64 0d 74 68 |If we allowed.th| 000009a0 65 20 70 72 6f 67 72 61 6d 20 74 6f 20 63 6f 6e |e program to con| 000009b0 74 69 6e 75 65 20 77 69 74 68 6f 75 74 20 74 68 |tinue without th| 000009c0 69 73 20 64 65 6c 61 79 20 6c 6f 6f 70 2c 20 74 |is delay loop, t| 000009d0 68 65 20 73 63 72 65 65 6e 20 77 6f 75 6c 64 20 |he screen would | 000009e0 63 6c 65 61 72 2c 0d 74 68 65 6e 20 74 68 65 20 |clear,.then the | 000009f0 6e 65 78 74 20 77 6f 72 64 20 77 6f 75 6c 64 20 |next word would | 00000a00 62 65 20 70 72 69 6e 74 65 64 2c 20 61 6e 64 20 |be printed, and | 00000a10 73 6f 20 6f 6e 2c 20 61 6e 64 20 73 6f 20 6f 6e |so on, and so on| 00000a20 2c 20 75 6e 74 69 6c 20 61 6c 6c 20 74 68 65 0d |, until all the.| 00000a30 77 6f 72 64 73 20 68 61 64 20 62 65 65 6e 20 64 |words had been d| 00000a40 69 73 70 6c 61 79 65 64 2c 20 62 75 74 20 74 68 |isplayed, but th| 00000a50 65 20 6d 75 73 69 63 20 77 6f 75 6c 64 20 68 61 |e music would ha| 00000a60 76 65 20 68 61 72 64 6c 79 20 73 74 61 72 74 65 |ve hardly starte| 00000a70 64 2e 20 4f 6e 0d 74 68 65 20 45 6c 65 63 74 72 |d. On.the Electr| 00000a80 6f 6e 2c 20 73 6f 75 6e 64 73 20 61 72 65 20 70 |on, sounds are p| 00000a90 6c 61 63 65 64 20 69 6e 20 61 20 71 75 65 75 65 |laced in a queue| 00000aa0 20 72 65 61 64 79 20 66 6f 72 20 70 72 6f 63 65 | ready for proce| 00000ab0 73 73 69 6e 67 2e 20 54 68 69 73 0d 74 61 6b 65 |ssing. This.take| 00000ac0 73 20 75 70 20 76 65 72 79 20 6c 69 74 74 6c 65 |s up very little| 00000ad0 20 6f 66 20 74 68 65 20 63 6f 6d 70 75 74 65 72 | of the computer| 00000ae0 27 73 20 74 69 6d 65 2e 20 44 72 61 77 69 6e 67 |'s time. Drawing| 00000af0 20 61 6e 64 20 70 72 69 6e 74 69 6e 67 20 6f 6e | and printing on| 00000b00 74 6f 0d 74 68 65 20 73 63 72 65 65 6e 2c 20 68 |to.the screen, h| 00000b10 6f 77 65 76 65 72 2c 20 64 6f 65 73 20 74 61 6b |owever, does tak| 00000b20 65 20 61 20 77 68 69 6c 65 2c 20 73 6f 20 74 68 |e a while, so th| 00000b30 65 20 74 77 6f 20 63 61 6e 20 67 65 74 20 6f 75 |e two can get ou| 00000b40 74 20 6f 66 20 73 74 65 70 2e 0d 59 6f 75 20 63 |t of step..You c| 00000b50 61 6e 20 74 72 79 20 74 68 69 73 20 70 72 6f 63 |an try this proc| 00000b60 65 64 75 72 65 20 77 69 74 68 6f 75 74 20 74 68 |edure without th| 00000b70 69 73 20 6c 69 6e 65 20 74 6f 20 73 65 65 20 28 |is line to see (| 00000b80 61 6e 64 20 68 65 61 72 29 20 74 68 69 73 0d 65 |and hear) this.e| 00000b90 66 66 65 63 74 2e 0d 20 20 20 57 65 20 6d 75 73 |ffect.. We mus| 00000ba0 74 20 64 65 6c 61 79 20 74 68 65 20 70 72 69 6e |t delay the prin| 00000bb0 74 69 6e 67 20 6f 66 20 74 68 65 20 27 6e 65 78 |ting of the 'nex| 00000bc0 74 27 20 77 6f 72 64 20 75 6e 74 69 6c 20 74 68 |t' word until th| 00000bd0 65 20 6e 6f 74 65 20 68 61 73 0d 66 69 6e 69 73 |e note has.finis| 00000be0 68 65 64 20 70 6c 61 79 69 6e 67 2c 20 61 6e 64 |hed playing, and| 00000bf0 20 6c 69 6e 65 20 31 30 35 30 20 64 6f 65 73 20 | line 1050 does | 00000c00 74 68 69 73 2e 20 41 73 20 74 68 65 20 64 75 72 |this. As the dur| 00000c10 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 6e 6f 74 |ation of the not| 00000c20 65 0d 28 44 55 52 20 66 72 6f 6d 20 74 68 65 20 |e.(DUR from the | 00000c30 64 61 74 61 20 73 74 61 74 65 6d 65 6e 74 73 29 |data statements)| 00000c40 20 69 73 20 69 6e 20 74 77 65 6e 74 69 65 74 68 | is in twentieth| 00000c50 73 20 6f 66 20 61 20 73 65 63 6f 6e 64 20 2d 20 |s of a second - | 00000c60 66 6f 72 20 74 68 65 0d 53 4f 55 4e 44 20 73 74 |for the.SOUND st| 00000c70 61 74 65 6d 65 6e 74 20 2d 20 74 68 69 73 20 64 |atement - this d| 00000c80 65 6c 61 79 20 6d 75 73 74 20 62 65 20 63 6f 6e |elay must be con| 00000c90 76 65 72 74 65 64 20 74 6f 20 74 68 65 20 75 6e |verted to the un| 00000ca0 69 74 73 20 6f 66 20 68 75 6e 64 72 65 64 74 68 |its of hundredth| 00000cb0 0d 6f 66 20 61 20 73 65 63 6f 6e 64 20 2d 20 74 |.of a second - t| 00000cc0 68 65 20 75 6e 69 74 73 20 6f 66 20 54 49 4d 45 |he units of TIME| 00000cd0 2e 20 4c 69 6e 65 20 31 30 35 30 20 6d 61 6b 65 |. Line 1050 make| 00000ce0 73 20 74 68 65 20 63 6f 6e 76 65 72 73 69 6f 6e |s the conversion| 00000cf0 20 61 6e 64 20 64 65 2d 0d 6c 61 79 73 20 74 68 | and de-.lays th| 00000d00 65 20 6e 65 78 74 20 77 6f 72 64 20 66 72 6f 6d |e next word from| 00000d10 20 61 70 70 65 61 72 69 6e 67 20 6f 6e 20 74 68 | appearing on th| 00000d20 65 20 73 63 72 65 65 6e 2e 0d 20 20 20 46 6f 72 |e screen.. For| 00000d30 20 74 68 65 20 66 69 72 73 74 20 6e 6f 74 65 2c | the first note,| 00000d40 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 | for example, th| 00000d50 65 20 53 4f 55 4e 44 20 73 74 61 74 65 6d 65 6e |e SOUND statemen| 00000d60 74 20 72 65 71 75 69 72 65 73 2c 20 61 20 0d 64 |t requires, a .d| 00000d70 75 72 61 74 69 6f 6e 20 76 61 6c 75 65 20 6f 66 |uration value of| 00000d80 20 38 2e 20 54 68 65 20 64 65 6c 61 79 20 6c 6f | 8. The delay lo| 00000d90 6f 70 2c 20 68 6f 77 65 76 65 72 2c 20 72 65 71 |op, however, req| 00000da0 75 69 72 65 73 20 61 20 76 61 6c 75 65 20 6f 66 |uires a value of| 00000db0 20 34 30 0d 68 75 6e 64 72 65 64 74 68 20 6f 66 | 40.hundredth of| 00000dc0 20 61 20 73 65 63 6f 6e 64 2e 20 4c 69 6e 65 20 | a second. Line | 00000dd0 31 30 35 30 20 6d 61 6b 65 73 20 74 68 65 20 63 |1050 makes the c| 00000de0 6f 6e 76 65 72 73 69 6f 6e 20 77 69 74 68 20 74 |onversion with t| 00000df0 68 65 20 66 6f 72 6d 75 6c 61 3a 0d 20 20 20 20 |he formula:. | 00000e00 20 20 44 45 4c 41 59 3d 44 55 52 2a 35 0d 0d 59 | DELAY=DUR*5..Y| 00000e10 6f 75 20 63 6f 75 6c 64 2c 20 6f 66 20 63 6f 75 |ou could, of cou| 00000e20 72 73 65 2c 20 70 75 74 20 62 6f 74 68 20 74 69 |rse, put both ti| 00000e30 6d 69 6e 67 20 63 6f 64 65 73 20 73 65 70 61 72 |ming codes separ| 00000e40 61 74 65 6c 79 20 69 6e 74 6f 20 74 68 65 20 64 |ately into the d| 00000e50 61 74 61 20 0d 73 74 61 74 65 6d 65 6e 74 73 2c |ata .statements,| 00000e60 20 62 75 74 20 74 68 69 73 20 77 6f 75 6c 64 20 | but this would | 00000e70 6d 65 61 6e 20 6d 6f 72 65 20 65 66 66 6f 72 74 |mean more effort| 00000e80 20 74 79 70 69 6e 67 20 69 6e 20 74 68 65 20 6d | typing in the m| 00000e90 75 73 69 63 2c 20 61 6e 64 20 62 65 0d 77 61 73 |usic, and be.was| 00000ea0 74 65 66 75 6c 20 6f 66 20 6d 65 6d 6f 72 79 20 |teful of memory | 00000eb0 69 6e 74 6f 20 74 68 65 20 62 61 72 67 61 69 6e |into the bargain| 00000ec0 2e 0d 20 20 20 57 65 20 6e 6f 77 20 68 61 76 65 |.. We now have| 00000ed0 20 61 20 73 69 6d 70 6c 65 20 70 72 6f 63 65 64 | a simple proced| 00000ee0 75 72 65 20 74 6f 20 73 68 6f 77 20 68 6f 77 20 |ure to show how | 00000ef0 77 6f 72 64 73 20 61 6e 64 20 6d 75 73 69 63 20 |words and music | 00000f00 63 61 6e 20 62 65 20 0d 63 6f 6e 6e 65 63 74 65 |can be .connecte| 00000f10 64 2c 20 62 75 74 20 74 68 65 72 65 20 61 72 65 |d, but there are| 00000f20 20 6f 74 68 65 72 20 6d 6f 72 65 20 65 78 63 69 | other more exci| 00000f30 74 69 6e 67 20 77 61 79 73 20 6f 66 20 64 6f 69 |ting ways of doi| 00000f40 6e 67 20 74 68 69 73 2e 20 57 65 20 63 61 6e 0d |ng this. We can.| 00000f50 61 6c 6c 6f 77 20 74 68 65 20 74 65 78 74 20 74 |allow the text t| 00000f60 6f 20 62 75 69 6c 64 20 75 70 20 6f 6e 20 74 68 |o build up on th| 00000f70 65 20 73 63 72 65 65 6e 2c 20 77 6f 72 64 20 62 |e screen, word b| 00000f80 79 20 77 6f 72 64 2c 20 75 6e 74 69 6c 20 74 68 |y word, until th| 00000f90 65 20 63 6f 6d 2d 0d 70 6c 65 74 65 20 76 65 72 |e com-.plete ver| 00000fa0 73 65 20 69 73 20 64 69 73 70 6c 61 79 65 64 2e |se is displayed.| 00000fb0 0d 20 20 20 54 68 65 20 73 61 6d 65 20 64 61 74 |. The same dat| 00000fc0 61 20 73 74 61 74 65 6d 65 6e 74 73 20 63 61 6e |a statements can| 00000fd0 27 74 20 62 65 20 75 73 65 64 20 62 65 63 61 75 |'t be used becau| 00000fe0 73 65 20 77 65 20 6e 65 65 64 20 70 75 6e 63 74 |se we need punct| 00000ff0 75 61 74 69 6f 6e 20 6f 6e 0d 74 68 65 20 73 63 |uation on.the sc| 00001000 72 65 65 6e 20 6e 6f 77 20 74 68 61 74 20 77 65 |reen now that we| 00001010 20 61 72 65 20 74 6f 20 68 61 76 65 20 74 68 65 | are to have the| 00001020 20 77 68 6f 6c 65 20 76 65 72 73 65 20 76 69 73 | whole verse vis| 00001030 69 62 6c 65 20 61 74 20 6f 6e 63 65 2e 20 57 68 |ible at once. Wh| 00001040 65 6e 0d 77 65 20 69 6e 63 6c 75 64 65 20 70 75 |en.we include pu| 00001050 6e 63 74 75 61 74 69 6f 6e 20 69 6e 20 64 61 74 |nctuation in dat| 00001060 61 20 77 65 20 68 61 76 65 20 74 6f 20 77 72 61 |a we have to wra| 00001070 70 20 74 68 65 20 64 61 74 61 20 69 6e 20 69 6e |p the data in in| 00001080 76 65 72 74 65 64 20 0d 63 6f 6d 6d 61 73 2e 20 |verted .commas. | 00001090 41 6e 6f 74 68 65 72 20 73 6e 61 67 20 69 73 20 |Another snag is | 000010a0 74 68 61 74 20 77 65 20 68 61 76 65 20 74 6f 20 |that we have to | 000010b0 70 72 6f 76 69 64 65 20 73 6f 6d 65 20 6d 65 61 |provide some mea| 000010c0 6e 73 20 6f 66 20 74 65 6c 6c 69 6e 67 20 0d 74 |ns of telling .t| 000010d0 68 65 20 63 6f 6d 70 75 74 65 72 20 74 6f 20 73 |he computer to s| 000010e0 74 61 72 74 20 61 20 6e 65 77 20 6c 69 6e 65 20 |tart a new line | 000010f0 66 6f 72 20 65 61 63 68 20 6c 69 6e 65 20 6f 66 |for each line of| 00001100 20 74 68 65 20 76 65 72 73 65 20 61 6e 64 20 74 | the verse and t| 00001110 68 61 74 0d 22 61 6c 69 76 65 22 20 61 6e 64 20 |hat."alive" and | 00001120 22 61 67 61 69 6e 22 20 61 72 65 20 74 77 6f 20 |"again" are two | 00001130 6e 6f 74 65 73 20 65 61 63 68 20 62 75 74 20 6f |notes each but o| 00001140 6e 6c 79 20 6f 6e 65 20 77 6f 72 64 2e 20 57 65 |nly one word. We| 00001150 20 6e 65 65 64 20 74 6f 20 0d 69 6e 74 72 6f 64 | need to .introd| 00001160 75 63 65 20 61 20 63 6f 64 69 6e 67 20 73 79 73 |uce a coding sys| 00001170 74 65 6d 20 69 6e 74 6f 20 6f 75 72 20 64 61 74 |tem into our dat| 00001180 61 2e 0d 0d 54 68 69 73 20 61 72 74 69 63 6c 65 |a...This article| 00001190 20 63 6f 6e 74 69 6e 75 65 64 20 69 6e 20 74 68 | continued in th| 000011a0 65 20 66 69 6c 65 20 56 2e 2b 53 59 4e 43 48 32 |e file V.+SYNCH2| 000011b0 2e 20 46 69 72 73 74 20 70 75 62 6c 69 73 68 65 |. First publishe| 000011c0 64 20 45 4c 42 55 47 20 32 2e 31 2e 0d 52 65 70 |d ELBUG 2.1..Rep| 000011d0 72 6f 64 75 63 65 64 20 45 55 47 20 23 35 34 2e |roduced EUG #54.| 000011e0 0d |.| 000011e1