MediaRecorder.AudioSource.VOICE_RECOGNITION is available or not - android

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.

Related

How to change microphone for recording when handsfree is connected in Samsung devices?

I'm working with OpenSL_ES in Android, and having some issues with the mic source selection in Samsung devices when I connect earphones with handsfree.
The problem is that no matter what mic source I set in OpenSL_ES, the gain configuration changes but the mic is always the handsfree mic. In other words, I cannot use the device built-in mic when I connect a handsfree device.
I have tried:
Changing the mic source to all available sources:
//ioInternals.micSource = SL_ANDROID_RECORDING_PRESET_NONE;
//ioInternals.micSource = SL_ANDROID_RECORDING_PRESET_GENERIC;
ioInternals.micSource = SL_ANDROID_RECORDING_PRESET_CAMCORDER;
//ioInternals.micSource = SL_ANDROID_RECORDING_PRESET_VOICE_RECOGNITION;
//ioInternals.micSource = SL_ANDROID_RECORDING_PRESET_VOICE_COMMUNICATION;
//ioInternals.micSource = SL_ANDROID_RECORDING_PRESET_UNPROCESSED;
res = (*recorderConfig)->SetConfiguration(recorderConfig, SL_ANDROID_KEY_RECORDING_PRESET,&ioInternals.micSource, sizeof(SLuint32));
None of the above allows me to change source (only gain configuration)
Some where I've read that a "hack" could be set to SL_ANDROID_RECORDING_PRESET_NONE in OpenSL_ES and then use MediaRecorder class in Java to prepare a recorder while changing the mic sources (which are like 9) to check if one of them would make the phone change the source to the device built-in mic and so OpenSL_ES would take the default mic at the moment. This doesn't make too much sense as they are working in different contexts, but took the time to make a test, and MediaRecorder does not change the mic source when handsfree is connected neither.
An option I see is to develop my mic module in Jack library from Samsung assuming that library can change the mic source. However I'm not certain that it is possible.
Question:
Do you know how I can resolve this issue?
I have seen a few apps that manage to make this work, but I have no idea what they are doing to accomplish the task.

Audio quality issue when recorded with MediaRecorder

The audio recorded by MediaRecorder in android App having so much noise.How can I use noise suppression to remove noice while recording.
I had the same problem of low audio quality while using MediaRecorder and finally figured out the correct working solution. Here are few modifications you need to do for good quality audio recordings:
save the file using .m4a extention.
and
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mRecorder.setAudioEncoder(MediaRecorder.OutputFormat.AMR_NB);
mRecorder.setAudioEncodingBitRate(16*44100);
mRecorder.setAudioSamplingRate(44100);
Many solutions on stackoverflow would suggest .setAudioEncodingBiteRate(16) but 16 is too low to be considered meaningless .
Source: #Grant answer on stackoverflow very poor quality of audio recorded on my droidx using MediaRecorder, why?
Are you testing this with the emulator, or on an actual device (if so, which device)? The acoustic tuning (which includes gain control, noise reduction, etc) will be specific to a given platform and product, and is not something you can change.
Jellybean includes APIs to let applications apply certain acoustic filters on recordings, and a noise suppressor is one of those. However, by using that API you're limiting your app to only function correctly on devices running Jellybean or later (and not even all of those devices might actually implement this functionality).
Another possibility would be to include a noise suppressor in your app. I think e.g. Speex includes noise supressing functionality, but it's geared towards low-bitrate speech encoding.
https://developer.android.com/reference/android/media/audiofx/NoiseSuppressor.html
android voice recording - voice with background noice issue

How to access the second mic android such as Galaxy 3

A lot of smart phone now have more than one microphone. One for voice input and another for reducing the enviroment noise.
I am wondering how could I access the two microphone's signal independently? Or turn off one of the microphone?
Any thoughts or comments are welcomed. Thanks a lot.
I'm not familiar with the Galaxy S3 specifically, but the following is true for the majority of devices I've worked with:
There's no reliable way of selecting whether to use the primary or secondary mic for a mono recording. The MIC AudioSource usually means the primary mic when doing a mono recording, and the CAMCORDER source might mean the secondary mic. But there's no guarantee for this, because it depends e.g. on the physical placement of the mics.
Recording in mono effectively turns the other mic off, and whatever noise reduction is done uses only the signal from one mic (so there's little to no reduction of dynamic noise).
One exception to this might be if you record during a voice call where both mics already have been enabled in order to do uplink noise suppression.Another exception might be if you use the VOICE_RECOGNITION AudioSource, because some vendors apply noise suppression on the signal using one or more extra mics in this use-case.
Recording in stereo records from both mics on a 2-mic device. The left channel contains the input from one mic and the right channel contains the input from the other mic, but there's no guarantee as to which physical mic the channels correspond to (again, depends on the placement).

Mic Input properties

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.

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