Jump to content

Using a speech engine to highlight words: Difference between revisions

no edit summary
m (simplified wording)
No edit summary
Line 24:
Else word .= lf, i++
}</lang>
 
=={{header|M2000 Interpreter}}==
<lang M2000 Interpreter>
Module UsingEvents {
Form 60, 32
Cls 5, 0
Pen 14
Declare WithEvents sp "SAPI.SpVoice"
That$="Rosetta Code is a programming chrestomathy site"
margin=(width-Len(That$))/2
EndStream=False
\\ this function called as sub routine - same scope as Module
\\ we can call it from event function too
Function Localtxt {
\\ move the cursor to middle line
Cursor 0, height/2
\\ using OVER the line erased with background color and then print text over
\\ ordinary Print using transparent printing of text
\\ $(0) set mode to non proportional text, @() move the cursor to sepecific position
Print Over $(0),@(margin), That$
}
Call Local LocalTxt()
Function sp_Word {
Read New &StreamNumber, &StreamPosition, &CharacterPosition, &Length
Call Local LocalTxt()
Cursor 0, height/2
Pen 15 {Print Part $(0), @(CharacterPosition+margin); Mid$(That$, CharacterPosition+1, Length)}
Refresh
}
Function sp_EndStream {
Refresh
EndStream=True
}
Const SVEEndInputStream = 4
Const SVEWordBoundary = 32
Const SVSFlagsAsync = 1&
With sp, "EventInterests", SVEWordBoundary+SVEEndInputStream
Method sp, "Speak", That$, SVSFlagsAsync
While Not EndStream {Wait 10}
Call Local LocalTxt()
}
UsingEvents
 
</lang>
 
=={{header|Mathematica}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.