B4A Library SpeechRecognitionNoUI - google speech recognition without popup

Discussion in 'Additional libraries, classes and official updates' started by Brandsum, Aug 13, 2019.

  1. Brandsum

    Brandsum Well-Known Member Licensed User

    No. You cant use this for continuous listening. Search for continuous speech recognition library.
     
  2. Robert Valentino

    Robert Valentino Well-Known Member Licensed User

    Tried this in my music app. Wanted to be able to shout Music Skip, Music Play, Music Pause, etc

    Problem is it is always beeping and if I turn off the beeps the music gets paused.

    Tried to change the code to not mute the music volume but then it beeps.

    Code:
    Public Sub StartListening(LANGUAGE As String, ONLY_RETURN_LANGUAGE_PREFERENCE As Boolean, PARTIAL_RESULTS As Boolean,PREFER_OFFLINE As Boolean)
       RecognizerIntent.Initialize(
    "android.speech.action.RECOGNIZE_SPEECH",Null)
       RecognizerIntent.PutExtra(
    "android.speech.extra.LANGUAGE_PREFERENCE",LANGUAGE)
       
    If ONLY_RETURN_LANGUAGE_PREFERENCE Then RecognizerIntent.PutExtra("android.speech.extra.ONLY_RETURN_LANGUAGE_PREFERENCE",LANGUAGE)
       RecognizerIntent.PutExtra(
    "calling_package",Application.PackageName)
       RecognizerIntent.PutExtra(
    "android.speech.extra.LANGUAGE_MODEL","free_form")
       RecognizerIntent.PutExtra(
    "android.speech.extra.PARTIAL_RESULTS",PARTIAL_RESULTS)
       RecognizerIntent.PutExtra(
    "android.speech.extra.PREFER_OFFLINE",PREFER_OFFLINE)
       
       
       
    If nosound Then
           
    Dim p As Phone
           volA = p.GetVolume(p.VOLUME_ALARM)
           volM = p.GetVolume(p.VOLUME_MUSIC)
           volN = p.GetVolume(p.VOLUME_NOTIFICATION)
           volR = p.GetVolume(p.VOLUME_RING)
           volS = p.GetVolume(p.VOLUME_SYSTEM)
           volV = p.GetVolume(p.VOLUME_VOICE_CALL)
           
           p.setVolume(p.VOLUME_ALARM,           
    0,   False)
    '       p.setVolume(p.VOLUME_MUSIC,           0,   False)  - comment out to not stop music from playing
           p.setVolume(p.VOLUME_NOTIFICATION,   0,   False)
           p.setVolume(p.VOLUME_RING,           
    0,   False)
           p.setVolume(p.VOLUME_SYSTEM,       
    0,   False)
           p.setVolume(p.VOLUME_VOICE_CALL,   
    0,   False)
       
    End If
       
       JO.RunMethod(
    "startListening",Array(RecognizerIntent))
    End Sub
    A shame that we can't change the underling library to not do the beeps, because it works real well.
    Music playing does not seem to effect the listening for commands
     
  3. Brandsum

    Brandsum Well-Known Member Licensed User

    I dont think that you listen for voice input while playing something without the beep sound.
     
  4. Robert Valentino

    Robert Valentino Well-Known Member Licensed User

    OK, but it seems to work fine. The playing sound is coming out the ear plug jack into a amp and playing over external speakers.
     
  5. Brandsum

    Brandsum Well-Known Member Licensed User

    *without the beep sound.
     
  6. Brandsum

    Brandsum Well-Known Member Licensed User

    Because Android SpeechRecognizer use music channel to play the beep sound.
     
  7. Robert Valentino

    Robert Valentino Well-Known Member Licensed User

  8. Brandsum

    Brandsum Well-Known Member Licensed User

  9. leitor79

    leitor79 Active Member Licensed User

    Hi! Great library, thank you!
    Is there a way to get the raw audio?
     
  10. Brandsum

    Brandsum Well-Known Member Licensed User

    I don't think so.
     
  11. KZero

    KZero Active Member Licensed User

    language is always English , i tried ar-SA , it , fr

    all returning english
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice