Android continuous voice recognition - java

I am currently trying to implement android voice recognition for a research project that I am currently working on. I was able to follow a guide and I am able to correctly receive input but I want the phone to continuously look for input instead of telling me to try again after a while. I want to use it to control a moving robot connected to the phone meaning that I won't be able to physically touch the screen. Right now I made it so that if speech is recognized and converted then it immediately calls promptSpeechInput() again but I can't seem to find a way to do that when it runs out of time.

Related

what can be used instead of getMaxAmplitude for a MediaPlayer?

recently, I've been trying to create a visual recorder and player inside my android application, I want it to be like the SoundCloud sound waves.
so far, I've created one for the recorder using a customized view that makes lines after the last one with the height that would be given by mediaRecorder.getMaxAmplitude each 100ms.
the problem is that, unlike MediaRecorder, MediaPlayer doesn't have getMaxAmplitude, so when users play recorded files they won't see sound waves correctly.
However, I tried to search about this but the answer that I found was not the right one, It just gives me the volume level of the user's mobile.
thanks to anyone who could help to solve this problem.

Insert voice instructions to android application

I'm developing an application in android studio for the first time (written in Java).
Since it is gonna be an application for children, one feature I want to have, is a character who will guide them on what to do - for example:
Press here to open the box
I want it to be vocal and also textual since not all the kids know how to read yet.
I've searched for a way to insert audio into the application for each instruction I want to have, but I'm not sure it is the "smartest" way to do it.
Also, I'm not sure how to do that automatically without the need to press start/resume/stop for operating the audio file.
Which way would be the correct way to do this? and how exactly can I implement it?
Use text-to-speech engine build inside android.
https://developer.android.com/reference/android/speech/tts/TextToSpeech
https://www.javatpoint.com/android-texttospeech-example

How to create a box for user input and then store it as a variable in Android Studio

I'm totally new to Java and Android Studio. I wanted to know how to create a box dialogue or whatever the correct term is to create a box where the user can type and whatever he writes will be stored under a variable?
Context: I'm creating a home security device. The purpose of the app would be for the user to insert their phone number so they could get SMS notifications on the state of their doors that is monitored by external sensors on a Raspberry Pi. Once I know how to take in user input in Android studio and save it under a variable I can then save it to a file and using Python read from that file and then do whatever I need to with the phone number. Ideally, I understand this would have been done in just Java but learning another language with my novice understanding at this stage is too slow to make this project happen on time, hope you understand and ignore my lack of knowledge in this area.
Thanks ahead!

How to check if specific external app is used in foreground

I am building an app which runs in the background and I want to display a short text but only when for example the user is checking images on Instagram. So I need to check if Instagram is in use and then put the message in some kind of if statement.
How do I check if a specific app is currently used in the foreground? I searched around but can only find old posts with codes that are not supported anymore.
I am new to building apps so can someone please explain me how to accomplish this?

Read current audio output - Android

I want to know if it is possible to access the audio that is currently playing on the Android device.
Example: if Spotify is running in the background, I want to access the audio to control some LEDs that are connected to my RaspberryPi.
I want to create some sort of equalizer that changes colors depending on the sound that is currently playing. I appreciate if some one could tell me if accessing the main audio output is possible or not.
Unless you are using a rooted phone, it's not possible to capture output of a random app on Android.
You can however create an app that plays media files and captures the output for the purpose of visualization with "Visualizer" effect. You can take a look on the sample here: https://android.googlesource.com/platform/development/+/master/samples/ApiDemos/src/com/example/android/apis/media/AudioFxDemo.java
(look for "Visualizer").
If you are using Raspberry Pi anyway, you can just play all your music through it, capture and analyze it there. You will need an external USB sound card though. See for example this post: http://www.g7smy.co.uk/2013/08/recording-sound-on-the-raspberry-pi/
There they just record and play audio back, but you can insert an analysis phase in between.

Categories