Focusrite Scarlett 6i6 and 18i8 2nd Gen mixer driver

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

Moderators: MattKingUSA, khz

User avatar
dawitti
Established Member
Posts: 9
Joined: Wed Mar 14, 2018 3:23 pm
Location: Austria
Contact:

Re: Focusrite Scarlett 6i6 and 18i8 2nd Gen mixer driver

Post by dawitti »

Here's a little update:

I finally managed to get a prepackaged 5.1.9 kernel running. When loading the compiled snd_usb_audio module, dmesg says:
[ 48.966843] snd_usb_audio: version magic '5.1.0-rc1+ SMP preempt mod_unload ' should be '5.1.9-050109-generic SMP mod_unload '
[ 48.967895] snd_usb_audio: version magic '5.1.0-rc1+ SMP preempt mod_unload ' should be '5.1.9-050109-generic SMP mod_unload '
[ 48.987209] snd_usb_audio: version magic '5.1.0-rc1+ SMP preempt mod_unload ' should be '5.1.9-050109-generic SMP mod_unload '

This and grepping the repository told me that some version constants were set incorrectly so I replaced them and recompiled snd_usb_audio.
Interestingly the file size is still the same but comparing md5 hashes tells me they're different.

Anyway afterwards the error is quite similar:
[ 46.721515] snd_usb_audio: version magic '5.1.9-050109-generic SMP preempt mod_unload ' should be '5.1.9-050109-generic SMP mod_unload '

Am I correct in assuming that the kernel in your repository is a lowlatency kernel (in that context I often read preemptive)?

The kernel I'm actually running / testing against is not. It's from: https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.1.9/

@geoffrey Do you know how to fix this?
geoffrey
Established Member
Posts: 250
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 33 times
Been thanked: 163 times

Re: Focusrite Scarlett 6i6 and 18i8 2nd Gen mixer driver

Post by geoffrey »

dawitti wrote:Here's a little update:

I finally managed to get a prepackaged 5.1.9 kernel running. When loading the compiled snd_usb_audio module, dmesg says:
[ 48.966843] snd_usb_audio: version magic '5.1.0-rc1+ SMP preempt mod_unload ' should be '5.1.9-050109-generic SMP mod_unload '
[ 48.967895] snd_usb_audio: version magic '5.1.0-rc1+ SMP preempt mod_unload ' should be '5.1.9-050109-generic SMP mod_unload '
[ 48.987209] snd_usb_audio: version magic '5.1.0-rc1+ SMP preempt mod_unload ' should be '5.1.9-050109-generic SMP mod_unload '

This and grepping the repository told me that some version constants were set incorrectly so I replaced them and recompiled snd_usb_audio.
Interestingly the file size is still the same but comparing md5 hashes tells me they're different.

Anyway afterwards the error is quite similar:
[ 46.721515] snd_usb_audio: version magic '5.1.9-050109-generic SMP preempt mod_unload ' should be '5.1.9-050109-generic SMP mod_unload '

Am I correct in assuming that the kernel in your repository is a lowlatency kernel (in that context I often read preemptive)?

The kernel I'm actually running / testing against is not. It's from: https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.1.9/

@geoffrey Do you know how to fix this?
Sorry, no idea... those errors are indicating that the module you built is for a "5.1.0-rc1+ SMP preempt" or a "5.1.9-050109-generic SMP preempt" kernel respectively, but you are running a "5.1.9-050109-generic SMP" kernel. The kernel in my repo isn't a lowlatency kernel. It's a regular stable Linux kernel taken from git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

If you want to try building your own kernel still, you could try doing "make -j6 bindeb-pkg LOCALVERSION=s6" instead of "make install". That will create a deb package that you can install. No idea if that would break your grub install again though.

But... I updated the scarlett-gen2 branch in my repo to 5.1.15 and have built an Ubuntu package for you. You can try the deb from https://github.com/geoffreybennett/scar ... /v5.1.15s6 (and for anyone else following along who is running Fedora, you can try the RPM there). That kernel will at least boot (on my test Ubuntu 1810 server) and load the snd-usb-audio module without error for me. Again, I have no idea what happened to your grub when you did a "make install" so I can only hope this works better for you and wish you good luck!
User avatar
dawitti
Established Member
Posts: 9
Joined: Wed Mar 14, 2018 3:23 pm
Location: Austria
Contact:

Re: Focusrite Scarlett 6i6 and 18i8 2nd Gen mixer driver

Post by dawitti »

@geoffrey you are amazing!!!

