Mic Input properties - android

I'm developing audio app(iOS/Android), and I can't find nowhere information:
How can a app read or set the microphone gain?
Are audio Digital Signal Processing tools available for the headphone jack?
Also I realize that some manufacturers develop specific accessibility features (like mono sound mode, or sound balance (left - right) on samsung devices), but they don't provide any API to check or control this feature. When I turn on/off mono mode on Samsung GS3 in logs I see:
I/AudioHardwareTinyALSA( 1904): setParameters(toMono=0)
I/audio_wfd_hw( 1904): adev_set_parameters() toMono=0
So I guess this feature provided by samsung specific hardware driver.
May be in some way is possible to get pointer to AudioHardwareTinyALSA an set mono on or off?
Thanks.

There's no API in Android for controlling the input volume (you can mute/unmute the mic during voice calls / VoIP, but that's about the level of control that you've got).
The mic gains are typically set by the OEMs as part of their acoustic tuning process, in order to optimize the performance for each use-case (speech recognition, camera recording, handset call, etc) for that particular product.
Mono/stereo recording should simply be decided by whether the app requests 1 or 2 channels for the recording. At least that's the way it has worked on every product I've worked on, as far as I can recall.

Related

Sharing audio(Mic) input to multiple apps in Android

As per official documentation
Android 10 (API level 29) and higher imposes a priority scheme that can switch the input audio stream between apps while they are running. In most cases, if a new app acquires the audio input, the previously capturing app continues to run but receives silence. In some cases, the system can continue to deliver audio to both apps. The various sharing scenarios are explained below.
Other than some special cases, audio is not shared between apps.
But I have seen many apps sharing the audio input without being in the above special cases.
For eg. Zoom, when I'm on a call in zoom and start an audio recorder then both the apps are getting audio though zoom audio decreases in intensity.
Similarly, Omlet arcade is able to record mic audio even when mic access is given to other apps.
How is it possible? And as per the documentation, this shouldn't be allowed.
Update:
Was able to achieve it with the usage of Oboe. But it is not consistent on all devices. This also causes a sync issue in my live streaming app. Audio is audible with a delay
This is not possible in Android 5+ . You need a rooted phone to perform this action. In Omlet Arcade Whenever you play a Game and switch ON in-game mic, Omlet Arcade will stop receiving any audio input. However, Omlet Arcade will still function but you have to restart it in order to get voice input back.
Though, in a recent MIUI bug, People were able to listen to calls on Zoom and in-game mic apps. In your case, it might be not official Android and Edited Android like MIUI and OxygenOS

MediaRecorder.AudioSource.VOICE_RECOGNITION is available or not

I'm working on a project in which I have to use an Android Development Board, just like following, to record audio via MIC, specifically speech.
PandaBoard
BeagleBone Black
AM335x Evaluation Module
For my audio, from MIC, I want it to be filtered with background noise. I know I can apply some noise suppression algorithms to filter it but I want to use the built-in feature VOICE_RECOGNITION as audio source, this, to filter background noise.
AudioRecord audioRecord = new AudioRecord(AudioSource.MIC, SAMPLE_RATE, CHANNEL_CONFIG, AUDIO_FORMAT, minBufSize);
AudioRecord audioRecord = new AudioRecord(AudioSource.VOICE_RECOGNITION, SAMPLE_RATE, CHANNEL_CONFIG, AUDIO_FORMAT, minBufSize);
This, VOICE_RECOGNITION says:
Microphone audio source tuned for voice recognition if available, behaves like DEFAULT otherwise.
It says 'if available', it make sense that this feature is not available in all devices neither it is an Android OS part because if it is a part of OS, it should be available in all devices. It means, it is something related to hardware and all the manufacturer probably are not providing this feature.
My questions:
How I can know whether this feature is available or not before I go for purchase?
Is this feature is really related to hardware, as I assumed?
If this feature is not available in my respective device, How I can bring it on ?
NOTE: All the Android Development Boards, defined above, can run Android JellyBean 4.2.2.
NOTE: I have Samsung Galaxy S2 and this feature is available in it. Tested, works fine.
Any extra details would be appreciated.
Thanks
My understanding is the noise cancellation is achieved by utilising a 2nd dedicated mic which captures the ambient noise seperately. I believe the hardware related requirement is the presence of this dedicated mic.
Looking at tech specs for the Galaxy S2 you can see the feature noted as:
Active noise cancellation with dedicated mic
source: http://www.gsmarena.com/samsung_i9100_galaxy_s_ii-3621.php
As another example, the Nexus 5 mentions in the tech specs:
Dual microphones
source: https://www.google.com.au/nexus/5/
Thanks
VOICE_RECOGNITION has the least (often no) pre-processing. The default MIC input has the built-in processing.

