Italian voice recognition in una text

fifiddu70

Well-Known Member
Licensed User
Longtime User
come faccio a prendere il risultato di voice recognition e metterlo in una editTex?
 

vb1992

Well-Known Member
Licensed User
Longtime User
B4X:
'Activity module
Sub Process_Globals
    Dim VR As VoiceRecognition
    Dim MyText as string
End Sub

Sub Globals

End Sub

Sub Activity_Create(FirstTime As Boolean)

    If FirstTime Then

        VR.Initialize("VR")
       
    End If

    Activity.LoadLayout("1")

'
'supportati
'
    If VR.IsSupported Then
        ToastMessageShow("Voice recognition is supported.", False)
    Else
        ToastMessageShow("Voice recognition is not supported.", True)
    End If

    VR.Prompt = "Say your message"  ' Parla il messaggio


End Sub

Sub Button1_Click

 ' chiamate l'attività di riconoscimento vocale esterno. Evento risultato sarà sollevata.

    VR.Listen 'calls the voice recognition external activity. Result event will be raised.

End Sub

Sub VR_Result (Success As Boolean, Texts As List)
 

If Success = True Then

        ToastMessageShow(Texts.Get(0), True)

MyText = Texts.Get(0)
      

'   SendMyText
Dim i As Intent
i.Initialize(i.ACTION_VIEW, "sms:0123456789")  ' Phone Number | Numero di telefono
i.PutExtra("sms_body", MyText )
StartActivity(i)



End If


End Sub
 
Last edited:

fifiddu70

Well-Known Member
Licensed User
Longtime User
grazie per la risposta, credevo che fossi rimasto solo su questo forum, adesso mi metto a lavoro e ti farò sapere.
 

fifiddu70

Well-Known Member
Licensed User
Longtime User
il tuo codice funziona, ma non e quello che volevo per esattezza :) in sostanza io volevo che alla fine del voice recognition, mi mettesse il risultato in una view e cioè in una editext che ho rinominato in txtsms. invece il tuo codice fa aprire un'altra schermata con il testo digitabile e le varie opzioni. spero di essere stato chiaro. comunque grazie in anticipo :)
 

fabio2222

Member
ecco questa ti risponde pure

#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region

#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region

Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim voce As VoiceRecognition
Dim parla As TTS
End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.

Dim Button1 As Button
Dim frase As String
Dim EditText1 As EditText
Dim tempo As Long
Dim orario As String
Dim ciao As String
End Sub

Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Activity.LoadLayout("parlare")
voce.Initialize("Voce")
parla.Initialize("parla")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub



Sub Button1_Click
voce.Listen

End Sub


Sub voce_result(success As Boolean, texts As List)
frase=texts.Get(0)
EditText1.Text=frase
If EditText1.Text= "saluta" Then
parla.Speak("Salve a tutti io sono fabiana ",True)



Else If EditText1.Text= "ciao Maria" Then
parla.Speak("ciao fabio sai suonare bene il clarinetto ",True)


Else If EditText1.Text= "ciao Jerry" Then
parla.Speak("ciao figghiozzo comu semu",True)
Else
parla.Speak("non ho capito",True)


End If

End Sub
 
Top