Focusrite Scarlett 18i20 2nd Gen mixer driver

Talk about your MIDI interfaces, microphones, keyboards...

Moderators: MattKingUSA, khz

User avatar
xkr47
Established Member
Posts: 11
Joined: Fri Jul 19, 2019 5:50 pm
Contact:

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Post by xkr47 »

cjoke wrote:I think this thread need a little update acording to focusrite scarlett 2 gen, since kernel version 5.4-rc1 the mixerdriver has been available. https://github.com/torvalds/linux/commi ... 3298309b3e 3

just clone and compile and have fun :slight_smile:
Good times indeed for 2nd gen owners. Was there any specific firmware requirements? Does it work in Linux out of the box or do you need to "boot it once in windows" to get it to work or similar? Is it possible you update the firmware in linux? (not specifically pointing the questions to cjoke, anybody feel free to respond :) )

User avatar
cjoke
Established Member
Posts: 14
Joined: Thu Jul 25, 2019 8:03 pm
Location: Norway
Contact:

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Post by cjoke »

xkr47 wrote:
cjoke wrote:I think this thread need a little update acording to focusrite scarlett 2 gen, since kernel version 5.4-rc1 the mixerdriver has been available. https://github.com/torvalds/linux/commi ... 3298309b3e 3

just clone and compile and have fun :slight_smile:
Good times indeed for 2nd gen owners. Was there any specific firmware requirements? Does it work in Linux out of the box or do you need to "boot it once in windows" to get it to work or similar? Is it possible you update the firmware in linux? (not specifically pointing the questions to cjoke, anybody feel free to respond :) )
Me and some other users had some problems and Geoffrey had some ideas about issues in firmware/serialnumbers before 30000. My firmware is around 12000, and I could not get it to work on my PC, but the same scarlett works on my laptop. So my guess it is something with how USB driver/controller speaks with the soundcard. Geoffrey sure can speak more in details on this issue, since Im noob :)
Love, people, music, beer and lot of other stuff.

User avatar
xkr47
Established Member
Posts: 11
Joined: Fri Jul 19, 2019 5:50 pm
Contact:

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Post by xkr47 »

Hi geoffrey,

