Hallo,
kann man mit Autoit ein Programm Schreiben ,das den Pc Herunterfährt,wen man in ein Microfon einen Befehl sagt wie etwa "Aus" oder "Ausschalten"?
Lg Pceumel
Hallo,
kann man mit Autoit ein Programm Schreiben ,das den Pc Herunterfährt,wen man in ein Microfon einen Befehl sagt wie etwa "Aus" oder "Ausschalten"?
Lg Pceumel
Ich glaube da ist die Grundfrage erstmal, wie kann ich mit autoit mein Microfon abrufen
Öhm. Spracherkennungsalgorithmen haben nicht umsonst 20 Jahre praktisch nicht funktioniert ;-). Das ist von AutoIt aus nicht möglich. Man kann höchstens ein fertiges Tool fernsteuern, aber auch da gibt es wenig qualitativ gute Software...
peethebee
Kostenlos gibt es nichts. Erst ab Vista ist die integrierte SAPI akzeptabel in der Erkennung und Deutsch, glaube ich.
In XP gibt es nur Englisch und das richtig schlecht ...
Also bei Vista und 7 ist das schon dabei ich habe ka aber ein Freund sagt das es geht
Hi,
hier ist etwas zum Rumspielen ohne das es ein bestimmtes Wort jedoch aber Lärm ansich erkennt.
#include<String.au3>
#include<Sound.au3>
;~ -----------------------------------------------------------------
;~ MusicStarter TestVersion
;~ By Nemcija ([email='BlackShadow3@web.de'][/email])
;~ With UDF's by CyberZeroCool
;~
;~ Just call it crap biggrin.gif
;~ -----------------------------------------------------------------
#Region Settings
Global $voice = ObjCreate("Sapi.SpVoice")
$VoiceActivationLevel = 12 ; Use Debugmode to determine this
$SleepBeforeCheck = 3 ;Seconds bevor start checking the microphonelevel (time to leave the room biggrin.gif)
Global $LastLevelsSet
$Debugmode = True ;To determine the activation level
#EndRegion Settings
#Region Includes
#EndRegion Includes
#Region Functions
Func _mciSendString($lpszCommand, $lpszReturnString, $cchReturn, $hwndCallback)
Return DllCall("winmm.dll", "long", "mciSendStringA", "str", $lpszCommand, "str", $lpszReturnString, "long", $cchReturn, "long", 0)
EndFunc ;==>_mciSendString
Func _mciShowError($mciError, $add = "test")
Dim $errStr
$errStr = _StringRepeat(" ", 256)
$Result = DllCall("winmm.dll", "long", "mciGetErrorStringA", "long", $mciError, "string", $errStr, "long", StringLen($errStr))
MsgBox(0, "MCI " & $add, "MCI Error Number " & $mciError & ":" & $Result[2])
EndFunc ;==>_mciShowError
Func _LevelCheck()
Global $lpszCommand, $lpszReturnString, $cchReturn
$mciError = _mciSendString($lpszCommand, $lpszReturnString, $cchReturn, 0)
If $mciError[0] <> 0 Then
_mciShowError($mciError[0])
EndIf
_AddToLastLevels($mciError[2])
EndFunc ;==>_LevelCheck
Func _AddToLastLevels($level)
Global $LastLevels, $LevelTime, $Debugmode
$LastLevels[$LastLevelsSet] = $level
$LastLevelsSet += 1
If $Debugmode Then ToolTip($level)
If $LastLevelsSet = $LevelTime + 1 Then $LastLevelsSet = 1
EndFunc ;==>_AddToLastLevels
#EndRegion Functions
#Region Startup
$lpszDevice = "new type waveaudio"
$lpszOpenFlags = "alias mywave"
$lpszFlags = ""
$lpszCommand = StringFormat("open %s %s %s", $lpszDevice, $lpszOpenFlags, $lpszFlags)
$lpszReturnString = _StringRepeat(" ", 256)
$cchReturn = StringLen($lpszReturnString)
$mciError = _mciSendString($lpszCommand, $lpszReturnString, $cchReturn, 0);
If $mciError[0] <> 0 Then
_mciShowError($mciError[0], "Startup Error")
Exit
EndIf
$lpszDeviceID = "mywave"
$lpszRequest = "level"
$lpszFlags = ""
$lpszCommand = StringFormat("status %s %s %s", $lpszDeviceID, $lpszRequest, $lpszFlags)
$LevelTime = 15 ; *100ms
[/autoit] [autoit][/autoit] [autoit]Dim $LastLevels[$LevelTime + 1]
For $i = 1 To $LevelTime
$LastLevels[$i] = 0
Next
$LastLevelsSet = 1
[/autoit] [autoit][/autoit] [autoit]AdlibEnable("_LevelCheck", 100)
#EndRegion Startup
#Region Runtime
Sleep($SleepBeforeCheck * 1000)
ConsoleWrite("! check on" & @CRLF)
While 1
Sleep(100)
$Active = False
$i = 0
While (($i <= $LevelTime) And (Not $Active))
$Active = $Active Or ($LastLevels[$i] >= $VoiceActivationLevel)
$i += 1
WEnd
If $Active Then
ConsoleWrite("FOUND" & @CRLF)
Speak("FUCK I got YOU!!!!", 0.75, 100)
;~ MsgBox(64, 'Somebody said something', 'NOISE :-)',5)
;~ Send("{MEDIA_PLAY_PAUSE}")
Exit
EndIf
WEnd
#EndRegion Runtime
Func Speak($Text, $Rate, $Vol)
$voice.Rate = $Rate
$voice.Volume = $Vol
$voice.Speak($Text)
EndFunc ;==>Speak
Mega
Die schlechte englische Spracherkennung auf XP:
#include<GUIEdit.au3>
#include<GUIConstants.au3>
Opt("GUIonEventMode",1)
GUICreate("test")
GUISetOnEvent(-3,"_EXIT")
$Edit = GUICtrlCreateEdit("",10,10,380,350)
$btnStart = GUICtrlCreateButton("Start",10,370,60,20)
GUICtrlSetOnEvent(-1,"_Start")
$btnStop = GUICtrlCreateButton("Stop",100,370,60,20)
GUICtrlSetOnEvent(-1,"_Stop")
GUICtrlSetState(-1,$GUI_DISABLE)
GUISetState()
#cs
'=============================================================================
' This sample demonstrates how to do simple dictation in VB with SAPI 5.1.
'
' It uses shared reco context object, uses the default audio input, loads in
' dictation grammar, sets up event handlers, and shows the recognized text in
' the dialog text box.
'
' Note: since the text box is using system locale, it may not correctly show
' characters in other languages. For example, if you use Chinese Speech
' Recognition engine as the default engine on your English OS, the text box
' may show garbage even though the engine recognizes Chinese.
'
' Copyright @ 2001 Microsoft Corporation All Rights Reserved.
'
'=============================================================================
#ce
$__COMERROR = ObjEvent("AutoIt.Error","_COMError")
Func _COMError()
MsgBox(32, "COM-Error", Hex($__COMERROR.number) & @CRLF & $__COMERROR.description)
EndFunc
Global Const $SGDSInactive = 0
Global Const $SGDSActive = 1
Global Const $SGDSActiveWithAutoPause = 3
Global $RecoContext ;ObjCreate("SAPI.SpSharedRecoContext")
;~ $RecoContext.VB_VarHelpID = -1
Global $Grammar ;As ISpeechRecoGrammar
Global $m_bRecoRunning ;As Boolean
Global $m_cChars = 0 ;As Integer
SetState(False)
[/autoit] [autoit][/autoit] [autoit]While 1
Sleep(100)
WEnd
Func _Start()
If $m_bRecoRunning Then Return
;' Initialize recognition context object and grammar object, then
;' start dictation
If (Not IsObj($RecoContext)) Then
ConsoleWrite("Initializing SAPI reco context object..." & @CRLF)
$RecoContext = ObjCreate("SAPI.SpSharedRecoContext")
ObjEvent($RecoContext,"RecoContext_")
$Grammar = $RecoContext.CreateGrammar(1)
$Grammar.DictationSetState ( $SGDSInactive )
EndIf
$Grammar.DictationSetState ( $SGDSActive )
SetState(True)
ConsoleWrite("Recognition started" & @CRLF)
EndFunc
Func _EXIT()
_Stop()
Exit
EndFunc
Func _Stop()
If Not $m_bRecoRunning Then Return
$Grammar.DictationSetState ( $SGDSInactive ))
SetState(False)
ConsoleWrite("Recognition stopped" & @CRLF)
EndFunc
;~ ' This function handles Recognition event from the reco context object.
;~ ' Recognition event is fired when the speech recognition engines recognizes
;~ ' a sequences of words.
Func RecoContext_Recognition($StreamNumber , _
$StreamPosition , _
$RecognitionType , _
$Result _
)
Dim $strText
$strText = $Result.PhraseInfo.GetText
ConsoleWrite( "Recognition: " & $strText & ", " & _
$StreamNumber & ", " & $StreamPosition & @CRLF)
;~ ' Append the new text to the text box, and add a space at the end of the
;~ ' text so that it looks better
;~ $txtSpeech.SelStart = m_cChars
;~ $txtSpeech.SelText = strText & " "
_GUICtrlEdit_AppendText($Edit,$strText & " ")
;~ m_cChars = m_cChars + 1 + Len(strText)
EndFunc
;~ ' This function handles the state of Start and Stop buttons according to
;~ ' whether dictation is running.
Func SetState($bNewState )
$m_bRecoRunning = $bNewState
Local $Enabled[2] = [$GUI_DISABLE,$GUI_ENABLE]
GUICtrlSetState($btnStart,$Enabled[Not $m_bRecoRunning])
GUICtrlSetState($btnStop,$Enabled[$m_bRecoRunning])
EndFunc
Auf Start klicken und ins Mikro "sprechen" ![]()