Testing Voice Recognition App ~ Audio Out to Mic In Adapter - android

I'm developing an Android voice recognition app for my master thesis.
The app comes with different algorithms that transcribe voice.
To test which of them works best I want to feed the devices microphone with the same speech sample over and over again. I decided to use an open audio book from http://www.librivox.org.
I need an adapter to feed the audio book into my devices microphone input port since the Android VD (Emulator) does not support microphone input.
I have tested a direct connection:
AUDIO OUT (LAPTOP) ─────┐
├─[SPLITTER]─────HEADSET PORT (Device)
─────┘
* Splitter
This does sometimes work on my Sony Xperia ZL even though the quality is really bad.
I also tried an iRig instead of the splitter - but I think the input for the iRig is only for guitars' line out.
So: Is there a way to feed some audio output to my Android devices microphone input?

Although I didn't manage to feed my real device's mic with audio from my laptop I found a solution.
THE DIGITAL WAY
Step 1: To test my app I now use an Android-x86 in a VirtualBox on Ubuntu.
The Android-x86 is a Cyanogen modded Android 4.4 running on (virtual) machines and has microphone support (contrary to the original Android AVD). I tried this on Windows 8.1 but the mic stayed silent.
Step 2: I have to map my main audio output channel to a virtual audio input (virtual microphone). I mostly followed the instructions of this answer using PulseAudio, PulseAudio Volume Control and the magic command: sudo modprobe snd_aloop
Step 3: Set "Monitor of Built-In Analog Stereo" in PulseAudio Volume Control to standard device. Then set the Host Audio Driver to ALSA and run the machine.
THE ANALOG WAY
However I'm not giving up on the cable thing and will update this answer onSuccess().

Related

How to detect if device has 3.5 mm audio jack?

I've gone through many posts and forum articles but didn't find anything related to my requirement. Lots of new android devices are coming with no headphone jack built in and I don't need to deal with those devices.
Through PackageManger I could only detect feature AUDIO_OUTPUT.
Is there any effective way from which I can check whether 3.5 mm audio jack exists in device?
I don't think it is possible that the app can determine if a device has a 3.5 mm audio jack.
From: https://source.android.com/devices/audio/usb#hostApplications
the line:
There are no APIs specific to USB digital audio.
Doesn't give me much hope especially as in that same document earlier mentions when talking about TRS Mini (audio jack) and USB Audio:
Note: This is an artificial comparison, since a real Android device would probably have both options available.
Which may have been true when the document was first written but as you've noted now less guaranteed.
A scan of the Android Compatibility Definition Document shows in Android CDD Section 7.8.2 Audio that no distinction is made between a 3.5mm audio jack and USB audio connection.
One suggestion is to submit a feature request to the Android Issue Tracker with as detailed use case as to why the legacy headphone jack should be a feature flag.

Using Android as Audio Input Output

I Have an Android and Windows 7 setup and my audio socket is not functional on my windows 7 machine, I want to use my android as a replacement for my audio socket enabling me to connect external audio devices such as headsets or speaker using Bluetooth or preferably USB connection. Is this possible? I saw some article about using the phone as mic(input), but non so far for using it as input/output.
Install for example JetAudio(with jetCast plugin) on windows 7 device, on jetCast create steam, on Android device you can used already existed radio player or crate your own Online radio streaming app for Android.
Easy way.

Unable to record from USB microphone on Chrome on Android (Lollipop)

Based on previous thread, getUserMedia is supported in Chrome on Android now (version 40).
I got this working using the usual getUserMedia idiom (see, for example, http://www.html5rocks.com/en/tutorials/getusermedia/intro/).
This works on desktop (any mic) and on mobile (default mic).
However, when a USB mic is plugged in, this does not seem to work. The usual permission dialog is shown. However, the input audio will actually come from the phone's default mic (ie, scratching/tapping the usb mic produced no noise), even though the USBmic is clearly connected (ie, it lit up).
On desktop, you can fix this by selecting the audio input source, but I'm not sure how to do that on Android.
The really funny thing is that typical audio recording APPs can actually CORRECTLY get the audio input from the USB mic on the same device.
Has anyone experienced this problem?
I can reproduce this issue it appears to be specific to some Android phones and Android tablet devices that I have tested, including a Samsung Tab A7 and the Amazon Fire 10".
Currently testing Samsung Tab A7 with Chrome 103.0.5060.129 Android 11; SM-T220 Build/RP1A.200720.012
I do not have this issue in chrome on my Android Oneplus 8 running Android 11.
More information for reproducing:
The expected behavior does not work in Chrome, but does work as expected in Firefox.
Plug in an external USB microphone device
Open a site such as https://vdo.ninja/ or a https://www.webrtc-experiment.com/
Capture audio.
The default audio will be captured from the devices internal microphone instead of the USB microphone.
On sites such as the vdo.ninja, where you are able to select the audio source, even if the source is listed, such as "Wired Headset", changing the input will result in using the internal microphone.

Android Capture USB Mic Audio without root

My Android application is targeting non-rooted Samsung Galaxy Note 2 phones running Android 4.4.2.
When my USB microphone is plugged into the phone, it appears as /dev/snd/pcmC1D0c, so I know it is being recognizing as an audio capture device.
Is there a way to capture the Audio from this device into my app without rooting the Galaxy Note 2?
I tried AudioRecord with all the MediaRecorder.AudioSource options and they all use the phone's internal mic.
I did not find any option in Settings/Sound to change the input device.
I investigated Samsung's Professional Audio SDK and it looked very promising until I found the Galaxy Note 2 device I am targeting is unsupported by this SDK.
If there is no way to access it from Java, is it possible to use native c code (JNI) to access the existing tinyALSA driver and capture the audio without rooting the phone?
I know I can use use libusb to capture the audio packets directly, but I was hoping for an cleaner/easier way since the phone already recognizes my audio input device.

Is there ANY android emulator that supports microphone input?

So far I haven't been able to find any solution that would allow me to test voice input via microphone on the android emulator.
I have been able to get away during development by limiting my testing to cheap Android phones (sorry, I don't have much money) but now some users complain that my app doesn't work on Android 3 and 4.
So, I am desperately looking for an Android emulator (that can run on Windows 7) to help me test my microphone-based app on various Android versions (did I say fragmentation?)
Is there any android emulator that supports microphone input?
Other suggestions that can utilize the standard Android "emulator"?
As you noted, the live-android (with this HowTo) is outdated, so as far as I can tell, you have only one (free) option that goes up to Android 4: Android x-86 on a USB thumb drive plugged into another netbook or laptop you have.
The only problem I see is that a standard Android USB cable for connecting your debugger will not work because netbooks or laptops don't have a micro USB connector like real Android devices have.
This is an old question so the answers here need updating.
All of the emulators included in the AVD manager (Eclipse/Android Studio) support microphone input now, although the ARM versions don't really have a sample rate that matches reality. The microphone inputs x86 based emulators work really well, but only at 8kHz.
There is a new kid on the block called Buildroid for VirtualBox (formerly VirtualBox-AOSP). This may be what you are looking for.
Thanks to Babu for this solution. Emulator can supports virtual input and record sound same like laptop

Categories

Resources