I just tested the kernel you packaged and can confirm that the scarlett 6i6 hardware mixer can be controlled via alsamixer using this kernel! this is AWESOME!
The only thing that did not work as far as I can tell now is setting the -20db pads. I created a short screencast with usb dumps attached for this and to quickly show what we see in alsamixer for this device: https://youtu.be/7ndpuj-TOlI

This was just a quick test to check wether it's working in principal and I probably have not yet fully understood what exactly each setting does. But I will test this in more detail in the next days.

Thank you so much!
geoffrey
Established Member
Posts: 250
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 33 times
Been thanked: 163 times

Re: Focusrite Scarlett 6i6 and 18i8 2nd Gen mixer driver

Post by geoffrey »

dawitti wrote:@geoffrey you are amazing!!!

I just tested the kernel you packaged and can confirm that the scarlett 6i6 hardware mixer can be controlled via alsamixer using this kernel! this is AWESOME!
The only thing that did not work as far as I can tell now is setting the -20db pads. I created a short screencast with usb dumps attached for this and to quickly show what we see in alsamixer for this device: https://youtu.be/7ndpuj-TOlI

This was just a quick test to check wether it's working in principal and I probably have not yet fully understood what exactly each setting does. But I will test this in more detail in the next days.

Thank you so much!
Woo-hoo again! That's so good! I'm really happy we got this far this fast with your 6i6!

The USB dump file was empty save for an error message; could you re-upload that?

For the pad issue, I'm wondering if you pressed the correct key? It's really not obvious, but you need to use Space to toggle the pad in alsamixer, not Up/Down like it is to control the level select.

If all the mixer controls (Mix Inputs 1-18, Mix Outputs A-J) work, that's really interesting. As far as I can tell, the 6i6, 18i8, and 18i20 all have the same 18-in/10-out internal mixer and there's no reason for the FC software to not let you assign a custom mix to every output (that "Max Mixes Reached" message you saw after you assigned 5 outputs) on the 6i6 and 18i8. I guess it uses 2 of the mixer outputs for every custom mix, even when you've got every output set to mono. The hardware supports having the same mix on multiple outputs, but the FC software doesn't support this (presumably for simplicity). We have the potential for a better GUI than FC!

If you haven't looked at it yet, the diagram at the top of the mixer_scarlett_gen2.c file will help you understand what the controls do: https://github.com/geoffreybennett/scar ... ett_gen2.c — if you have any questions about the controls after studying the diagram and the alsamixer controls, please ask! And I hope you don't mind, I credited you in the source (lines 43–44).

Thanks again!

Regards,
Geoffrey.
geoffrey
Established Member
Posts: 250
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 33 times
Been thanked: 163 times

Re: Focusrite Scarlett 6i6 and 18i8 2nd Gen mixer driver

Post by geoffrey »

geoffrey wrote:For the pad issue, I'm wondering if you pressed the correct key? It's really not obvious, but you need to use Space to toggle the pad in alsamixer, not Up/Down like it is to control the level select.
Something rather amusing last night... I added support for controlling the Mute/Dim buttons on the 18i20 but was having a *lot* of trouble making it work. Many module compilations later, I figured out that you need to press "M" (for "Mute") to toggle Playback booleans, not Space like you do for Capture booleans (facepalm).

So, I've made another release: https://github.com/geoffreybennett/scar ... /v5.1.15s7

It'd be great if anyone reading this could test it out. Something important is that I made this new mixer driver *not* enabled by default because it was causing breakage for a couple of people. To enable it you need to create a file "/etc/modprobe.d/scarlett.conf" containing the line "options snd_usb_audio scarlett_gen2_mixer_enable=1".

Thanks!
User avatar
sysrqer
Established Member
Posts: 2516
Joined: Thu Nov 14, 2013 11:47 pm
Has thanked: 319 times
Been thanked: 147 times
Contact:

Re: Focusrite Scarlett 6i6 and 18i8 2nd Gen mixer driver

Post by sysrqer »

I will be able to test this in the next few days, I have one on order.
geoffrey
Established Member
Posts: 250
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 33 times
Been thanked: 163 times

Re: Focusrite Scarlett 6i6 and 18i8 2nd Gen mixer driver

Post by geoffrey »

sysrqer wrote:I will be able to test this in the next few days, I have one on order.
Hi sysrqer,

Thanks! Could you do me a favour please? If you wouldn't mind *not* plugging it into a Windows or Mac computer and *not* trying the Focusrite software before trying my driver, that'd be great. Some people have had issues with my driver, and I suspect that it's because they might be Linux-only users and there might be some one-time initialisation that the Focusrite software does, or maybe firmware versions, or something, and I've not gotten enough info to track down the problem yet.

