Académique Documents
Professionnel Documents
Culture Documents
End Sub
Private Sub RELOJABAJO_Tick(sender As Object, e As EventArgs) Handles
RELOJABAJO.Tick
IMAGEN.Location = New Point(IMAGEN.Location.X, IMAGEN.Location.Y +
50)
End Sub
Private Sub RELOJATRAS_Tick(sender As Object, e As EventArgs) Handles
RELOJATRAS.Tick
IMAGEN.Location = New Point(IMAGEN.Location.X - 50,
IMAGEN.Location.Y)
End Sub
Private Sub RELOJADELANTE_Tick(sender As Object, e As EventArgs)
Handles RELOJADELANTE.Tick
IMAGEN.Location = New Point(IMAGEN.Location.X + 50,
IMAGEN.Location.Y)
End Sub
End Class
Video YouTube
Codigo:
Form1
Imports System.Speech.Recognition
Imports System.Runtime.InteropServices
Public Class Form1
<DllImport("user32.dll", CharSet:=CharSet.Auto,
CallingConvention:=CallingConvention.StdCall)> _
Public Shared Sub mouse_event(dwFlags As
Integer, dx As Integer, dy As Integer, cButtons As
Integer, dwExtraInfo As Integer)
End Sub
PUNTOX, PUNTOY, 0, 0)
mouse_event(MOUSEEVENTF_RIGHTUP,
PUNTOX, PUNTOY, 0, 0)
End Sub
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(sender As Object, e As
EventArgs) Handles Timer1.Tick
Select Case PALABRA
Case "para"
Timer1.Enabled = False
Case "arriba"
PUNTOX = Cursor.Position.X
PUNTOY = Cursor.Position.Y - VELOCIDAD
MOVERMOUSE()
Case "abajo"
PUNTOX = Cursor.Position.X
PUNTOY = Cursor.Position.Y + VELOCIDAD
MOVERMOUSE()
Case "izquierda"
PUNTOX = Cursor.Position.X - VELOCIDAD
PUNTOY = Cursor.Position.Y
MOVERMOUSE()
Case "derecha"
PUNTOX = Cursor.Position.X + VELOCIDAD
PUNTOY = Cursor.Position.Y
MOVERMOUSE()
Case "intro"
CLICKIZDO()
Timer1.Enabled = False
Case "doble"
CLICKIZDO()
CLICKIZDO()
Timer1.Enabled = False
Case "rapido"
VELOCIDAD = 50
Label2.Text = VELOCIDAD
Timer1.Enabled = False
Case "lento"
VELOCIDAD = 2
Label2.Text = VELOCIDAD
Timer1.Enabled = False
Case "normal"
VELOCIDAD = 10
Label2.Text = VELOCIDAD
Timer1.Enabled = False
End Select
End Sub
End Class
01-Reconocimiento de Vo…
CODIGO:
Hay que importar la Referencia System.Speech:
Proyecto > Agregar Referencia > Ensamblados > Framework > System.Speech
FORM1
Imports System.Speech
Imports System.Speech.Recognition
Imports Microsoft.VisualBasic.FileIO
Public Class Form1
Dim REC As New SpeechRecognitionEngine
Dim SYNT As New Speech.Synthesis.SpeechSynthesizer
Dim PALABRA As String
Dim CONTADOR As Integer = 0
Dim MIARRAY(CONTADOR) As String
Dim DICCIONARIO As String = Application.StartupPath & "\DICCIONARIO.txt"
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
End Sub
Public Sub DETECTA()
End Sub
Public Sub RECONOCE(ByVal sender As Object, ByVal e As SpeechRecognizedEventArgs)
Dim RESULTADO As RecognitionResult
RESULTADO = e.Result
Dim PALABRA As String
PALABRA = RESULTADO.Text
Select Case PALABRA
Case "hola"
SYNT.Speak("nice to see you again")
Case "entrada"
BORRAR()
Label3.Text = "GUARDAR"
TextBox1.ReadOnly = False
TextBox2.ReadOnly = False
TextBox1.Visible = True
TextBox2.Visible = True
Case "consulta"
BORRAR()
Label2.BackColor = Color.Red
TextBox1.Visible = True
TextBox2.Visible = True
TextBox1.ReadOnly = True
TextBox2.ReadOnly = True
ES_EN()
Case "guardar"
BORRAR()
If TextBox1.Text = "" Or TextBox2.Text = "" Then
Beep()
Else
My.Computer.FileSystem.WriteAllText(DICCIONARIO, TextBox1.Text.ToLower &
vbCrLf & TextBox2.Text.ToLower & vbCrLf, True)
SYNT.Speak("saved")
Label3.Text = "ENTRADA"
TextBox1.Text = ""
TextBox2.Text = ""
TextBox1.ReadOnly = True
TextBox2.ReadOnly = True
TextBox1.Visible = False
TextBox2.Visible = False
End If
Case Else
TextBox1.Text = RESULTADO.Text.ToUpper
For I = 0 To CONTADOR - 1
Try
If MIARRAY(I) = RESULTADO.Text Then
TextBox2.Text = MIARRAY(I + 1).ToUpper
SYNT.Speak(MIARRAY(I + 1))
Exit For
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
Next
End Select
End Sub
Public Sub BORRAR()
Label2.BackColor = Color.Black
Label3.BackColor = Color.Black
End Sub
Public Sub ES_EN()
Dim INGLES As New GrammarBuilder
Dim filename As String = DICCIONARIO
Dim fields As String()
Dim delimiter As String = ","
Using parser As New TextFieldParser(filename)
parser.SetDelimiters(delimiter)
While Not parser.EndOfData
' Read in the fields for the current line
fields = parser.ReadFields()
' Add code here to use data in fields variable.
For I = 0 To fields.Count - 1
If fields(I) <> "" Then
ReDim Preserve MIARRAY(CONTADOR)
MIARRAY(CONTADOR) = fields(I)
CONTADOR += 1
End If
Next
End While
Try
INGLES.Append(New Choices(MIARRAY))
REC.LoadGrammar(New Grammar(INGLES))
SYNT.Speak("go ahead")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Using
End Sub
End Class
CODIGO:
Imports System.Speech.Recognition
Imports System.Speech.Synthesis
Imports System.Runtime.InteropServices
Public Class Form1
Dim REC As New SpeechRecognitionEngine
Dim SYNT As New Speech.Synthesis.SpeechSynthesizer
Dim DISTANCIA As Integer = 0
Private Const APPCOMMAND_VOLUME_MUTE As Integer = &H80000
Private Const APPCOMMAND_VOLUME_UP As Integer = &HA0000
Private Const APPCOMMAND_VOLUME_DOWN As Integer = &H90000
Private Const WM_APPCOMMAND As Integer = &H319
<DllImport("user32.dll")>
Public Shared Function SendMessageW(ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal
wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
End Function
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
"wa=wsignin1.0&rpsnv=11&ct=1332586469&rver=6.1.6206.0&wp=MBI_SSL_SHARED&wreply=htt
ps:%2F" +
"%2Fmail.live.com%2Fdefault.aspx%3Fmkt%3Des-
us&lc=2058&id=64855&mkt=es-us&cbcxt=mai")
NAVEGADOR.Visible = True
NAVEGADOR.Url = WEB
Text = "correo".ToUpper
Case "yutube"
Dim WEB As New Uri("http://www.youtube.com/")
NAVEGADOR.Visible = True
NAVEGADOR.Url = WEB
Text = "yutube".ToUpper
Case "impara"
Dim WEB As New Uri("http://imparagratis.com/")
NAVEGADOR.Visible = True
NAVEGADOR.Url = WEB
Text = "impara".ToUpper
Case "abajo"
DISTANCIA = DISTANCIA + 500
NAVEGADOR.Document.Window.ScrollTo(0, DISTANCIA)
Case "arriba"
DISTANCIA = DISTANCIA - 500
NAVEGADOR.Document.Window.ScrollTo(0, DISTANCIA)
Case "silencio"
SendMessageW(Me.Handle, WM_APPCOMMAND, Me.Handle, New
IntPtr(APPCOMMAND_VOLUME_MUTE))
Case "sonido"
SendMessageW(Me.Handle, WM_APPCOMMAND, Me.Handle, New
IntPtr(APPCOMMAND_VOLUME_UP))
Case "atras"
NAVEGADOR.GoBack()
Case "adelante"
NAVEGADOR.GoForward()
End Select
End Sub
'ESTO SON OPCIONES PARA MANEJAR EL VOLUMEN
'Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
' SendMessageW(Me.Handle, WM_APPCOMMAND, Me.Handle, New
IntPtr(APPCOMMAND_VOLUME_UP))
'End Sub
'Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
' SendMessageW(Me.Handle, WM_APPCOMMAND, Me.Handle, New
IntPtr(APPCOMMAND_VOLUME_DOWN))
'End Sub
'Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
' SendMessageW(Me.Handle, WM_APPCOMMAND, Me.Handle, New
IntPtr(APPCOMMAND_VOLUME_MUTE))
'End Sub
End Class
26 comentarios:
Hola amigo creador de este blog, necesito una ayuda urgente referente a este tema, descargue
el codigo pero no me funciona, que herramientas debo tener instaladas para el reconocimiento
de voz, descargue el SAPI (SpeechSDK51) de la pagina de microsoft y tengo visual .net 2005 -
2008 y en ninguno me funciona... tengo el sistema operativo windows xp, sera por eso que no
funciona. tiene que ser en windows 7, dime cuales son los requerimientos que pide para que
este codigo de reconocimiento de voz funcione.
Responder
Respuestas
Hola William:
Efectivamente el reconocimiento de voz no funciona en XP. En XP funciona la voz de
síntesis (Text to Speech) que permite que lea un texto pero no el reconocimiento de
voz (Speech Recognition). Necesitas Windows7. Con windows7 no necesitas
descargar nada. Solo agregar la referencia Speech y aplicar el código tal como esta
aquí.
En cuanto a Visual Studio te recomendaría que te bajes al menos Visual Basic 2010
Express, ya va por 2013. Es gratuito.
Saludos.
Responder
Amigo yo tengo visual basic 2008 express pero con windows xp, pero pregunto si con vb2008
funciona igual en windows7, ya que el codigo lo coloque en vb2008 y no tenia ningun error, el
unico error es al ejecutar sobre el idioma del reconocimiento de voz con el del sistema
operativo. para asi probarlo en windows 7. lo que quiero hacer es que el usuario utilice el
microfono para decir cierta palabra, y compararla para ver si es correcta la palabra que se esta
diciendo por microfono. me imagino que se puede hacer con este ejemplo.
Responder
Respuestas
Hola William:
El XP no tiene reconocimiento de voz de origen. Se que hay formas de añadírselo
pero yo nunca lo he intentado. Mira este enlace.
http://support.microsoft.com/kb/306537/es
No conozco VB2008. Este proyecto fue realizado von VB2012 en Windows7 y no
creo que funcione en versiones anteriores. O sea que no creo que te funcione en
VB2008 aunque lo pongas en Windows7.
Hay otro proyecto que se parece mas a lo que quieres hacer. El Juego Pasapalabra,
en este mismo blog. Mañana colgare el código y el proyecto completo. Aunque
también esta hecho en VB2012 y W7.
Saludos.
Responder
Responder
Hola gracias por tu aporte, ahora yo quiero ir un poco más, pensando en la gente ciega, que el
programa pudiera leer lo que se ve, si bien entra todo el tema de interpretar el html, para lograr
poder interactuar con la web, tienen algun proyecto de este estilo, estoy buscando información
de como poder ayudar a las personas ciegas a poder navegar en internet, y he visto muchos
programas que en realidad no son muy utiles si se ve desde el usuario ciego. Cualquier
sugerencia me puede servir. Soy programador .net en vb.net y me gustaría poder desarrollar
algo que pueda ayudar
Mi correo gonzalo@nucleoe.com
Responder
Respuestas
Hola Gonzalo:
Lo que planteas es muy interesante.
La Web, con toda su carga multimedia, no esta pensada para personas ciegas. Por
tanto, lo primero seria crearles una especie de" Web" para ciegos. Por ejemplo: Un
agregador de noticias, un agregador de música,...., etc. A partir de ahí, jugando con
el Reconocimiento de Voz y con el Texto a Voz, se podría crear una bonita aplicación
para ciegos.
O sea, puedes hacer un Agregador de Noticias a 2 niveles: 1)Titulares,2)La noticia
detallada.
La persona ciega puede decir "NOTICIAS" y el Texto a Voz puede leerle los titulares.
Si dice "ENTRAR", el Texto a Voz, puede leerle la noticia detallada. Lo mismo con la
música. Etc.
Googleando un poco he encontrado esto:
http://www.xsonar.com.ar/
Llevar una cosa asi a .NET no es complicado aunque si puede ocupar tiempo.
A tu disposición.
Saludos.
Responder
Responder
Hola. Quería consultarte porque he creado una aplicación en Visual Studio 2010 target 4.0 pero
me tira error "La cadena de entrada no tiene el formato correcto" cuando intento usar cualquier
método del objeto SpeechSynthesizer. Pero si a la misma aplicación le cambio el target a 3.5
funciona correctamente. Sabes cuál puede ser el error?
Responder
Respuestas
Responder
tengo una pequeña pregunta, bueno problema, para el codigo del 01- Reconocimiento de Voz y
Texto Hablado con Visual Basic (VB.NET) en la parte del vocabulario, como podria hacer que
en esta parte :
en ves de escribir "entrada", "consulta" y todo eso, estuviera en una base de datos y que de la
base de datos se importaran esas frases a esa parte del codigo?
por favor si pudieras ayudarme te lo agradeceria mucho
Responder
Respuestas
Responder
y como seria para ponerle un contador en el codigo del programa del jugando con el
reconocimiento de voz, asi como hacer un puntaje para ver cuantos a destuido, por favor, te
pido, ayúdame
Responder
Respuestas
Responder
hola, excelente proyecto me llamo mucho la atencion, me gustaria saber que tipo de objetos
son SEÑAL, NAVEGADOR y los otros objetos que tienes en la ventana del form
Responder
Respuestas
Responder
hola maestro, podrias hacer cuando puedas un pequeño ejemplo de dictado por voz.
que tenga para copiar, pegar eliminar etc. muchas gracias j.p
Responder
Responder
Respuestas
Responder
Responder
Respuestas
Responder
Sr. yo soy uno de sus fans y necesito que me ayude a mejorar uno de sus proyectos, es el de
reconocimiento de imágenes por voz de animales, para la introducción de texto
Responder
hola, como hago para que pueda reconocer oraciones , pues intento hacer y me sale palabra
por palabra, además que son palabras que no dije.
Saludos.
Responder
Introduce tu comentario...
Página principal
SPAM