Sunday, November 29, 2015

Focusrite Scarlett 6i6 and Pulseaudio

Oh, pulseaudio, how do I love thee...

The Focusrite Scarlett 6i6 is a 2 Mic, 2 Line, 2 Digital input, 4 Line, 2 Digital output audio interface and is presented to the Linux machine as a 12 output, 6 input USB2.0 class compliant soundcard. Strange, but that's what it is. Now, pulseaudio, not very smart in the first place, gets confused and only ever wants to use this card as a "multichannel" output, with outputs 1/2 deprived of bass, and output 6 (typically mapped to the s/pdif output) being a subwoofer. Not useful when listening over headphones.

After looking through the non-existing pulseaudio-documentation regarding udev, and searching on the web, I've came up with a workaround. This is at least useful to use the card as a normal stereo output.

To get output on the 2nd headphone output, use alsamixer to map Master 2L and Master 2R source to PCM1 and PCM2. The same applies to the S/PDIF output (Master 3L/R).




Bug filed.

➜  ~  cat /usr/share/pulseaudio/alsa-mixer/profile-sets/focusrite-scarlett-6i6.conf 
; Based on native-instruments-traktor-audio10.conf

;
; Focusrite Scarlett 6i6 has 6 physical inputs/outputs
; Inputs
;  2x  Microphone/Line on front
;  2x  Line on back
;  2x  S/PDIF coaxial on back
; Outputs
;  2x  Headphone (Out1/2, Out 3/4) on front
;  2x  Line on back (Out 1..4)
;  2x  S/PDIF coaxial on back
;
; It's presented as a 6 input, 12 output interface to the PC, so
; we have to create some mappings. Actual routing is configurable
; in ALSA mixer. I prefer a 1:1 mapping to physical outputs.
;

[General]
auto-profiles = no

[Mapping analog-out]
description = Analog Outputs
device-strings = hw:%f
channel-map = left,right,aux0,aux1,aux2,aux3,aux4,aux5,aux6,aux7,aux8,aux9

[Mapping analog-in]
description = Analog Inputs
device-strings = hw:%f
channel-map = left,right,aux0,aux1,aux2,aux3
direction = input


[Profile output:analog-out+input:analog-in]
description = Analog Duplex
output-mappings = analog-out
input-mappings = analog-in
priority = 100
skip-probe = yes

➜  ~  cat /etc/udev/rules.d/99-pulseaudio-local.rules 

SUBSYSTEM!="sound", GOTO="pulseaudio_local_end"
ACTION!="change", GOTO="pulseaudio_local_end"
KERNEL!="card*", GOTO="pulseaudio_local_end"
SUBSYSTEMS=="usb", GOTO="pulseaudio_local_check_usb"

LABEL="pulseaudio_local_check_usb"

##
# The Focusrite Scarlett 6i6 only runs as 12 playback and 6 capture channels!
# (mappable using the internal mixer)
# Bus 002 Device 004: ID 1235:8012 Focusrite-Novation Scarlett 6i6
##
ATTRS{idVendor}=="1235", ATTRS{idProduct}=="8012", ENV{PULSE_PROFILE_SET}="focusrite-scarlett-6i6.conf"

LABEL="pulseaudio_local_end"

Monday, November 02, 2015

Behringer "X-Air" XR18 Teardown

Here's a teardown of a Behringer XR18 (sometimes spelled X18R) Compact Digital Mixer. There's a full album with all pictures I took.

To open the device, you have to remove the rubber bumpers on the sides (which can be replaced with rack-ears). Two of the tiny screws on each side don't have to be removed, this lets the bottom shell of the case keep more mechanical strength. Then two halves slide open, an L-shaped top-plus-front-side part, and the rest enclosing sides, bottom and back side.

From Behringer XR18 Teardown

