Record and play sound from Android to a computer - Jack disconnects periodically / Jack undetected - Depending on Android version


Question

I would like to control audio IO of my android phone with a computer. I'm currently using a usb audio sound card with a input mic and line output ports connected to my computer. A phone is connected to an adapter jack 4 pins to 2 jack 3 pins (reference). The adapters mic input is connected to the sound card line output and the adapters line output is connected to the sound card mic input. Like this, I can theoretically record phones output with the computer and play a sound on phones input from the computer.


I have with me 3 phones devices, one android 10 (Redmi Note Pro 8) an other one is a android 9 (Samsung Galaxy A40), the last one is an android 4.0.3 (LG p700)


Everything works fine on the 4.0.3. The phone can detect the cable and I can record the phone output and play on the phone input.


But on the two others devices, it's not working.


On Android 9 : the phone can't detect the jack cable of the adapter, but when I plug earphones with mic (jack 4 pins), it's working. I think that isn't an hardware issue.


On Android 10 : the phone can detect the cable but changes state every seconds (detected/undetected). That means it is switching between earphone output and speaker output which is impossible to record or play. Like android 9, i can plug earphones, and it's working.


I personally think this may be related to phone impedance that is checked by recent version of Android.


What should I do to record and play on audio IO of a phone from a computer?


It's possible to me to develop an app on android and create a program on the computer to initialize the connection. Stereo recording isn't the objective here, mono will be enough.


(I cannot use in my case other protocol like USB or Bluetooth to record and play on phones)


EDIT 1 : Concerning OMTP/CTIA standards


To know the standard used by each device, I did this experimentation. On my previous setup, I’m able to find that it is a CTIA standard (found with an ohm-meter, mic and output line are separated). I know then my Android 4.0.3 is working with a CTIA standard.


I have with me wires, a sound card (reference), and jack 4 pin to wires adapters (reference) (the adapters are respecting OMTP standard but we don't care because we are using 2 of them)


Firstly, I created a normal DIY setup Normal DIY setup


This setup works fine for the Android 4.0.3. Then i guess my sound card is a CTIA standard. But unbelievably, it works fine with Android 9, and don't work with Android 10.


Now, I know that my sound card, Android 4 and Android 9 are all CTIA standard


Secondly, I decided to create a crossover cable setup. Like this, I will force an OMTP standard with a CTIA sound card.


Cross-over setup schema


As expected, this setup do not work on Android 4 and Android 9. But on Android 10, an headset without mic is detected. But I'm unable to listen/play a sound on the device. When I'm switching cable side on Android 10, the headset is periodically connecting/disconnecting like with the first setup (before edit).


To conclude, I guess that my issue isn't related to OMTP/CTIA but to the protocol used by devices to find plugged headset. With the Android 4, the jack port contains a little switch to know when a cable is plugged. On the others devices, this switch is present but do not have a direct impact on the detection of a headset. I guess the switch are used to launch a program that could detect the type of the audio device plugged (headset with mic, headset without mic...)


Answer

Ok, after many attempts, I have found where the problem lies.


TRRS is respecting a standard of electrical impedance.


Two difference configuration for headsets


This standard isn't respected by sounds cards, impedances were highly different.


I tried to simulate an headset only by using resistors.


Headset simulation


This jack is detected as headset on all my devices (Android 4.0.3, Android 9 and Android 10).


I found that the impedances are used here to find the type of headphones (TRRS or TRS), when the type is unknown, each phone acts differently. In old version, the audio port is enabled. In newer version, it's disabled.


Another info : depending of the usb connection of the phone and the sound card, noise could appear in the signal. This noise can be high enough to avoid its use.


To conclude :


In my case, I'm unable to create an electronical component that would take out the signal and send it to a jack. I created a solution that could record the signal from Bluetooth.


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes