Automatic Microphone

I have a problem that if we want to make an app in which if we speak to do a function, then the app does the function and then the app automatically turns off the microphone and when we speak, the app automatically starts the microphone. So, how can I write block code for that?

Hi,

I see you opening a number of topics at the same time and tagging them as bug-or-problem. But they are not so i removed that. You have a reading time of 4 minutes on the community. Can you tell what your knowledge of App Inventor is at the moment? Did you follow some courses, watched some youtube movies, followed some tutorials, did you search the community for answers?

According to myself, I can develop an app which has more qualities than an basic app. Yes, I searched all the questions everywhere (Google, YouTube, Avishkar) but I did not get the answer of my questions. So, I put all my questions together and tagged them with the most suitable tag according to me.

I asked because you can find some topics about your subject on this or other communities.

Please tell how can I make a type of a parrot in which it runs one command at a time. Set Automatic off. Automation on when the user speak the Specified Word given by me and then recognize that Specified Word in background and then do the function according to that Specified Word and then automatically turned off the mic in MIT App Inventor?

And thanks a lot for your help

Please anybody tell me how can I make a block code in the way that the app runs one command at a time. Set the microphone automatic off after sometime. Automatic on when the user speak the Specified Word given by me and then the app recognize that Specified Word in background and then do the function according to that Specified Word and then automatically turned off the microphone after sometime in MIT App Inventor?

You were given several solutions. Maybe show what you have tried so far and what works and what not.

The above solutions didn't work. I tried all them. Or I not understand the main thing that you want to say.

Show what you have tried. Show the blocks you made. Offering solutions without you showing what you have done, and only saying that it doesn't work is not how it works.

1 Like

MIT App Inventor only import .aix extension files.

What you hope to do is impossible with App Inventor. App Inventor apps normally cannot run in the background and your app as you describe must do that.

  • app runs one command at a time. AI Blocks can do that.
    -Set the microphone automatic off after sometime. AI Blocksi can do that
  • Automatic on when the user speak the Specified Word given by me. AI cannot do that if the SpeechRecognizer is turned off or the app sleeps. The SpeechRecognizer cannot run as a Service (in the background) using Blocks. It might not be possible to run the SR in the background even using some of the experimental extensions that purport to run some functions in the background. I know of no example.
  • and then the app recognize that Specified Word in background. Impossible
  • and then do the function according to that Specified Word . It cannot elicit the function because the SpeechRecognizer and the app cannot run in the background
  • and then automatically turned off the microphone after sometime in MIT App Inventor . as above

You might modify your expectations and be happy with what can be done. ou might be able to modify the first link provided by Peter. Alternatively, learn to program with the professional Android Studio that might be able to do what you want. App Inventor certainly cannot.

To get help to do some of what you want to do, share what you tried. :cry:

This is the code I tried.
Screenshot (28)
I want that SpeechRecognizer runs in the background when the app is active. And also SR does the function on a specified word. If we speak anything then SR automatically starts and then if the said words matches with a specified word, then do the function according to the specified word and if the said words do not match with a specified word, then SR does not do anything.

Sorry what you want @Sarthak is impossible as mentioned previously. The SpeechRecognizer cannot run in the background.

What is possible is something like this running while the app is active:

SR_Commands2

The example works using a Clock but there are ways to coded without it. Perhaps you can adapt this to your needs.

Can you please send the extension for more clearity.

The example does not use an extension to use the SpeechRecognizer to control and command the Buttons shown. The example works without an extension. An extension is not required to do most of what you say you want your app to do. If you want to try the example, please code it and try.

  1. What have you tried? All the required Blocks are provided in post #14.

  2. To build the app use the provided Blocks but first place the following components on your Designer Screen:

  • Button1 - to ask the SpeechRecognizer to listen manually if the Clock prompt fails (it might fail on some occasions).
  • Button2 - to provide a Button that changes color to red or blue
  • Button3 - to provide a Button that changes color to orange or green
  • Label1 - to display the words the SpeechRecognizer 'hears' when you speak
  • Label2 - to display this message: "The commands this example knows are: \nturn button red and turn button blue\n turn button orange and turn button green"
  • SpeechRecognizer
  • a Notifier
  • a Clock
  1. Create the Blocks shown in the example image on your Blocks screen.

  2. Check for coding errors.

  3. Run the finished example in your Android using Companion or create the apk and load the compiled app on your Android and test.

  4. Run the app. Speak clearly and say something. You should see your words in Label1

  5. What happens?

  6. Experiment then get the app running the way you want it to. App Inventor can not build a Service app to do your Project using Blocks. The app cannot run in the background. The example does some of the things you would like it to do.