Has anybody implemented speech input and output using xlobby and girder (just as HAl and homeseer) ?
Marius
vicom wrote:I have implemented Speech Output only, using VBcript and Microsoft Agent and Xlobby. I have the Agent read my movie plot before I launch a movie. I've tried the Microsoft Agent Speech Recognition, but its just not worth it
vicom wrote:Basically i installed: (you can get all these here
-Microsoft Agent
-Agent Characters
-Text-to-Speech Engines (TTS) from Microsoft.
Then I created a VBscript file which I call from within Xlobby (Execute event) and pass it the text I want it to read (as a parameter) . Merlin (or any other character) then popsup and starts reading the text you just passed it.
I'm trying to create a plugin (with more options,if there is any interest) instead of a Vbscript file..but the file works as it is at the moment
' * Agent Object
Dim AgentControl
' * Character Objects
Dim Merlin
' * Variables
Dim UsedChars
Dim MerlinID
Dim MerlinACS
Dim MerlinLoaded
Dim HideReq
Dim Req
Dim ScriptComplete
Dim args,dummy
Set args = Wscript.Arguments
' * Initialize
UsedChars = "Merlin"
' * Merlin
MerlinID = "Merlin"
MerlinACS = "Merlin.acs"
MerlinLoaded = False
ScriptComplete = False
Call Main
'----------------------------------------------------------------------------
Function AgentInstalled()
' Purpose: Returns True if Agent 2.0 is installed, else False
On Error Resume Next
If ScriptEngineMajorVersion < 2 Then
AgentInstalled = False
Else
Set AgentControl = WScript.CreateObject("Agent.Control.2", "AgentControl_")
AgentInstalled = IsObject(AgentControl)
End If
End Function
'-------------------------------------------------------------------------------
Sub Main()
On Error Resume Next
' * INSERT ANY NON-AGENT RELATED SCRIPTING HERE
If Not AgentInstalled() Then
Exit Sub
End If
AgentControl.Connected = True
MerlinLoaded = LoadLocalAgent(MerlinID, MerlinACS)
If Not MerlinLoaded Then
MerlinLoaded = LoadLocalAgent(MerlinID, "")
End If
If MerlinLoaded Then
Call SetCharObj
Call AgentIntro
Else
Call LoadError
End If
End Sub
'---------------------------------------------------------------------------
Function LoadLocalAgent(ByVal CharID, ByVal CharACS)
' Purpose: Attempts to load the specified character
' Returns: True if successful, False if not
On Error Resume Next
If CharACS = "" Then
AgentControl.Characters.Load CharID, CharACS
Else
AgentControl.Characters.Load CharID, CharACS
End If
If Err = 0 Then
LoadLocalAgent = True
Exit Function
End If
LoadLocalAgent = False
End Function
'------------------------------------------------------------------------------
Sub SetCharObj()
' Purpose: Sets the character reference and TTS Language ID
On Error Resume Next
Set Merlin = AgentControl.Characters(MerlinID)
Merlin.LanguageID = &H809
End Sub
'-----------------------------------------------------------------------------
Sub AgentControl_RequestComplete(ByVal RequestObject)
' Purpose: Take action on completion or failure of requests
On Error Resume Next
If RequestObject <> EndReq Then
Else
If Not Merlin.Visible Then
' Trigger the Script to Close
ScriptComplete = True
Else
' It is up to the user to close the script, by right-clicking
' the character and selecting 'Exit'
End If
End If
If RequestObject <> HideReq Then
Else
AgentControl.Characters.Unload MerlinID
ScriptComplete = True
End If
End Sub
'----------------------------------------------------------------------------------------------
Sub LoadError()
Dim strMsg
strMsg = "Error Loading Character: " & MerlinID
strMsg = strMsg & Chr(13) & Chr(13) & "This Microsoft Agent Script requires the character(s):"
strMsg = strMsg & Chr(13) & UsedChars
MsgBox strMsg, 48
End Sub
'---------------------------------------------------------------------------------------
Sub AgentControl_Click(ByVal CharacterID, ByVal Button, ByVal Shift, ByVal X, ByVal Y)
End Sub
'----------------------------------------------------------------------------------------
Sub AgentControl_DblClick(ByVal CharacterID, ByVal Button, ByVal Shift, ByVal X, ByVal Y)
' Purpose: Stop and Hide all characters on double-click
On Error Resume Next
Merlin.StopAll
If Not MerlinID.HasOtherClients Then
If Merlin.Visible Then
Set HideReq = Merlin.Hide()
Else
AgentControl.Characters.Unload MerlinID
ScriptComplete = True
End If
End If
End Sub
'--------------------------------------------------------------------------------------------
Sub InitAgentCommands()
' Purpose: Initialize the Commands menu
Merlin.Commands.RemoveAll
Merlin.Commands.Caption = "My Menu Name"
Merlin.Commands.Add "ACO", "Advanced Character Options", "Advanced Character Options"
Merlin.Commands.Add "Exit", "Exit", "Exit"
End Sub
'-------------------------------------------------------------------------------------------
Sub AgentControl_Command(ByVal UserInput)
' Purpose: Determine Command that was selected either by menu or voice
' and run the applicable Command Script
On Error Resume Next
Dim BadConfidence
BadConfidence = 10
If (UserInput.Confidence <= -40) Then
' Bad Recognition
Exit Sub
ElseIf (UserInput.Alt1Name <> "") And Abs(Abs(UserInput.Alt1Confidence) - Abs(UserInput.Confidence)) < BadConfidence Then
' Bad Confidence - too close to another command
Exit Sub
ElseIf (UserInput.Alt2Name <> "") And Abs(Abs(UserInput.Alt2Confidence) - Abs(UserInput.Confidence)) < BadConfidence Then
' Bad Confidence - too close to another command
Exit Sub
Else ' High Confidence
' *** BEGIN USER COMMANDS ***
Select Case UserInput.Name
Case "ACO"
AgentControl.PropertySheet.Visible = True
End Select
' *** END USER COMMANDS ***
If UserInput.Name = "Exit" Then
Set HideReq = Merlin.Hide()
End If
End If
End Sub
'--------------------------------------------------------------------------
Sub AgentControl_Bookmark(ByVal BookmarkID)
On Error Resume Next
End Sub
'-------------------------------------------------------------------------
Sub AgentIntro()
On Error Resume Next
Call InitAgentCommands
' *** BEGIN USER SCRIPT ***
Merlin.Show
Merlin.TTSModeID = "{C77C5170-2867-11D0-847B-444553540000}"
Merlin.Balloon.Style = &H264000F
Merlin.Play "Read"
Merlin.Speak args(0)
Merlin.Play "ReadReturn"
' Scriptcomplete =true
' *** END MASH SCRIPT ***
Set EndReq = Merlin.Speak("\mrk=999999999\")
merlin.hide
Set HideReq = Merlin.Hide()
WScript.end
Do
WScript.Sleep 1000
Loop Until ScriptComplete
End Sub
S Pittaway wrote:i had to change AgentIntro to enable speach output...
Merlin.TTSModeID = "{C77C5170-2867-11D0-847B-444553540000}"
Merlin.TTSModeID=
S Pittaway wrote:how do you pass the plot to it?
%movie>plot%