I did a review of the driver code. Here are my findings so far:
  1. It seems to me that the scarlett2_device_info.ports array is indexed by the SCARLETT2_PORT_TYPE_* enums; if so there seems to be a bug in the 6i6 metadata; there is no entry for SCARLETT2_PORT_TYPE_ADAT, and in it's place is the next entry e.g. SCARLETT2_PORT_TYPE_MIX. Similarly using SCARLETT2_PORT_TYPE_MIX as index will give the values for SCARLETT2_PORT_TYPE_PCM. And finally using SCARLETT2_PORT_TYPE_PCM will give all-zero values. Below findings for potential bugs with 6i6 with above assumptions:
    1. This seems to affect scarlett2_usb_set_mix(), line 803 which thus gets the number "6" for num_mixer_in when the table suggests it should be 18. I cannot say which number is correct i.e. whether the data has also been updated in the wrong place to get it to work..
    2. scarlett2_usb_set_mux() probably affected
    3. scarlett2_mixer_ctl_put() uses num_mixer_in from wrong port type
    4. scarlett2_add_mixer_ctls() num_inputs and num_outputs from wrong port type
    5. scarlett2_init_routing() output_count = 0 and input_count = 0, so the inner for loops will not do anything
    I think the least error-prone way mitigation would be to initialize the ports array with C99 designators:

    Code: Select all

    	.ports = {
    		[SCARLETT2_PORT_TYPE_NONE] = {
    			.id = 0x000,
    			.num = { 1, 0, 8, 8, 8 },
    			.src_descr = "Off",
    			.src_num_offset = 0,
    		},
    		[SCARLETT2_PORT_TYPE_ANALOGUE] = {
    			.id = 0x080,
    			.num = { 4, 4, 4, 4, 4 },
    			.src_descr = "Analogue %d",
    			.src_num_offset = 1,
    			.dst_descr = "Analogue Output %02d Playback"
    		},
    		...
    
  2. Line 404 says:

    Code: Select all

    			/* S/PDIF outputs aren't available at 192KHz
    			 * but are included in the USB mux I/O
    			 * assignment message anyway
    
    but the manual of at least 18i8 lists S/PDIF outputs as available all the way up to 192kHz.. Is this a) comment in the code an error, b) a linux limitation or c) an error in the manual?

geoffrey
Established Member
Posts: 76
Joined: Mon Jul 30, 2018 2:08 am

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Post by geoffrey »

Hi xkr47,
xkr47 wrote:
cjoke wrote:I think this thread need a little update acording to focusrite scarlett 2 gen, since kernel version 5.4-rc1 the mixerdriver has been available. https://github.com/torvalds/linux/commi ... 3298309b3e 3

just clone and compile and have fun :slight_smile:
Good times indeed for 2nd gen owners. Was there any specific firmware requirements?
I did my development with an 18i20 firmware 1083 and an 18i8 firmware 1076. I haven't heard of other versions either working or not working.
xkr47 wrote:Does it work in Linux out of the box or do you need to "boot it once in windows" to get it to work or similar?
sysrqer reported that the 6i6 worked out of the box: viewtopic.php?f=6&t=19975&p=108076&hilit=6i6#p108153
xkr47 wrote:Is it possible you update the firmware in linux? (not specifically pointing the questions to cjoke, anybody feel free to respond :) )
Updating the firmware natively in Linux isn't possible.

Regards,
Geoffrey.

geoffrey
Established Member
Posts: 76
Joined: Mon Jul 30, 2018 2:08 am

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Post by geoffrey »

Hi xkr47,

Thanks very much for your review! I really appreciate you taking the time to go through the code.
xkr47 wrote:It seems to me that the scarlett2_device_info.ports array is indexed by the SCARLETT2_PORT_TYPE_* enums; if so there seems to be a bug in the 6i6 metadata; there is no entry for SCARLETT2_PORT_TYPE_ADAT, and in it's place is the next entry e.g. SCARLETT2_PORT_TYPE_MIX.
You are correct; well spotted! Please see https://github.com/geoffreybennett/scar ... t-gen2-5.4 for my proposed fix (I liked your suggestion to use designators).
xkr47 wrote: Line 404 says:

Code: Select all

			/* S/PDIF outputs aren't available at 192KHz
			 * but are included in the USB mux I/O
			 * assignment message anyway
but the manual of at least 18i8 lists S/PDIF outputs as available all the way up to 192kHz.. Is this a) comment in the code an error, b) a linux limitation or c) an error in the manual?[/list]
Most likely the comment is incorrect. The 18i20 manual says "the S/PDIF outputs are unavailable at 176.4/192 kHz sample rates" and I just presumed the same applied to the 18i8 without checking the manual or testing it. It'd be good to test this; make sure that 18i20 S/PDIF output doesn't work at 192KHz and the 18i8 S/PDIF output does work at 192KHz then fix the comment.

Thanks again,
Geoffrey.

User avatar
xkr47
Established Member
Posts: 11
Joined: Fri Jul 19, 2019 5:50 pm
Contact:

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Post by xkr47 »

geoffrey wrote:Thanks very much for your review! I really appreciate you taking the time to go through the code.
Hey now, I wish you had a patreon or similar so we all could appreciate your work here with some money so you could buy some 3rd gen hw :wink:

Also, I managed to order one of the last 2nd gen 18i8s in my country so I started looking at the code again in more detail to better understand the beast while waiting for the box to arrive :)
I want to say I would not have ordered it without your awesome work. Maybe I would have settled for a 2i2 or something instead. Dunno..
geoffrey wrote:You are correct; well spotted! Please see https://github.com/geoffreybennett/scar ... t-gen2-5.4 for my proposed fix (I liked your suggestion to use designators).
Yeah looks great! Funny that the 6i6 still worked despite the misalignment.. I guess 6i6 users might still get some (positive?) surprises with this fix :)
geoffrey wrote:Most likely the comment is incorrect. The 18i20 manual says "the S/PDIF outputs are unavailable at 176.4/192 kHz sample rates" and I just presumed the same applied to the 18i8 without checking the manual or testing it. It'd be good to test this; make sure that 18i20 S/PDIF output doesn't work at 192KHz and the 18i8 S/PDIF output does work at 192KHz then fix the comment.
I guess it would be possible to test the scarletts against themselves by looping a cable from out to in since both models are supposed to at least support 192kHz on input?

Where does info for the ascii art in the source code come from? I mean there's a similar one in the 1st gen driver, but is there actually some schematics available somewhere or have you figured it out by trial and error?

Thanks,
xkr47

tvaz
Posts: 1
Joined: Sun Nov 10, 2019 5:55 pm

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Post by tvaz »

Hi, I've just came to this thread after a few days trying to put a 18i20 2nd Gen to work in my Debian system.

First, a huge thanks to geoffrey and others involved for their amazing work. My device is working as it should, finally.

I didn't try it enough, but I couldn't wait further to come here to say thanks and share what I exactly did so far:

- Installed the .deb kernel image and headers from https://github.com/geoffreybennett/scar ... v5.4rc6s10
- created the 'scarlett.conf' file under /etc/modprob.d/ with the content: 'options snd_usb_audio device_setup=1'
- reloaded the module
- installed qasmixer, as I couldn't navigate well on default alsamixer command.
- I had to set the clock source to 'internal'. I was S/PDIF by default

And then things just started working.

I'll be reporting any issues that I may find in the following days.

Thanks again.

geoffrey
Established Member
Posts: 76
Joined: Mon Jul 30, 2018 2:08 am

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Post by geoffrey »

Hi xkr47,
xkr47 wrote:
geoffrey wrote:Thanks very much for your review! I really appreciate you taking the time to go through the code.
Hey now, I wish you had a patreon or similar so we all could appreciate your work here with some money so you could buy some 3rd gen hw :wink:
Well, in exciting news, please see: viewtopic.php?f=6&t=20669 — I now have a 3rd gen 4i4 and am working on the driver. If people would like to donate so I can get an 3rd gen 8i6/18i8/18i20 and extend the driver to support more models, please contact me by private message or email g@b4.vu.
xkr47 wrote:Also, I managed to order one of the last 2nd gen 18i8s in my country so I started looking at the code again in more detail to better understand the beast while waiting for the box to arrive :)
I want to say I would not have ordered it without your awesome work. Maybe I would have settled for a 2i2 or something instead. Dunno..
I do like my 18i8. It's awesome having 8 analogue inputs so you can plug in all your mics, guitars, synths, and drum machines at once :-).
xkr47 wrote:
geoffrey wrote:You are correct; well spotted! Please see https://github.com/geoffreybennett/scar ... t-gen2-5.4 for my proposed fix (I liked your suggestion to use designators).
Yeah looks great! Funny that the 6i6 still worked despite the misalignment.. I guess 6i6 users might still get some (positive?) surprises with this fix :)
Yes indeed; with how it was, the routing setup wouldn't work very well at all.
xkr47 wrote:
geoffrey wrote:Most likely the comment is incorrect. The 18i20 manual says "the S/PDIF outputs are unavailable at 176.4/192 kHz sample rates" and I just presumed the same applied to the 18i8 without checking the manual or testing it. It'd be good to test this; make sure that 18i20 S/PDIF output doesn't work at 192KHz and the 18i8 S/PDIF output does work at 192KHz then fix the comment.
I guess it would be possible to test the scarletts against themselves by looping a cable from out to in since both models are supposed to at least support 192kHz on input?
Yes, that could be done.
xkr47 wrote:Where does info for the ascii art in the source code come from? I mean there's a similar one in the 1st gen driver, but is there actually some schematics available somewhere or have you figured it out by trial and error?
I've not seen any schematics available. I just noticed some things missing for the 2nd Gen & added them in to the diagram from the 1st gen driver.

Regards,
Geoffrey.

curtipus
Posts: 1
Joined: Tue Feb 04, 2020 4:31 pm

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Post by curtipus »

I managed to install geoffrey's kernel (https://github.com/geoffreybennett/scar ... v5.4rc6s10) and was happily pleased to see alsamixer and qasmixer giving me control of an 18i20 2nd gen.

I am having one issue though, and it may just be a misunderstanding of how this driver works compared to the 18i8 1st gen I own. I can't figure out how to route any of the Mixes (like Mix A, B...) to output on any of the 10 physical 1/4" outputs on the rear of the device. I am able to directly output a single channel, say analogue 1, to a particular output but that is all.

I think part of my issue is that the device has slightly different controls from the 1st gen 18i8, which I am able to get routing mixes correctly through either x42's scarlett-mixer, qasmixer, or alsamixer.

Anybody have any info on how to properly setup routing Mixes to the outputs on the 18i20?

Papa Charly
Established Member
Posts: 4
Joined: Tue Jan 07, 2014 10:31 am

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Post by Papa Charly »

@Curtipus
It's a little bit tricky. You have to choose which Input-signal should be mixed.
But step by step: using alsamixer
1. Choose the source you like to send to the mix => "Mixer Input 01...18"
2. Adjust the Volume of the different MIx A...J => "Mixer(A...J) Input (01...18)" # 01...18 is corresponding to step 1.
So you have 10x18=180 different possibilities!! ;-)
3. Now choose which Mix should be rooted to which HW-output => Adat Output 1...8, Analogue 1...8, S/PDIF 1/2

For my Opinion to save Stereo- Sound you have to build MixA and MixB and choose each channel (R/L) on a different Mix.

Example:
You have a Stereo input on HW-Input channel 1 and 2 and you like to mix it to the headphone output 7/8:
- First you scroll to "Mixer Input 01" and choose "Analog 1" (right Stereo- Input on HW channel1) by using up/down arrows on your keyboard, so the HW Input 1 will be send to any mix, no matter which one you adjust later. The same you do with HW Input 2 for the other Stereo channel at "Mixer Input 02". That is the mean thing for any HW-Input you like to send to any Mix!

-No you have a source you can adjust the volume for the Mix. You have to do it like described in 2.. You go to "Mix A input 1" and adjust the volume for "Mixer Input 01" ,right Stereo- channel (up and down arrows), and the same you do to the Mix B input 2.

-the last step for the rooting is that you have to choose where you want to send the Mix to. For Example you like to listen to the mix A/B (Stereo) on the headphone HW 7/8 channel. You have to scroll to Analogue output 07 and choose MixA (using up/own arrows again) and the same you have to adjust at Analogue 08 choosing MixB. That's it.
At last you can adjust the Volume for the HW- channels 7/8 (Headphone-1 outs) by scrolling to Line 07/8 and using the arrow-keys again!

If you thing a little more time about this Adjustments you will find out that you have a lot possibilities to mix the hardware for different Configurations you like, for example some musicians which like to have their own volumes for all the channels (Vocals/Instruments/playback/etc)
I could imagine that there are more variations of adjustments than with the original Win- Software.

What I haven't found out is what is the use of the PCM in and outs. I'll have to check it later.

I hope you understand what I was talking about and you can realise what very good HW you have bought and you feel fine when your playing with it!

At last: many, many thx to you geoffrey. You can not imagine what a big big help you have given us all with your work compiling this kernel mod.
I hope that your module will become a part of the regular standard- kernel.
Last edited by Papa Charly on Sat Mar 14, 2020 11:53 am, edited 2 times in total.

User avatar
sadko4u
Established Member
Posts: 777
Joined: Mon Sep 28, 2015 9:03 pm

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Post by sadko4u »

@geoffrey
Do I right understand that thanks to your work 2nd gen scarlett interfaces do have fully functional mixer for Linux now?

If so, then I believe this is great news since I'm looking for a reliable interface with easy access to internal mixer:
viewtopic.php?f=18&t=21127

Where can I submit my donation?
LSP (Linux Studio Plugins) Developer and Maintainer.

Papa Charly
Established Member
Posts: 4
Joined: Tue Jan 07, 2014 10:31 am

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Post by Papa Charly »

To anybody who is interested in:

In my last post I had described how to rout the hardware- channels directly in low latency with "alsamixer" when you have installed Geoffrey's kernel.

Now I have made some test with PCM- in / out in combination with Ardour:

If you decide to record some HW- inputs to a track in Ardour you have to go to the "PCM input" and choose the HW- channel you like to record. For example if you like to record HW-1/2 input you adjust it at any "PCM 01-18" with using the up/down arrow keys on the keyboard. To get it better organized I had routed the "Analogue Inputs (01-18)" to the corresponding "PCM (01-18)". When you are doing it like this you will have a better overview when you record an explicit HW- Input in Ardour, where you have to choose the desired PCM- Input as Hardware channel- Input(Input- Matrix, Hardware- channels). For the Master-out in Ardour I have decided to youse the "PCM- 19/20" which I can select in Ardour "Master-out". You will find the corresponding PCM- channels in Ardour when you select Hardware in the channel matrix for the in- and outputs.

To send the Master-out from Ardour (PCM 19/20) to a desired HW-output channel, like for example HW 7/8 ( Headphone-1) you have to configure a "Mixer Input 01-18" with the corresponding "PCM-19/20"l. To get it organized I had decided to use "Mixer Input 17/18" for the Master out "PCM 19/20" (Ardour-Master-out) which I later send it to the Headphone -1 (HW7/8) when I raise the volume "Mix A Input 17" / "Mix B Input 18" (again Stereo- sound), the mixes which where connected to the HW- 7/8 in "Analogue Output 07/08" like described in the post above.

Puh, that's how it works for me. So in short:

- "PCM 01-18" => Analogue 1-8, S/PDIF 1-2, ADAT 1-8, Mix A-J, PCM 1-20 all as Hardware-Inputs for Ardour (Sequencer- Software) -take care not to make any circles!
Choose the "PCM 01-18" as "Hardware- channels (01-18)" in the Input- Matrix in Ardour to record tracks from them.

- choose Ardour's Master-out channel (or track-channel out) to the Hardware- out in the Ardour- matrix, which is corresponding to the desired PCM (example 19/20) for the Mix.

- "Mixer Input 01-18" => choose the desired PCM which is corresponding to the Ardour out (here "Mixer Input 17/18" adjusted to "PCM 19/20"-Ardour Master-out)

- "Mix A-J Input" adjust the volume for the Signal coming from Ardour (here 17/18). When using Mix-A for the right Stereo-Channel on the Headphones and Mix-B for the left you have to raise channel Mix-A 17 and Mix-B 18 to get it to work.

- "Analogue Output 01-10, "ADAT Output 1-8", "S/PDIF 1-2" => desire which signal will be routed to the HW- out's (here "Analogue Output 07/0"8 = "Mix A/B") - remember Stereo- sound

- "Line 01-08" / "Adat 01-08" => Adjust the volume for the HW- channel (example "Line 07/08 Headphone 1")


Confusing? I hope not so much. Just do it step by step and try to find out what is the use of each controller in alsamixer!!

For those who like to work on Alsamixergui you will find all the named controllers but you can not use them the way you can do it with "only" Alsamixer while you can switch them with the arrow- key on your keyboard.
And you will have the challenge to find out how you can use Alsamixergui with Pulse-Audio installed:

-You have to bring up your USB- Device (Scarlett) as the first Soundcard in alsa: edit or create /etc/modprobe.d/sound.conf -you will find informations on that in the web.
-You have to stop Pulse- Audio: configure Pulse to not autorespawn -ask the web for informations to your system, and stop it from running. I have to write :
" systemctl --user stop pulseaudio.socket
systemctl --user stop pulseaudio.service"
in a user terminal.
Alsamixergui is good to adjust the volumes for all the controllers, 'cause there are many. But to configure the HW- mixer you'll need something like the alsamixer. And using alsamixer you don't need to stop Pulse from running. Just open alsamixer, choose the scarlett USB- Soundcard with F6 and configure what you like to by using the arrow- keys left/right/up/down from your keyboard.
I've tried using both, Alamixergui on the top half of my screen and Alsamixer underneath so that I can use the switches for the inputs (F4/F5)

At last my System- Informations:
Old Medion- Konvertible, Debian Gnu/Linux KDE- Plasma 5.17.5 "Siduction 64-bit", Geoffrey's Kernel installed (deb- package)
I use jack as soundserver to adjust best latency out of this old Hardware, but I think for working with Ardour and this Scarlett- configuration there is no need to. Maybe it is although possible to work with alsa as soundserver only and you can configure Ardour to work with it?!

@geoffrey-
I would like to integrate your kernel- module into my standard- kernel on my workstation, because I am running the proprietary Nvidia driver on it and I cannot run your kernel on this machine. Can you give my some advise?

oviri
Established Member
Posts: 3
Joined: Thu May 07, 2020 1:13 am

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Post by oviri »

Hi there
big thanks to Geoffrey for the awesome work!

Is the driver now include in the 5.4 kernel ?

thank you

ChuggnBlues
Established Member
Posts: 25
Joined: Wed May 13, 2020 11:44 pm

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Post by ChuggnBlues »

oviri wrote:
Wed May 13, 2020 6:16 am
Hi there
big thanks to Geoffrey for the awesome work!

Is the driver now include in the 5.4 kernel ?

thank you
Indeed! I'd also like to know the status of getting this merged into mainline.

Bugeyed Earl
Established Member
Posts: 6
Joined: Sat Feb 22, 2020 3:53 pm

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Post by Bugeyed Earl »

Yes, the 2nd generation driver is available as of kernel 5.4 and higher.

Post Reply