This program need two different voices (voice 1 male, voice 2 female). Windows 11 and 10 have two.
place these on a module say a.
Edit a
Then copy this code, then press Esc to close editor, then type a to run it. This program terminate with Esc.
Escape Off
Const proportional = 4, terminal_style = 0
Const male=1, female=2, on=1, off=0
Flush
Data ("George","Athens", male, false)
Data ("Alexander", "Marusi", male, true)
Data ("Katerina", "Marusi", female, true)
database=array([])
Volume 100
Form 60
Pen 14
Cls #ff2000
Print $(proportional),
Double
Print "English Lesson 1"
Normal
Cls 5, row
Refresh
For i=1 to Speech {
Print "Voice "+i+": "+Speech$(i)
}
If Speech<2 Then Print "I need two voices at least": Goto exit1
Speech {<silence msec="500"/>} ' start engine and pause for half second.
do
Italic on : Pen #AAAA00 {Print "Hold Esc to Exit"}: Italic off
a=database#Val(Random(0,2))
Say("Teacher","Hi; What"+If$(Random(1,2)->"'s", " is")+" your name?", 2)
Say(a#Val$(0),"Hello; My name is "+a#Val$(0)+".", a#Val(2), a#Val(3))
If Keypress(27) Then Exit
Say("Teacher","Where are you from, "+a#Val$(0)+"?", 2)
Say(a#Val$(0),"I"+If$(Random(1,2)->"'m", " am")+" from "+@emph$(a#Val$(1))+".", a#Val(2), a#Val(3))
If Keypress(27) Then Exit
Always
Pen #AAbb77 {
Say("Teacher","That's it for today. "+@emph$("Goodbye."), 2)
}
exit1:
Print $(terminal_style),
While Keypress(27) {Wait 10}
Escape on
End
Function emph$(a$)
="<emph>"+a$+"</emph>"
End Function
Function clear$(a$)
Local b=1, c
Do
b=Instr(a$, "<", b)
If b>0 Then
c=Instr(a$, ">", b+1)
If c>0 Then
Insert b, c-b+1 a$=""
Else
b=0
End If
Else
b=0
End If
When b>0
=a$
End Function
Sub Say(who$, that$, gender as integer, teen as boolean=false)
Print who$+": "+@clear$(that$)
Refresh
If teen Then
Speech ";"+that$!, gender
Else
Speech ";"+that$, gender
End If
End Sub
Δεν υπάρχουν σχόλια:
Δημοσίευση σχολίου
You can feel free to write any suggestion, or idea on the subject.