====== Audio Recording With GNU/Linux ====== ===== Choosing the right jack ===== ==== The microphone jack ==== In the 70s - at the time of analog amplifiers, in the pre-computer age - the standard jack for microphones were the mono one, with the diameter of **1/4 inches** (**6,35 mm**). Only two conductors were present: the **tip** for the **signal** and the **sleeve** for the **ground**. This is the so called **TS jack**: {{jack-mono-6.35mm.png?direct&220|Mono Jack 6.35 mm}} The natural evolution of that jack, is the **3.5 mm TS mono jack**: {{jack-mono-3.5mm.png?direct&140|Mono Jack 3.5 mm}} These jacks have only **two poles**, because they were used mainly with **dynamic microphones** (see below) which do not require any external power supply, or with **condenser microphones** with an **integrated battery**, where the battery is sufficient to provide the required power to the mic. With the advent of audio in personal computers, **electret microphones** have become very popular. Very often these microphones integrate a **preamplifier** that requires a **supply voltage** or they require a **bias current** necessary to power the internal Field Effect Transistor (FET) buffer; these currents are in the range of 2.5 - 5.0 volt. The solution adopted e.g. by the early Sound Blaster sound cards, was to use a **three poles microphone socket**, so requiring a **3.5 mm TRS jack** (**Tip**, **Ring** and **Sleeve**) despite the microphone being **mono**. Sometimes a separate pole for supplying the voltage is not available (e.g. when you want to connect a **stereo microphone** using a three poles **TRS** jack, or when you use a four poles **TRRS** jack for an **headset** with earphones and mic), so it is common practice to **supply the bias voltage through the tip, on the same connector for the microphone signal**. In the following picture you see the //de facto// standard imposed by Creative Labs in the 90s on their **SoundBlaster** audio cards (from [[wp>Sound_Blaster_16|SB16]] to [[wp>Sound_Blaster_AWE64|AWE64]]), and the **[[wp>AC'97]]** standard proposed in 1997 by Intel. Notice that the **bias current can be different**, varying from 2.5 to 5 V, and sometimes it can be controlled in software. {{mic-powered-jack.png?direct&420|Microphone jack with power supply}} ==== Socket on modern notebooks and smartphones ==== Recent **laptops** and **smartphones** have a **single 3.5 mm socket** for the headphones and the microphone. It requires a **TRRS** jack (meaning tip, ring, ring and sleeve) because it have to accomodate two audio lines, one microphone line and the ground. Unfortunatelly there exist **two competing standards** about the jack pinout, the **CTIA** and the **OMTP** one: {{trrs-ctia-omtp-standards.png?direct&320|TRRS CTIA and OMTP}} The **CTIA** (//Cellular Telephone Industries Association//) pinout is the one used in **modern smartphones**, whereas the //Open Mobile Terminal Platform// was used by old Nokia, Sony and Samsung phones (till 2012). ==== Headphone/microphone cable splitter ==== So if you have a recent notebook with the CTIA combined socket, yuo have to use a **cable splitter** to connect a standard microphone jack. Here it is the electrical schema of such adapter cable: {{headphone-mic-splitter.png?direct&480|}} ===== Dynamic, condenser and electret microphones ===== There are basically three types of microphones on the market: **dynamic**, **condenser** and **electret** ones. In the world of computers and smartphones, **the electret ones** are by far the **most common** type. ==== Dynamic ==== A small movable **induction coil**, positioned in the **magnetic field** of a permanent magnet, is attached to the diaphragm. The sound wave moves the diaphragm and the coil moves in the magnetic field, producing a varying current in the coil through **electromagnetic induction**. No power is required: the current is carried directly on **two poles** to the mic input. These microphones generally have a **1/4" mono jack**. ==== Condenser ==== The diaphragm acts as one plate of a capacitor, and the vibrations produce changes in the distance between the plates. The plates are biased with a fixed charge, so **the voltage maintained across the capacitor plates changes with the vibrations** in the air. This type of microphone **requires a power source**, provided either as //[[wp>Phantom_power|phantom power]]// by the equipment via microphone inputs or from a small battery inside the mic. Generally these type of microphones have an **[[wp>XLR connector|XLR connector]]** when they are intended to be connected to professional audio equipment, which will provide the phantom power. If they have an **internal battery** they may have the old **1/4" mono jack**. As it is easy to imagine, there are **many possible problems** regarding the supply of phantom power to dynamic microphones (which do not require it, but can be instead damaged by it) or to condenser microphones which have a power provided by a built-in battery. Problems are exacerbated in turn by audio devices that can supply or not such power and by mechanically compatible cables and connectors, but with incompatible electrical characteristics. ==== Electret ==== Unlike capacitor ones, electret microphones **do not require polarizing voltage**, but generally they contain an integrated preamplifier that **does require power**. In this cases a **TRS jack** can be used, where the ring carries power via a resistor from, normally, a 5 V supply in the computer (often incorrectly called //polarizing power// or //bias//). Generally these microphones built to be plugged into computers and electronic audio devices, have a **TRS 3.5 mm jack**, carrying the mic signal and the required current. ====== Wireless UHF microphone ====== We have purchased an **UHF wireless microphone** on Aliexpress.com for about 25 €. It is composed by: * The **transmitter** powered by **two AA batteries**, featuring: * A **[[wp>Lavalier microphone|lavalier microphone]]** on a clip. * One small **wire-antenna**. * Frequency range: **610-675 MHz** (53 channels spaced by 1.25 MHz each). * Modulation system: DQPSK * Frequency response: 60-16000 Hz * Transmitted power: 10 dBm * Working current: %%<=%% 100 mA * The **receiver** powered by **two AAA batteries**, featuring: * A 1/4" (6.35 mm) mono jack. * One small **telescopic antenna**. * Receiving sensitivity: -94 dBm * Working current: %%<=%% 100 mA {{wireless-mic-trasmitter.jpg?direct&240|}} {{wireless-mic-receiver.jpg?direct&240|}} To connect the **UHF receiver** to the **Ugreen USB audio adapter**, we built an adapter cable with this pinout: ^ 1/4" TS female jack ^ Signal ^ 3.5 mm TRS male jack ^ | **Tip** | Microphone | **Tip** | | | Not connected | **Ring** | | **Sleeve** | Ground | **Sleeve** | The **2.6 volt** current provided by the USB adapter on th **jack ring** will go nowhere (not connected). The **2.6 volt** current provided on the **jack tip** is probably not required by the UHF receiver, but **it should not harm**. **No infromation** is available about **microphone impedence** expected by the USB adapter, on the other hand no information is available about the **impedence of the mic interface** of the UHF receiver. Despite all this empirical approach, the **voice registration is quite satisfying**! See below about connecting the microphone to an Acer TravelMate notebook an to an Android smartphone. ===== Wireless mic on the Acer Travelmate TMB113-E ===== See this article about **[[audio_recording_tmb113_e]]**. ===== Wireless mic on Android ===== See this article about **[[audio_recording_android]]**. ===== Wireless mic on Ugreen USB audio adapter ===== See this article about **[[audio_recording_usb_adapter]]**. ====== Problem: silence gaps using a cheap USB dongle ====== I was **unable to use the microphone connector** on my Acer TravelMate, so I tried to use an USB dongle, marked **LinQ**. The device was detected by the Linux Kernel 4.9.0: usb 2-1.3: new full-speed USB device number 9 using ehci-pci usb 2-1.3: New USB device found, idVendor=0c76, idProduct=1607 usb 2-1.3: New USB device strings: Mfr=0, Product=1, SerialNumber=0 usb 2-1.3: Product: USB Headphone Set input: USB Headphone Set as /devices/pci0000:00/0000:00:1d.0 /usb2/2-1/2-1.3/2-1.3:1.3/0003:0C76:1607.0004/input/input92 hid-generic 0003:0C76:1607.0004: input,hidraw2: USB HID v1.00 Device [USB Headphone Set] on usb-0000:00:1d.0-1.3/input3 {{ linq-usb-audio.png?direct&100|LinQ USB audio dongle}} The USB audio adapter worked quite nicely at playing audio, I use it on a QNAP TS-120 NAS, transformed into a media player installing Debian GNU/Linux on it. The Linux kernel and the **ALSA audio subsystem** works well on setting the levels for **playback**. Once started Audacity, I was able to select the microphone line of the USB dongle as a **capture device**: {{audacity-select-usb-audio.png?direct&260|}} Recording a sample track revealed an annoying problem: about **every 0.4 seconds** you can see a **gap of silence** in the audio track of about **two hundredths of a second**. The audio track is unusable! {{audacity-track-gaps.png?direct&400|}} ====== Web References ====== * [[wp>Microphone]] * [[https://www.hobby-hour.com/electronics/computer_microphone.php|Computer microphones]] * [[https://www.techiehq.net/threads/mic-input-to-pc.61676/|Mic input to PC]] * [[http://www.shure.com/americas/support/find-an-answer/will-bias-voltage-from-a-computer-effect-a-dynamic-microphone|Will bias voltage from a computer effect a dynamic microphone?]] * [[http://www.epanorama.net/circuits/microphone_powering.html|Powering microphones]] * [[https://forum.xda-developers.com/showthread.php?t=2072612|External Mic on Galaxy Devices]] * [[https://stackoverflow.com/questions/19255908/android-forcing-external-microphone-jack-input-3-5mm-to-stay-on|Android: Forcing external microphone (jack input 3.5mm) to stay on]] * [[https://forum.xda-developers.com/showthread.php?t=1042051|App that turns off microphone AGC (Auto-Gain Control)?]] * [[https://stackoverflow.com/questions/47394634/difference-between-voice-communication-and-mic-in-mediarecorder-audiosource|Difference between VOICE_COMMUNICATION and MIC in MediaRecorder.AudioSource]] * [[https://stackoverflow.com/questions/47359587/what-is-the-best-audiosource-setting-for-calls|What is the best audiosource setting for calls?]] * [[https://amp.reddit.com/r/androidapps/comments/4wo8sz/app_to_force_android_to_use_external_microphone/|App to force android to use external microphone when one is plugged in]]