====== Audio recording with wireless mic on Android ====== {{ android-external-mic.jpg?320|Connecting a Wireless Microphone to an Android Smartphone}} Recording audio using an **external microphone** connected to an **Android device** can be a real nightmare. We tried the hard way using a Chinese, no-brand, **wireless UHF microphone**! We can group the problems you can face in three main categories: * Physical connection * Electrical compatibility and hardware autodetection * Software capabilities and settings ===== Physical connection ===== Most Android devices have a **3.5 mm jack** accepting a **TRRS connector in CTIA standard** and every brand of mobile phones produces **headsets** with their own standard. The vast majority of solutions uses **electret microphones** requiring a **bias current**, but use **some combinations of impedence** to detect the insertion of the microphone and to **handle the headset button** (or buttons). So, connecting an external microphone, can be as simple as making a cable that connects the **ring** and the **sleve** of the **CTIA connector** to (respectively) the **ground** and the **microphone line** of the microphone. The hard part is to guess, or empirically try, if the microphone **requires a bias current**, if the Android device is provinding such a current and if the microphone produces a sufficient **output level** (actually a voltage in the order of the millivolts) that can be used by the device. ===== Electrical compatibility and hardware autodetection ===== As stated above, the first problem is **powering the microphone** itself, because generally we will use an **electret** one. It is a **common practice** to provide the power on the same line of the microphone signal, so **requiring just two wires** for both power (from the device to the mic) and for signal (from the mic to the device). The power, also called //bias current//, is generally in the range of **2.5** to **5.0 volt**. On a Xiaomi Mi A1 smartphone, which has a **TRRS 3.5 mm jack, CTIA standard**, we measured a bias current of **2.19 volt** between the microphone (sleeve) and the ground (ring). Another parameter which should be considered is the **impedence**, but unfortunatelly it is generally **impossibile to find documentation** about what is expected by the smartphone and what is offered by the microphone. ===== Software capabilities and settings ===== Wishing to connect the **UHF microphone** to an **Android smartphone**, we prepared an **adapter cable**. From 3.5 mm jack TRRS male to 1/4" jack TS female, with this pinout: ^ 1/4" TS female jack ^ Signal ^ 3.5 mm TRRS male jack (CTIA) ^ | | Not connected | **Tip** | | | Not connected | **Ring** | | **Sleeve** | Ground | **Ring** | | **Tip** | Microphone | **Sleeve** | The smartphone **did not sensed the microphone**, there is not much documentation about it, but it seems that the **autodetection** of the microphone is **based upon the impedence** of the mic itself, if it is too low, it is not detected. Once completed the electrical connection and acknowledged that **automatic detection of the external microphone does not work**, I decided to use the **[[https://play.google.com/store/apps/details?id=com.nordskog.LesserAudioSwitch|Lesser AudioSwitch]]** app, which allows switching between the internal speaker/microphone and the external headset/mic by a button tap. To realize the electrical connection explained in the above table, I used a **mic/headphone splitter cable**: the CTIA 4-poles male jack goes into the smartphone, the headphone female jack is left unconnected, the mic female Jack is connected to a **self-made adapter cable** featuring a 3.5 mm TRS male jack and a 1/4" TS female jack. Finally the UHF receiver is connected using the 1/4" jack. To record audio I used the **[[https://f-droid.org/en/packages/com.github.axet.audiorecorder/|Audio Recorder]]** v.3.3.11 app from the F-Droid repository (free software, GPLv3 license). Into the Settings menu I choosed the **Unprocessed** recording source instead of mic, this gives raw audio data, without automatic gain applied etc. (see [[https://developer.android.com/guide/topics/media/mediarecorder|Android MediaRecorder overview]]). The resulting recording is quite good: a **48 kHz 16 bits** file with good sound quality and low noise.