android-audiomanager

How to Text-to-Speech plays on Bluetooth in Android?

杀马特。学长 韩版系。学妹 提交于 2021-02-19 05:24:22
问题 I'm a newbie for android. I've created an app that can read Incoming messages using Android Text-To-Speech. Up to now its fine with it. Now user's want It has to play over paired Bluetooth. I'd read all the forums but i didn't get it. Now how i play my TTS engine on Bluetooth ? Anyone having any idea ? Thanks in advance. 回答1: Use my answer at Using the Android RecognizerIntent with a bluetooth headset And create a speak method like below protected void speak(String text) { HashMap<String,

Access microphone in android 9 while the app is in the background

无人久伴 提交于 2021-02-17 05:24:07
问题 Android 9 limits the ability for background apps to access user input. If your app is running in the background on a device running Android 9, the system applies the following restrictions to your app: Your app cannot access the microphone or camera. Is there any way to access microphone in android 9 while the app is in the background. 回答1: One more change was added in Android 9: only apps running in the foreground (or a foreground service) could capture the audio input. Reference: https:/

Is it possible to ignore plugged in Headset and still use phone speakers?

蹲街弑〆低调 提交于 2021-02-11 13:38:32
问题 I would like to use the Phone Speakers while a Headset is plugged-in, instead of the Headset-Speakers. Is it possible to do that? if yes, how can I achieve it? I'm developing an App in Java for Android 9 . Detection if Headset is Plugged in works so far: public class HeadsetIntentReceiver extends BroadcastReceiver { private String TAG = "HeadSet"; public HeadsetIntentReceiver() { Log.d(TAG, "Created"); } @Override public void onReceive(Context context, Intent intent) { if(intent.getAction()

Android Audio Record to wav

微笑、不失礼 提交于 2021-02-11 08:32:06
问题 I recorded an audio using the audio recorder on Android and it produces a raw PCM file. I'm trying to convert it to a format I can listen to (wav or mp3 for example. I've started with this example but don't know where to go from here: Android AudioRecord example tried following these: http://computermusicblog.com/blog/2008/08/29/reading-and-writing-wav-files-in-java Recording .Wav with Android AudioRecorder Here is my code to record (note I am using Countdown Timer to tell it when to start

How can i get the minimum volume?

泪湿孤枕 提交于 2021-02-10 04:21:56
问题 I know that code below is the max volume mAudioManager.getStreamMaxVolume how can i get the minimum volume? I used this code but not the minimum volume mAudioManager.getStreamVolume(0); This my code int Minvolume=myAudioManager.getStreamVolume(0); int current=myAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC); int volume=(int) (current-1); if (current>=Minvolume){ myAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, volume, 0); handler.postDelayed(this, 10000); System.out.println(

Why My Recorded Audio Bit rate is always Zero when recording with Mediarecorder Android

荒凉一梦 提交于 2021-02-07 18:25:35
问题 I have an app which records Audio and saves it in SD Card.When i check the Recorded Audio's the bit Rate of the recorded Audio files are always Zero (0 kbps).The file format is MP3. Below is my code mRecorder = new MediaRecorder(); mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); mRecorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT); mRecorder.setOutputFile(mFileName); mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT); mRecorder.setMaxDuration(60000); mRecorder