If my driver doesn't work for you, would you be willing to work with me to get a usbmon capture of whatever the Focusrite software does the first time it sees a new device?

Thanks,
Geoffrey.
User avatar
sysrqer
Established Member
Posts: 2516
Joined: Thu Nov 14, 2013 11:47 pm
Has thanked: 319 times
Been thanked: 147 times
Contact:

Re: Focusrite Scarlett 6i6 and 18i8 2nd Gen mixer driver

Post by sysrqer »

Yeah no worries. So I just install the kernel, boot into it and open alsamixer?

I'm more than happy to help however I can, no problem.
geoffrey
Established Member
Posts: 250
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 33 times
Been thanked: 163 times

Re: Focusrite Scarlett 6i6 and 18i8 2nd Gen mixer driver

Post by geoffrey »

sysrqer wrote:Yeah no worries. So I just install the kernel, boot into it and open alsamixer?
To enable the driver you'll also need to create a file /etc/modprobe.d/scarlett.conf containing the line "options snd_usb_audio scarlett_gen2_mixer_enable=1" before you boot the new kernel.
sysrqer wrote:I'm more than happy to help however I can, no problem.
Thanks!
User avatar
sysrqer
Established Member
Posts: 2516
Joined: Thu Nov 14, 2013 11:47 pm
Has thanked: 319 times
Been thanked: 147 times
Contact:

Re: Focusrite Scarlett 6i6 and 18i8 2nd Gen mixer driver

Post by sysrqer »

I've just tried it and it seemed to work, was recognised and there were faders and option switches...I've no idea what it all does yet though. I didn't realise this device was so complex.

I haven't managed to actually get any sound out though so far. The kernel shows a boot error 8 times:

Code: Select all

ima: Error Communicating to TPM chip
I couldn't get the nvidia driver to load and everything was very slow and choppy, something not right at all. But the driver seems to work. I tried to get some sound out but after messing around a bit and rebooting into another kernel I realised that my speakers were turned off :shock: :oops:

I'll boot back in and try again but certainly seems promising.

Edit: yeah, just me being an idiot, sound works fine.
geoffrey
Established Member
Posts: 250
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 33 times
Been thanked: 163 times

Re: Focusrite Scarlett 6i6 and 18i8 2nd Gen mixer driver

Post by geoffrey »

sysrqer wrote:I've just tried it and it seemed to work, was recognised and there were faders and option switches...I've no idea what it all does yet though. I didn't realise this device was so complex.
[...]
Edit: yeah, just me being an idiot, sound works fine.
@sysrqer Thanks for the feedback!
geoffrey
Established Member
Posts: 250
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 33 times
Been thanked: 163 times

Re: Focusrite Scarlett 6i6 and 18i8 2nd Gen mixer driver

Post by geoffrey »

dawitti wrote:@geoffrey you are amazing!!!

I just tested the kernel you packaged and can confirm that the scarlett 6i6 hardware mixer can be controlled via alsamixer using this kernel! this is AWESOME!
The only thing that did not work as far as I can tell now is setting the -20db pads. I created a short screencast with usb dumps attached for this and to quickly show what we see in alsamixer for this device: https://youtu.be/7ndpuj-TOlI

This was just a quick test to check wether it's working in principal and I probably have not yet fully understood what exactly each setting does. But I will test this in more detail in the next days.

Thank you so much!
Hi Martin (or anyone else with a 2nd Gen 6i6),

I've made a new version of the driver with a fix for the 6i6; xkr47 spotted that the 6i6 ports data was incorrect so all the I/Os defaulted to "Off". Maybe there were other issues too but not having a 6i6, I can't confirm, so could you please retest? Binary packages and source code are available here: https://github.com/geoffreybennett/scar ... v5.4rc6s10

Thanks,
Geoffrey.
User avatar
dawitti
Established Member
Posts: 9
Joined: Wed Mar 14, 2018 3:23 pm
Location: Austria
Contact:

Re: Focusrite Scarlett 6i6 and 18i8 2nd Gen mixer driver

Post by dawitti »

Hi!
I just tested your updated kernel and yes the I/O channels now default to relatively useful settings:
- PCM 1-6 (inputs) use analogue 1-4 and spdif 1-2
- Analog out 1-4 use PCM 1-4
- Spdif out 1-2 use PCM 5-6
- the clock is set to internal

Thinking about the default routing this disables live monitoring by default.
@geoffrey Do you know where these defaults are coming from?
If they're defined in code it might be more useful to use mix A and B for analog out 1-2 and route analog in 1+2 to both of these mixes. As (non-technical) user I would probably expect the live monitoring feature to be usable in some way by default.

