Morse code
It has been in use for more than 175 years — longer than any other electronic encoding system.



Task

Send a string as audible Morse code to an audio device   (e.g., the PC speaker).



As the standard Morse code does not contain all possible characters,
you may either ignore unknown characters in the file,
or indicate them somehow   (e.g. with a different pitch).




10 REM Morse code
20 DIM c$(54)
30 FOR f = 1 TO 54
40 READ l$, m$
50 LET d$ = d$ + l$ : LET c$(f) = m$
60 NEXT f
 
100 LINE INPUT "Message? " t$
105 t$ = upper$(t$)
110 FOR f = 1 TO LEN(t$)
120 p = INSTR(d$, mid$(t$, f, 1))
130 IF p > 0 then
        PRINT c$(p);
    else
        print "?";
    end if
140 NEXT f
print
goto 100
 
 
1000 DATA "A","._","B","_...","C","_._.","D","_..","E",".","F",".._."
1010 DATA "G","__.","H","....","I","..","J",".___","K","_._","L","._.."
1020 DATA "M","__","N","_.","O","___","P",".__.","Q","__._","R","._."
1030 DATA "S","...","T","_","U",".._","V","..._","W",".__","X","_.._"
1040 DATA "Y","_.__","Z","__..","1",".____","2","..___","3","...__"
1050 DATA "4","...._","5",".....","6","_....","7","__...","8","___.."
1060 DATA "9","____.","0","_____",".","._._._",",","__..__","?","..__.."
1070 DATA "'",".____.","!","_._.__","/","_.._.","(","_.__.",")","_.__._"
1080 DATA "&","._...",":","___...",";","_._._.","=","_..._","+","._._.","-","_...._"
1090 DATA "_","..__._","\"","._.._.","$","..._.._","@",".__._."