I want to make an app that makes it possible to connect an iPod or mp3 player to my Android device and let the Android speakers function as external speakers.
The ideal situation would be to actually read from speaker output so I can connect a stereo mini jack cable.
Is it possible to read from the headset output with the Android SDK?
A second option would be to use a mono mini jack instead. I could maybe directly read from microphone and output as a music player. Although, having to use a mono mini jack would be a huge disadvantage, because most people don't own such a cable.
UPDATE
For my second option I found this link that would let me take a special adapter onto a stereo cable so the iPod output can go into the mic input. It's a TRRS adapter. This works, but still isn't the ideal solution to me. http://www.techlife.net/2012/12/add-an-audio-input-to-android.html
ANOTHER UPDATE
I did a test with only a mono cable, but it seems that the mic is not recognized, so I really need the TRRS adapter to make sure that the mic is on. I found some apps that can help me with measuring input volume. I think I can achieve my goal for myself with the adapter, but reading from headset output would be nicer and could actually result in building an app.
You need to understand some basic things...
Audio output lets you "take audio out of your device".
It's not audio input that would let you "insert audio signal into your device".
So the concept that you've presented cannot work, because this socket is not able to receive audio signal through normal stereo jack cable (and connector).
You could try to make it work with a device that supports the headphones/mic set (it's a different kind of 3.5 mm jack connector). It's so called TRRS (four-conductor). But to use it in your project you probably would need some cable/socket soldering and maybe even some sort of microporcessor to help processing the signals.
Related
Long story short, I just wanted to know if it's possible (and how) to have as audio input some external device (like USB microphone) but at the same time, as output the device's speaker/s ?
Use case example : video conference.
I managed to make it work only one of the two.. I noticed that in order for the USB microphone to work I have to use audioManager.setSpeakerphoneOn(false), which obviously is not of much help in my case since I need the speakers to output the conference audio streams.
Thanks in advance for any guidance into this.
Sending audio to the speaker for playback on Android is easy, but is it possible to get a copy of the actual final digital signal? Let's say I have 2 apps running "MyApp" and "SomeOtherApp". My app sends audio to the speaker, but so does "SomeOtherApp". "SomeOtherApp" is not my app - it's a 3rd party app. Is it possible to get a copy of the mixed audio signal which is played to the speaker by the OS? That is, the audio signal which is a mixture of the speaker signal from my app and the speaker signal from "SomeOtherApp".
To summarize: I am looking for a way to hook into the low-level audio path (HAL audio stream out - after mixing!) so I can get a copy of the "final" speaker signal (in real-time). Optimally, I would also like to hook into the low-level microphone path, but that's less of a concern right now.
Looks like the short answer is no.
Longer one is kinda. And sorta. But not really, as far as I know. Option 1: it might be a problem with respects to privacy. (not really a good option) Option 2: nobody thought it was needed, so did not build it into the system. Option 3: the amount of trouble shooting when programmers use the wrong source is just not worth it.
edit - You can, of course, record the input.
Checkthis one google example
Usage :
App will capture audio from android devices and playback on the same
device; the playback on speaker will be captured immediately
*
im receiving data from the microphone audio jack, every thing is fine until i connect a USB cable to the device (for power and charging needs). the mic input gets disrupted and instead of sine wave i only get noise. what is the cause of this? and what can i do?
This could be a software issue or it could be an issue with the hardware configuration. Any time you have a device connected by both the USB charger and an audio cable there's the potential for a ground loop to develop, which can give lots of interference. If your audio signal is already quite weak this could completely mask it.
Where is the audio coming from? Where are you charging from? Do you get the same issue if it's plugged into a laptop rather than a wall charger (or the other way round)? If you're using an auxiliary input cable from a sound source, can you instead use a standalone microphone?
How do I force the Android system to select the 3.5mm Jack as my microphone source? I am using the AudioRecord class to do the recording.
I am using an external Microphone. When it is detected all works well, but sometimes the external microphone is not detected automatically. A TRRS splitter (cheap $3 thing) is used to split the 3.5mm Jack into separate Mic and Headphone jacks (I need simultaneous recording and playback).
The AudioManager.setWiredHeadsetOn() is deprecated and instructions say not to use it.
1) Do I maybe need additional external hardware to provide the correct microphone impedance?
2) Can I force the input in code?
3) Can a custom ROM archive audio control at this level - maybe this is the best option?
Thanks
It is very likely a hardware issue. Samsung phones seem to require a microphone with impedance of around 1.0k - 1.5k Ohm. Try modifying the input mic line by adding a series resistor to raise the impedance. Check out this link for details on how to do this: xdadevelopers - External mic on Galaxy 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.