Each of the 10 mono mixes (or 5 stereo) has a volume control for each of the definable 18 inputs. In the older version you could define 18 inputs but there were only 6 volume controls for each mix.

Right now I'm just wondering why there are exactly 18 configurable mixer inputs...
- Analogue 1-4 + spdif = 6
- PCM 1-6 = 6
- Mix A-J = 10

I will reboot that kernel and check again.

Sidenote:
Lately I was working on a new synth setup using a headless mini pc, the carla plugin host via python + jack and controlling the scarlett mixer via a midi controller with kernel 5.4rc6. It's still rough around the edges but a useful effects process already 8)
That's only possible because of the scarlett driver coming to the mainline kernel!
Attachments
Bildschirmfoto vom 2019-11-18 19-00-23.png
Bildschirmfoto vom 2019-11-18 19-00-23.png (46.78 KiB) Viewed 9253 times
Bildschirmfoto vom 2019-11-18 18-59-31.png
Bildschirmfoto vom 2019-11-18 18-59-31.png (44.63 KiB) Viewed 9253 times
Bildschirmfoto vom 2019-11-18 18-59-06.png
Bildschirmfoto vom 2019-11-18 18-59-06.png (48.52 KiB) Viewed 9253 times
geoffrey
Established Member
Posts: 250
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 33 times
Been thanked: 163 times

Re: Focusrite Scarlett 6i6 and 18i8 2nd Gen mixer driver

Post by geoffrey »

Hi Martin,
dawitti wrote:Hi!
I just tested your updated kernel and yes the I/O channels now default to relatively useful settings:
- PCM 1-6 (inputs) use analogue 1-4 and spdif 1-2
- Analog out 1-4 use PCM 1-4
- Spdif out 1-2 use PCM 5-6
- the clock is set to internal
Thanks for testing! That is how it's meant to be now.
dawitti wrote:Thinking about the default routing this disables live monitoring by default.
@geoffrey Do you know where these defaults are coming from?
If they're defined in code it might be more useful to use mix A and B for analog out 1-2 and route analog in 1+2 to both of these mixes. As (non-tchnical) user I would probably expect the live monitoring feature to be usable in some way by default.
Yeah, those defaults are what I put in the code, but it doesn't actually disable live monitoring (or make any changes) by default because those "defaults" don't reflect the actual state of the mixer until you start changing the settings in alsamixer. In general I would recommend that you set things up how you like then run "alsactl store -f asound-scarlett.state USB" to save the settings to a file and "alsactl restore ..." just before the next time you want to change the settings. What it really needs is a good UI as everyone will have different requirements and we can't just initialise the hardware to any particular setting. It would also be good to be able to save the state directly to the interface so it can be restored automatically but I'm not sure how we can do that and retain compatibility with FC.
dawitti wrote:Each of the 10 mono mixes (or 5 stereo) has a volume control for each of the definable 18 inputs. In the older version you could define 18 inputs but there were only 6 volume controls for each mix.

Right now I'm just wondering why there are exactly 18 configurable mixer inputs...
- Analogue 1-4 + spdif = 6
- PCM 1-6 = 6
- Mix A-J = 10
The older code was just wrong, and the new code seems to now correctly reflect the hardware capabilities of the mixer. Why 18? Probably for simplicity of implementation by Focusrite as it's identical to the 18i8 and 18i20 (i.e. they all have 18x10 mixers).
dawitti wrote:Sidenote:
Lately I was working on a new synth setup using a headless mini pc, the carla plugin host via python + jack and controlling the scarlett mixer via a midi controller with kernel 5.4rc6. It's still rough around the edges but a useful effects process already 8)
That's only possible because of the scarlett driver coming to the mainline kernel!
That's cool! Are you able to share any code? Especially, sample code to control the mixer would be helpful to anyone who wants to write a better UI.

Thanks,
Geoffrey.
User avatar
Michael Willis
Established Member
Posts: 1431
Joined: Mon Oct 03, 2016 3:27 pm
Location: Rocky Mountains, North America
Has thanked: 67 times
Been thanked: 155 times
Contact:

Re: Focusrite Scarlett 6i6 and 18i8 2nd Gen mixer driver

Post by Michael Willis »

The release notes for Linux 5.4 mention this driver:

https://kernelnewbies.org/Linux_5.4#Audio

Serious congrats! This makes me want to go out and get that second-gen 18i8 that I keep pretending that I "need" :lol:
Post Reply