home *** CD-ROM | disk | FTP | other *** search
/ Computer Club Elmshorn Atari PD / CCE_PD.iso / pc / 0600 / CCE_0606.ZIP / CCE_0606.PD / SPEAK / SPEAK.LST < prev    next >
File List  |  1989-12-16  |  5KB  |  212 lines

  1. ' ************************************
  2. ' *                                  *
  3. ' *   SPRACHAUSGABE MIT ST-SPEECH    *
  4. ' *                                  *
  5. ' *       1989 MARTIN MALICH         *
  6. ' *            ECKHARD GRAH          *
  7. ' *   (c) MAXON Computer GmbH        *
  8. ' *                                  *
  9. ' ************************************
  10. '
  11. Gosub Init_say
  12. Gosub Say(" 5 4 3 2 1  Hello, I am SAM. the digital voice for the ATARI S T.")
  13. Gosub Say("exclusiv from MAXON Computer.")
  14. Gosub Say("The best ATARI S T Public Domain Service.")
  15. Gosub Exit_say
  16. End
  17. '
  18. ' Einfacher geht's nicht !!!!
  19. '
  20. Procedure Init_say
  21.   Local Relo_table%,Relo_end%,Relo_adr%,Say_start%,R%,A%
  22.   '
  23.   Dim Say!(40000*8)               ! Platz für speaktex.tos
  24.   Dim Puffer!(1000*8)             ! Sprachpuffer
  25.   '
  26.   Puffer%=Lpeek(Arrptr(Puffer!()))+500
  27.   Say%=Varptr(Say!(0))
  28.   '
  29.   If Exist("speaktex.tos")
  30.     Bload "speaktex.tos",Say%
  31.   Else
  32.     Alert 3,"SPEAKTEX.TOS nicht vorhanden",1," Abbruch ",Dummy%
  33.     End
  34.   Endif
  35.   '
  36.   Relo_table%=Say%+28256
  37.   Relo_end%=Say%+28359
  38.   Relo_adr%=Say%+80
  39.   Say_start%=Say%+28
  40.   '
  41.   For R%=Relo_table% To Relo_end%
  42.     A%=Peek(R%)
  43.     If A%=1
  44.       Add Relo_adr%,254
  45.     Else
  46.       Add Relo_adr%,A%
  47.       Lpoke Relo_adr%,Lpeek(Relo_adr%)+Say_start%
  48.     Endif
  49.   Next R%
  50.   '
  51.   Add Say%,&H52
  52.   '
  53. Return
  54. '
  55. '
  56. Procedure Exit_say
  57.   '
  58.   @Wait_say
  59.   Erase Say!()
  60.   Erase Puffer!()
  61.   '
  62. Return
  63. '
  64. '
  65. Procedure Say(A$)
  66.   '
  67.   If Len(A$)>0
  68.     Bmove Varptr(A$),Puffer%,Len(A$)+1
  69.     Void C:Say%(L:Puffer%,Len(A$))
  70.   Endif
  71.   '
  72. Return
  73. '
  74. '
  75. Procedure Wait_say
  76.   Local Er%
  77.   '
  78.   Clr Er%
  79.   Repeat
  80.     If Peek(&HFFFA0B)=32
  81.       Inc Er%
  82.     Else
  83.       Clr Er%
  84.     Endif
  85.   Until Er%=50
  86.   Spoke &HFFFA19,0
  87.   '
  88. Return
  89. '
  90. '
  91. Procedure Say_number(Num%)
  92.   Local Num1%,Num1$,I%,Num$
  93.   '
  94.   If Num%<0
  95.     @Say("minus")
  96.     Num%=-Num%
  97.   Endif
  98.   '
  99.   If Num%=0
  100.     @Say("0")
  101.   Else
  102.     Num$=Str$(Num%)
  103.     For I%=Int(Len(Num$)/3)*3 To 0 Step -3
  104.       '
  105.       If Num%>9
  106.         Num1%=Int(Num%/10^I%)
  107.       Else
  108.         Num1%=Num%
  109.       Endif
  110.       '
  111.       Num1$=Str$(Num1%)
  112.       If Num1%>0
  113.         If Num1%>=100
  114.           '
  115.           @Say(Left$(Num1$,1))
  116.           @Say("hundred")
  117.           Num1$=Right$(Num1$,2)
  118.           Num1%=Val(Num1$)
  119.           If Left$(Num1$,1)="0" And Left$(Num1$,2)<>"00"
  120.             @Say("and")
  121.           Endif
  122.           '
  123.         Endif
  124.         If Num1%>=20
  125.           A$=Left$(Num1$,1)
  126.           If A$="2"
  127.             @Say("twenty")
  128.           Else
  129.             If A$="3"
  130.               @Say("thirty")
  131.             Else
  132.               If A$="4"
  133.                 @Say("fourty")
  134.               Else
  135.                 If A$="5"
  136.                   @Say("fifty")
  137.                 Else
  138.                   If A$="6"
  139.                     @Say("sixty")
  140.                   Else
  141.                     If A$="7"
  142.                       @Say("seventy")
  143.                     Else
  144.                       If A$="8"
  145.                         @Say("eighty")
  146.                       Else
  147.                         If A$="9"
  148.                           @Say("nine te")
  149.                         Endif
  150.                       Endif
  151.                     Endif
  152.                   Endif
  153.                 Endif
  154.               Endif
  155.             Endif
  156.           Endif
  157.           Num1$=Right$(Num1$,1)
  158.           Num1%=Val(Num1$)
  159.           If Num1%<>0
  160.             @Say(Num1$)
  161.           Endif
  162.         Else
  163.           If Num1%<=9 And Num1%>0
  164.             @Say(Str$(Num1%))
  165.           Else
  166.             If Num1%=10
  167.               @Say("ten")
  168.             Else
  169.               If Num1%=11
  170.                 @Say("eleven")
  171.               Else
  172.                 If Num1%=12
  173.                   @Say("twelve")
  174.                 Else
  175.                   If Num1%=13
  176.                     @Say("thirteen")
  177.                   Else
  178.                     If Num1%=14
  179.                       @Say("4teen")
  180.                     Else
  181.                       If Num1%=15
  182.                         @Say("fifteen")
  183.                       Else
  184.                         If Num1%>=16
  185.                           @Say(Right$(Num1$,1)+"teen")
  186.                         Endif
  187.                       Endif
  188.                     Endif
  189.                   Endif
  190.                 Endif
  191.               Endif
  192.             Endif
  193.           Endif
  194.         Endif
  195.         If I%=9
  196.           @Say("billion")
  197.         Else
  198.           If I%=6
  199.             @Say("million")
  200.           Else
  201.             If I%=3
  202.               @Say("thousand")
  203.             Endif
  204.           Endif
  205.         Endif
  206.         Num%=Num%-Int(Num%/10^I%)*10^I%
  207.       Endif
  208.     Next I%
  209.   Endif
  210.   '
  211. Return
  212.