Detecting pause in sound bytes from microphone in Flutter app - android

I came across this plugin -- https://pub.dev/packages/sound_stream -- on pub.dev while searching for a solution to listen to microphone from a flutter app (targeted for both android and iOS).
I am able to use this plugin to listen to user utterances from the microphone as well as playback audio when needed in my app. The requirements are as follows:
Listen to user utterances from the microphone,
Convert the audio byte stream received from the microphone into a base64 encoded string,
Send the audio string to a service by calling a REST API (POST),
Optionally, if the service responds back with audio (in form of a base64 encoded string), decode the audio output string, and play back the sound bytes.
All of these steps are working fine -- both on Android and iOS. However, in the MVP, I don't know how to detect a pause in user utterances (in the audio stream received from the microphone) and automatically trigger the REST API call. Currently my app requires the user to toggle the microphone button on and off in order to talk and then send their audio to the service. So, the user currently needs to tap on the microphone button (on my app) to activate the RecorderStream of the sound_stream plugin, speak and tap on the microphone button again to turn off the RecorderStream and at this point my app calls the API. It's like those walkie-talkies of the good old days!
I want to avoid this and seamlessly call the API when I detect a pause in the user speech and send the sound bytes received until then to the service. Any idea on how I might be able to achieve this?
Any tips will be highly appreciated.

Related

Detect other apps using the microphone android

I have an Accessibility service that processes the surrounding sound with a microphone, and a process runs every time the user says Hey.
The problem is that when I listen to the microphone in the background service, no other software can use the microphone.
One way is to listen to access events whenever an event is received from the software with a premium microphone and disable my application process for a short time. But this is a bit non-standard and does not work to some extent ... Is there a way to access the microphone in such a way that any other program can access the microphone at any time and my program will automatically receive sound ?? Something like channels in audio playback !!
Or the way I can hear that a program needs a microphone !!
Thanks ❤️

Stream an audio from server to my app

I want to stream an audio from the server to Android App. I found some solutions but my scenario is quite different.
I have an audio file which is uploaded to the server, I want to run that audio on a specific time and must be stop after audio complete.
Now let say a user opens his android app to listen an audio after one minute from the start time of that audio than he must listen audio from after one minute of audio running and could not listen that audio from back and forward.
Please guide me the to do it and which technologies should I use?
Would it be better you use Google Firebase or any Realtime server? or simple hosting will be a nice option ?
Thanks

Auto call and play an audio recorded message

I wish to make automated calls to a list of numbers to then play a recorded audio message to them. The ones that don't pick up get a call back later.
What's the cheapest and easiest way to develop this using some pre-existing tools? Any directions welcome.
Note: You can play back the audio data only to the standard output
device. Currently, that is the mobile device speaker or a Bluetooth
headset. You cannot play sound files in the conversation audio during
a call.
from the official docs
I ended up using automated flow apps (Automate [link below] is one such app that I used. Disclaimer: I've no affiliation with app) to trigger automated calls. The flow was initiate on a GCM notification to the phone, which provided the number for call. With all permissions granted and conditions fulfilling (network, sim, call credits, etc.), app should be able to make call to the number.
Now, I'm trying to figure out how to play an audio message for the receiver.
So, if you were looking for 'how' part, here's the how part. If you know the next steps, enlighten me!
https://play.google.com/store/apps/details?id=com.llamalab.automate&hl=en&gl=US

Background Audio for a Call in Progress - Possible?

I am writing a android app which is supposed to play back a audio file when a call is in progress coming from a specific number .. I tried many approaches.. but all went in vein
Separate Thread
Listener on Telephone service
starting a service in parallel
can any one please help me how to proceed regarding this ?
Update :
I am able to play a mp3 file on call recieve and i am able to play it load on speaker.. but how ever loud i play the calling party is not able to listen to it.... is there anyway i can push the speaker stream to call stream
From the api doc here
Note: You can play back the audio data only to the standard output
device. Currently, that is the mobile device speaker or a Bluetooth
headset. You cannot play sound files in the conversation audio during
a call.
So from this and lots of other so answers we can conclude that we can not play an audio during a call process.
But a long time ago from a personal experience with a handset I got a result where the audiotrack was playing while there was a call established and both the voices were heard at the same time. So I think this depends on handsets if it allows it then you can play.
You can try another thing experimentally. play the audio using a different route ( speakerphone or bluetooth).
Another option is to build your custom android build

reference for doing send audio file by offset android

i am making audio live streaming application. what i was doing before, i recoded voice/audio for certain time and i will push the stop button to stop the recording.
then i put action to send the video after clicking the stop button to server through internet. in here i am using socket programming. it works perfectly however i was not live streaming application.
i have heard about doing the code offset to send the audio file to make it live. it will send bytes by bytes of the audio to the server. however, so far i could not find any reliable tutorial/simple source code of how i would like to do it. does anyone knows where i could fine any reference regarding this method?

Categories

Resources