I have a android tab(Samsung Tab S) running lollipop, when I connect a external usb Microphone(mono) to it for recording, android still uses inbuilt mic.
How can I record from external mic instead of inbuilt mic. Is it supported?
Related
I have a multichannel microphone connected to an android phone (pixel 3) through usb. I'm trying to use MediaRecorder API for recording audio. However, there doesn't seem to be a way to setup multichannel recording with MediaRecorder even though Android USB audio documentation seems to say it allows multichannel input. I know recording multi channel audio is possible, as there are apps that already do that (see ntrack). I'm trying to figure out how to do this and hoping it doesn't involve writing usb driver (like these developers).
If you can see your microphones as separate input devices using audioService.getDevices(AudioManager.GET_DEVICES_INPUTS) then you can use the AAudio API (preferably using Oboe library) to access each of these microphones by opening stream for each.
I'm trying to use RecognizerIntent for speech input and have the audio come from an external USB microphone. Since I'm using a development board, there is no internal mic. Is it possible to set USB microphone as default Audio input? Maybe use tinyalsa to set sound card? I know you can record using MediaRecorder via USB, but that doesn't work with Speech Recognition API.
I'm using Android 5.1.
Thanks
I'm considering building an Android app that allows for streaming audio via bluetooth to and from the Android phone. I've read similar questions on Stackoverflow before, and based on my understanding, A2DP cannot be used as Android can't become an A2DP sink.
In theory, I believe that a profile such as HFP or HFP AG should allow for bidirectional audio streams. In the Android API, is there a way to force a bluetooth pairing to follow this profile, or does the OS decide which profile to use (such as forcing HFP only when there's a phone call going on)?
I've been able to achieve what I wanted using RFCOMM-based SPP. In order to send audio to the external device, I use the AudioRecord API to record PCM-16 audio to stream audio realtime over Bluetooth. In order to receive audio, I spawn a thread that is responsible for outputting audio to the speaker using the AudioTrack API (in streaming mode)
I have a weird setup where I am trying to record audio from an external device using a TRRS male-male audio cable. The way it is supposed to work, I plug in the audio cable to the device, then to the phone then use AudioRecorder to record in audio. On my HTC One M8 everything works great and I can record audio from the device. On my Samsung Galaxy S2 it records audio but from the internal mic.
I confirmed the issue is with the impedance of the mic input. If I add a resistor to the audio cable to increase the mic impedance then the S2 will record from the device correctly.
So my question is: Is there anyway to force Android to use the external mic jack? I looked into sending the ACTION_HEADSET_PLUG intent with the microphone set to -1 for external, but fail due to permission errors. It seems this intent was moved into protected permissions (https://github.com/android/platform_frameworks_base/commit/8f014059d3084fcce9e82b4b1f8b8323744ac52d)
So is there any other way to force the phone to use the mic jack without external hardware?!
Thanks!
Also, for the actual audio recording, settings are:
44100kHz sample rate
16 bit samples
Mono channel
Buffer is set to AudioRecord.MinBufferSize()
I'm working on an Android program whose purpose is to record a sound signal and then to analyse it.
To record this sound signal, I am using a special microphone I want to plug to my Android device directly via the audio line-in, so I won't use the mobile phone microphone.
Here is what I found on Android website :
" Defines the audio source. These constants are used with setAudioSource(int).
Summary
Constants
int CAMCORDER Microphone audio source with same orientation as camera if available, the main device microphone otherwise
int DEFAULT Default audio source
int MIC Microphone audio source
int VOICE_CALL Voice call uplink + downlink audio source
int VOICE_COMMUNICATION Microphone audio source tuned for voice communications such as VoIP.
int VOICE_DOWNLINK Voice call downlink (Rx) audio source
int VOICE_RECOGNITION Microphone audio source tuned for voice recognition if available, behaves like DEFAULT otherwise.
int VOICE_UPLINK Voice call uplink (Tx) audio source "
It seems that there is no way to define the line in as an audio source. I have tried to plug my own microphone to my mobile and then to record the sound, hoping that it will recognize my own microphone (as a handfree kit) but it keeps recording on the mobile phone microphone.
Does anyone know what to set as an audio source so I can use the line-in ?
Many thanks in advance !
You made some assumptions which might not be correct. Regular android phones have no Line Ins.They are not designed to be professional audio systems.
When you plug your headset, android automatically recognises your external MIC and you dont need to set it in your code.Just leave it in DEFAULT.
The problem is, you will need an special and compatible connector for your MIC. As you might notice the headset connector for your mobile is different from an streo Jack.So you will need an adapter or solder your own compatible Jack.If you connect your MIC with two parts, android will assume that its a headphone and not a MIC!
Here is the link to article: How do I use an external microphone with my Galaxy Nexus?