Capturing audio frames from HDMI IN port

I have a rooted HiSense GoogleTV which has HDMI IN and OUT ports.
What I want to do is to record about 10 secs of the audio from the HDMI IN (from the set-top box). I am new to this, so please bear with me.
Is this possible to do this on a rooted device?
Does the HDMI data get decrypted (due to HDCP) after the HDMI IN and re-encrypted before it is routed out via HDMI out?
If I were to try to capture the audio frames on a regular Linux box, how should I go about it? What components should I look into? I cannot find any documentation that describes the low level architecture and details on how the HDMI IN signal gets routed to HDMI OUT.
Can you please point to the Android framework code that actually does this routing from HDMI In to OUT? Basically, want to understand the flow of what happens to the audio signal during the transfer from the HDMI IN to the OUT.
I am not sure if my questions make sense, but I hope you can give me some pointers on where I should start.
Short answer: Not possible. The pass-through is completely isolated from android via the Trusted Video Path SOCs. You need to be a certified SOC provider to get anywhere near the signal.
A HDMI input device should be identified as AUDIO_DEVICE_IN_AUX_DIGITAL (see audio.h), though I've never come across an Android device with HDMI input so I can't verify that.
Audio routing is handled by the AudioPolicyManager. There's an AudioPolicyManagerBase in libhardware_legacy, and then there's typically a platform-specific AudioPolicyManager implementation which overloads some of the base class' methods. Where this implementation is found depends on the platform. On Qualcomm platforms it's usually found somewhere under hardware/qcom/audio in the source tree.
The AudioPolicyManager performs high-level routing (like mapping stream types and audio sources to audio devices), and then uses the AudioHardware implementation and possibly other platform-specific classes to do the low-level routing (manage audio streams at the hardware level, load acoustic tuning parameters, interface with device drivers, etc).
Any HDMI input-related functionality is likely to be vendor specific, so might need the full source code for your Google TV device (i.e. including all patches that the vendor has applied on top of vanilla Android) if you want to be able to look at the code that handles HDMI audio input.
You will not be able to access either the video or audio input since Google TV implements HDCP. The only way to change that, even on a rooted device, is to change the Google TV code and probably also the SOC HDMI drivers, neither of which have been open sourced by Google.

How android call recorders apps works?

There are plenty apps in google play, which can record calls. Some of them just turn on loudspeaker and record sound via microphone, others should be able to record audio steams directly. I know that android provides class for recording. (which doesn't work on lot of devices probably because of some SW restrictions).
So here is my question: Is there possibility to find some device, where call recording will be possible via MediaRecorder(VOICE_CALL)? I found that call recording apps are available for Galaxy SII and SIII so does it means that MediaRecorder(VOICE_CALL) work on these devices?
EDIT------------
Generally, if i want to use MediaRecorder to record calls i need kernel which supports it (for example som custom kernel)?

Is it possible to access data / record from two (2) microphones in Android devices?

I am trying to access, programatically, the data received from 2 microphones on Android devices.
This arises several questions:
Are there shipping Android devices with 2 microphones (e.g. for stereo recording)? I know there are devices with 2 microphones for echo cancellation / noise reduction, but as far as I could find they can be accessed as a single microphone for any programatic purpose.
Are there devices with a microphone / headphone socket supporting stereo external microphones?
Assuming any of the above is positive, is there a way to know what is the currently operating microphone setup?
I will appreciate any response!
Thanks,
Yoav
I only found out that e.g. once you plug in wired headset with microphone it doesn't matter what AudioSource you specify in you code - it always give you the audio stream form headset mic. I tried to get access to internal mic using AudioSource.CAMCORDER but without luck. I haven't tried with wireless (BT) headset though. However if I plugin headphones (w/o mic) it uses internal microphone. At least this is the outcome on my SGS2 with ICS 4.0. If somebody find a workaround I would be happy to hear as well.
I haven't tried yet, but maybe the Native Developement Tools can allow you to access any microphone you want from low level.
If you want to make things a bit simpler, you could consider using OpenSL ES for Android, although i have no idea if it provides low-level microphone control.

Categories

Resources