I'm trying to record audio signals from 2 in-built microphone(bottom, top) at the same time. I can pick up bottom microphone signal using
MediaRecorder.AudioSource.MIC
and top microphone signal using
MediaRecorder.AudioSource.CAMCORDER
I can record separately but I want to record at the same time from 2 microphones.
Does anyone know how to record simultaneously?
I tried & or | operator but I can get only 1 channel signal.
I use Galaxy S2 device.
I will appreciate any response :)
Thanks in advance.
There is a misconception that in devices with 2 microphones, both the microphones will be used when recording in the stereo mode.
In my 3 years experience of testing on tens of devices, I have found that this was never the case.
The primary mic alone is used both in mono and stereo recording in the wide range of Android devices that I have worked with - from low-cost mass models to flagships.
One reason for this is that the primary mic is of a better quality (more sensitive, less noisy, etc.) and costlier than the secondary mic.
You can achieve this by doing a stereo recording using the AudioRecord (http://developer.android.com/reference/android/media/AudioRecord.html) class. Have a look at How to access the second mic android such as Galaxy 3.
Specifying the audio format as stereo and the audio source as the camcorder automatically selects two microphones, one for each channel, on a (compatible) two microphone device.
For example:
audioRecorder = new AudioRecord(MediaRecorder.AudioSource.CAMCORDER,sampleRate,android.media.AudioFormat.CHANNEL_CONFIGURATION_STEREO,android.media.AudioFormat.ENCODING_PCM_16BIT,bufferSize);
will initialise a new AudioRecord class, that can record from two device microphones in stereo in PCM, 16 bit format.
For more help on recording using AudioRecord (to record .wav), have a look at: http://i-liger.com/article/android-wav-audio-recording.
Related
Is it possible to play 2 different sounds simultaneously from 2 built-in speakers (1=main speaker, 2=earpiece speaker) on Android, preferably using Oboe C++ library.
In this thread, it was asked a similar question, but for 2 different audio devices. In my case, I just want to play on the same audio device but through 2 different speakers.
It was possible to record data from built-in microphones simultaneously using stereo channels. A similar approach for speakers didn't work.
Any help much appreciated, thank you.
Note:
The term Audio Device refers to a device capable of receiving or
sending audio. An audio device can have multiple microphones and/or
speakers attached to it, and these are represented as different
channels.
Debugging device is Google Pixel XL running Android 9
If the audio device has 2 speakers then you should be able to play different sounds through each speaker by supplying different data to each channel.
However, I believe the speakers you're referring to:
2 built-in speakers (1=main speaker, 2=earpiece speaker)
are actually 2 separate audio devices each with a single speaker. In which case you won't be able to use them at the same time, although hacks might be available to make the speakers part of the same audio device (I haven't tried this).
I am new to android development. I am trying to record an audio file in stereo mode. I have connected two external mics using 3.5mm jack.
The only problem is that my recording is done in mono mode. Both speakers sounds same. I am using inbuilt recorder app in my phone. Is stereo recording possible in smartphones using external mic? If so, do I need to code for stereo recording? And what libraries should I use?
Speak two different words, one to each microphone and try to figure out if both speakers are getting a "blend" of both sides or if you're only getting one of the mics, then post the results to get a more accurate answer.
Take a look at this question where the topic is discussed, maybe it has to do with the configuration in your source code.
I have a requirement where I need audio from both the mics on my android phone simultaneously in order to do some signal processing using Eclipse. Do you think it is possible to do this? Also can you suggest a method to start recording for both mics realtime simultaneously?
For two instances of class AudioRecord, if I pass audio source as MIC and CAMCORDER respectively, will I be able to capture two separate mic inputs simultaneously? I am not sure if the mics will work in parallel, and also do not know how to get them to start recording at the same time.
Any input regarding this will be appreciated. Thanks in advance!
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).
I'm currently starting writing a software for Android which is about to measure the reverberation time of closed rooms.
I had to choose AudioRecord instead of MediaRecorder because it gives me the chance to get the raw data.
You may know that there are many different constant to choose from for the AudioFormat (e.g.: CHANNEL_IN_MONO, CHANNEL_IN_STEREO, CHANNEL_IN_PRESSURE) and you may know that in android smartphones there are more than just one microphone embedded (usually you have 2 microphones in it, in order to have noise cancellation and stuff like that).
Here comes the question: Which constant do I have to choose to be sure that only just ONE microphone is giving me the raw data?
If you do a mono recording the device should only be recording from one microphone. I'm not sure what you mean by "raw" data. There will always be some acoustic compensation processing done (e.g. automatic gain control, equalization, etc), and this is not something that you can turn off.
One thing that also will affect the recording is which AudioSource you choose. If you select CAMCORDER on a phone with 2 or more microphones you'll typically get the back microphone with far-field tuning if you do a mono recording. If you select MIC/DEFAULT you should get the primary mic, but it may be tuned for either near-field recording or far-field recording depending on the vendor (I suspect that you'd want far-field tuning if you're trying to measure room reverberation).