In the inside, you can find the power supply, a digital board (+ analog outputs) and a stack of three boards mainly responsible for the analog mic/line inputs. The topmost board (which I didn't remove because it's attached to the case by all the XLR connectors) mainly has connectors and the headphone amp. The middle board carries circuitry for the actual mic preamp. The bottom board has a few opamps and the ADCs for the analog inputs.

From Behringer XR18 Teardown

Power Supply


Generally the manufacturing is pretty nice and everything looks produced to tight tolerances. I could see no gaps, nothing loose. The only downside I see is the powersupply and the mains connector: The supply gets very hot during normal operation (and no devices running on phantom power were connected during the few hours it was in operation before opening the case). The mains connector is isolated with an additional layer of sticky tape, and fastened with hot glue. This looks rather sloppy.

From Behringer XR18 Teardown

Interestingly Behringer (the Music Group) designed their own supply!

From Behringer XR18 Teardown

Digital/DSP (+analog output) PCB

People are generally annoyed by the lack of support for WPA/WPA2 with the builtin WiFi access point. It's essentially a Microchip MRF24WG0MB Module

From Behringer XR18 Teardown

The USB audio interface seems to be powered by a XMOS 16L7C10 1000 MIPS, 128 kB SRAM, 32-bit multicore microcontroller and its associated Microchip USB3340 Enhanced Single Supply Hi-Speed USB ULPI Transceiver.

From Behringer XR18 Teardown


The actual user-facing functionality obviously is orchestrated by a Freescale MCIMX253DJM4A i.MX25 400 MHz, single core, ARM 926EJ-S, the network is connected with a standard Microchip LAN8720A Small Footprint RMII 10/100 Ethernet Transceiver.

From Behringer XR18 Teardown

From Behringer XR18 Teardown

The eight XLR analog outputs are fed by a CS4385 Cirrus Logic octal 24 bit DAC, the CS4272 Cirrus Logic 24 bit stereo audio codec feeds the headphone output and digitizes the line input (ch 17/18). [it's the only ADC/DAC left after accounting for the 8 analog outputs and 16 analog inputs and corresponding octal converters].

From Behringer XR18 Teardown

Routing of signals probably is taken care of by the logic inside this Xilinx XC6SLX4 (Spartan 6) FPGA. It's the smallest of the Spartan 6 family -- and while it has 216 kBit of blockram and 8 "DSP Slices" which feature multipliers, adders and accumulators, I doubt that it does any computational work. Maybe it scales the output level or so, though...

From Behringer XR18 Teardown

There's a truckload of New Japan Radio Corporation NJM4580 Dual Opamps used inside the XR18, and
a bunch of them seem to take care of driving the differential XLR analog outputs.

From Behringer XR18 Teardown

Mic/Line ADC


The most interesting chip on the ADC board (bottom-most in the three-board stack) is the Cirrus Logic CS5368 octal 24bit ADC. There are two of them, for 16 inputs in total. There are also a bunch of NJM4580 (1+1/2 for each channel), likely for a final level adjust and to drive the differential inputs of the ADCs.

From Behringer XR18 Teardown

Mic Preamp


The board with the mic preamps is rather interesting. The layout seems to be a conventional frontend using discrete transistors as first stage amplification and a NJM4580 as a differential amplifier. There are two Coolaudio V411 analog switches per channel to adjust the gain, and quite a few shift registers to provide the control inputs to the analog switches.

From Behringer XR18 Teardown

From Behringer XR18 Teardown

From Behringer XR18 Teardown

From Behringer XR18 Teardown

Connector PCB

The connector PCB is very uninteresting. One very thoughtful detail, though, is that they drilled holes beneath the XLR/TRS combo jacks. If you ever had to desolder one of those because the TIP of a TRS connector broke off you appreciate this. I did not remove this board, because it's held in place by dozens of screws on the XLR jacks.

From Behringer XR18 Teardown

A OPAMP labeled JRC8074A seems to be the headphone amplifier.

From Behringer XR18 Teardown