Focusrite Scarlett Gen 4 mixer driver

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

Moderators: MattKingUSA, khz

geoffrey
Established Member
Posts: 259
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 34 times
Been thanked: 174 times

Focusrite Scarlett Gen 4 mixer driver

Post by geoffrey »

EDIT 25/Mar/2024: This is completed now; see https://github.com/geoffreybennett/alsa-scarlett-gui/ — full support for the 4th Gen Solo, 2i2, and 4i4, plus firmware update support from Linux too

Hi all,

Here's the start of a thread for Focusrite Scarlett Gen 4 mixer driver support. As mentioned elsewhere, I'm currently working through updating the Gen 2/3 driver so that it also supports Gen 4. It's coming along well, and I'll post more progress updates here as I proceed.

Here's a pretty picture to admire while you wait... this is the default routing that Focusrite Control uses, as presented by alsa-scarlett-gui:

4i4-gen4-routing.png
4i4-gen4-routing.png (115.49 KiB) Viewed 84279 times

Also, if there is anyone out there who has a 4i4 Gen 4 and has not turned off MSD mode yet and wouldn't mind keeping it like that for a few more days, please get in contact with me (email or private message). I'd like to get a before/after dump from the device.

Thanks,
Geoffrey.

Last edited by geoffrey on Sun Mar 24, 2024 2:08 pm, edited 1 time in total.
geoffrey
Established Member
Posts: 259
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 34 times
Been thanked: 174 times

Re: Focusrite Scarlett Gen 4 mixer driver

Post by geoffrey »

Anyone with a Scarlett Gen 4 who is willing to help test a pre-release version when one is ready, please email me.

User avatar
cjoke
Established Member
Posts: 15
Joined: Thu Jul 25, 2019 8:03 pm
Location: Norway
Has thanked: 5 times
Contact:

Re: Focusrite Scarlett Gen 4 mixer driver

Post by cjoke »

Now, this was something!

Nice howto install in the Usage file, I expected INSTALL.md but, not that difficult to spot ;) Supereasy install!
I really like how the gui worked. I have used the qasmixer for a couple of years on my gen2 device and started to get used to it.
This one , I must say, I got the "hang" of it after just a few minutes.

Really nice work!

Love, people, music, beer and lot of other stuff.
folderol
Established Member
Posts: 2083
Joined: Mon Sep 28, 2015 8:06 pm
Location: Here, of course!
Has thanked: 232 times
Been thanked: 400 times
Contact:

Re: Focusrite Scarlett Gen 4 mixer driver

Post by folderol »

I don't have any Focusrite kit myself, but I am delighted to see this. I hope you get the support.

The Yoshimi guy {apparently now an 'elderly'}
geoffrey
Established Member
Posts: 259
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 34 times
Been thanked: 174 times

Re: Focusrite Scarlett Gen 4 mixer driver

Post by geoffrey »

Hi all,

Progress Update! 🚀

We're making headway! There's an interesting mix of expected "challenges" and delightful "surprises" :D.

Reading Interface Controls: Gen 4 controls that were present in Gen 3 (line/inst, air, and phantom power) are now visible in alsamixer and alsa-scarlett-gui. When adjustments are made from the front panel, they reflect as expected. This is working for Solo, 2i2, and 4i4 models.

Writing Interface Controls: For the 4i4 Gen 4, controls that were present in Gen 3 can now be manipulated directly from ALSA and the GUI. It's a significant step, affirming that what I'm trying to do is possible (whew!).

An Intriguing Discovery: I found a peculiar inconsistency... based on the routing diagram from my initial post, the expectation was 12×8 mixer-matrix gain controls. However, the values of the two right-most columns and two bottom-most rows seemed off:

mixer-weird.png
mixer-weird.png (187.95 KiB) Viewed 84020 times

This enigma took quite some unraveling, but after extensive testing and thinking, the revelation was that mixer inputs 11/12 are hardwired to mixer outputs G/H. So, it's actually 10×6 gain controls. Obvious in hindsight!

It turns out that the mixer inputs 11/12 are used to display the audio levels on the front panel. If you connect e.g. PCM 1/2 to mixer inputs 11/12 then the two input level meters turn into stereo playback meters. The auto-gain function also uses the volume seen at those mixer inputs to do its thing, so if you disconnect them then auto-gain sets the gain based on the wrong volume.

Safety First: One thing that makes this take longer is I'm trying to be careful and not inadvertently brick anything, since I've only got one of each device. I've found that if you change the routing in an incompatible way then you lose options in Focusrite Control 2, with no way to put it back from there (Focusrite Control for the Gen 2/3 would just put things back for you if you change them in Linux, and it had a factory-reset option as well). Fingers crossed as I poke more at the devices and experiment with the new controls.

Edit: don't need this now: If anyone has a Gen 4 Solo or a Gen 4 2i2, please let me know. That'd be really helpful in figuring out some things with less risk :). [Thanks to help from Focusrite I can switch between firmware versions arbitrarily now so I can figure these things out myself]

Anyway, back to coding... there's lots to do still. Hope you're finding this interesting! Appreciate all your support.

Regards,
Geoffrey.

Last edited by geoffrey on Sun Oct 22, 2023 5:02 pm, edited 1 time in total.
geoffrey
Established Member
Posts: 259
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 34 times
Been thanked: 174 times

Re: Focusrite Scarlett Gen 4 mixer driver

Post by geoffrey »

Scarlett Solo 4th Gen support in the kernel & the GUI is almost at the good-enough-to-share stage! Reading & writing controls works with the same functionality as Focusrite Control now.

Screenshot from 2023-10-08 03-08-46.png
Screenshot from 2023-10-08 03-08-46.png (15.51 KiB) Viewed 83888 times
geoffrey
Established Member
Posts: 259
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 34 times
Been thanked: 174 times

Re: Focusrite Scarlett Gen 4 mixer driver

Post by geoffrey »

Similarly, 2i2 support is getting there:

Screenshot from 2023-10-09 02-34-37.png
Screenshot from 2023-10-09 02-34-37.png (12.55 KiB) Viewed 83834 times

The 4th Gen 2i2 and 4i4 have software-controlled preamps, which I can now control from Linux, including the "auto-gain" mode (sets the gain based on the input sampled over 10 seconds) and "safe" mode (reduces the gain as needed to avoid clipping). So, things are progressing...

There's still some puzzles I haven't figured out in the protocol, but over the next few weeks I hope to sort it all out and have a driver to release.

Also interesting, I found the 4th Gen Solo and 2i2 have an internal mixer like the bigger interfaces! I mean, of course they do in order to implement monitoring, but I'm pretty sure that with the 3rd Gen interfaces it couldn't be inspected or controlled beyond on/off. I haven't checked if I can adjust anything in it yet, but I suspect so 🤞. And if I can, that'd be really neat because then you could set the relative levels of the mic & PC audio when doing direct monitoring. That's always been possible on the bigger interfaces, but not the smaller ones.

geoffrey
Established Member
Posts: 259
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 34 times
Been thanked: 174 times

Re: Focusrite Scarlett Gen 4 mixer driver

Post by geoffrey »

Well, if they can do it, we will be able to do it too. This version of Focusrite Control was released today, and matches my guess from yesterday!

Screenshot from 2023-10-10 00-09-08.png
Screenshot from 2023-10-10 00-09-08.png (30.84 KiB) Viewed 83794 times
geoffrey
Established Member
Posts: 259
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 34 times
Been thanked: 174 times

Re: Focusrite Scarlett Gen 4 mixer driver

Post by geoffrey »

Something that had me worrying for a long time was what I'd do if Focusrite altered something in the USB protocol from one firmware version to the next. Focusrite has the advantage that their Focusrite Control software can insist on a firmware upgrade before usage. Since there's no way to update the firmware from Linux, I've always aimed to ensure the driver would be compatible with any firmware version. I haven't previously noticed any difference between firmware versions that would affect the driver.

That is, until now when I found that the latest firmware for the Gen 4 Solo places the Direct Monitor control at different offset than the firmware that the device originally shipped with. Do I need to support multiple firmware versions? And if so, how would I test this, since Focusrite doesn't provide users with a method to downgrade firmware? That's a fair enough call on their part, but makes it difficult for external parties (i.e. me) to do such testing.

So, tonight I implemented these functions:

  • Get Firmware Version

  • Reset to Factory Firmware (discovering that this is possible was a very pleasant surprise!)

  • Reset to Factory Configuration

  • Upgrade Firmware

Problem solved! :D

n4wux9RIL9.png
n4wux9RIL9.png (48.22 KiB) Viewed 83698 times

I hope you're enjoying these behind-the-scenes progress reports. Once I'm done, Focusrite devices are going to be the best supported audio interfaces on Linux! :D

geoffrey
Established Member
Posts: 259
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 34 times
Been thanked: 174 times

Re: Focusrite Scarlett Gen 4 mixer driver

Post by geoffrey »

I wasn't kidding when I said "Once I'm done, Focusrite devices are going to be the best supported audio interfaces on Linux! :D".

In case you're not following the fundraiser thread, I just posted the final update which has the extraordinary news that Focusrite is now assisting me! See here for the full story: viewtopic.php?p=160833#p160833

User avatar
bluebell
Established Member
Posts: 1927
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 113 times
Been thanked: 122 times

Re: Focusrite Scarlett Gen 4 mixer driver

Post by bluebell »

geoffrey wrote: Thu Oct 12, 2023 2:21 pm

I wasn't kidding when I said "Once I'm done, Focusrite devices are going to be the best supported audio interfaces on Linux! :D".

In case you're not following the fundraiser thread, I just posted the final update which has the extraordinary news that Focusrite is now assisting me! See here for the full story: viewtopic.php?p=160833#p160833

At some point they will have more and better features on Linux than on other operating systems :mrgreen:

Linux – MOTU UltraLite AVB – Qtractor – http://suedwestlicht.saar.de/

geoffrey
Established Member
Posts: 259
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 34 times
Been thanked: 174 times

Re: Focusrite Scarlett Gen 4 mixer driver

Post by geoffrey »

bluebell wrote: Thu Oct 12, 2023 3:51 pm
geoffrey wrote: Thu Oct 12, 2023 2:21 pm

I wasn't kidding when I said "Once I'm done, Focusrite devices are going to be the best supported audio interfaces on Linux! :D".

In case you're not following the fundraiser thread, I just posted the final update which has the extraordinary news that Focusrite is now assisting me! See here for the full story: viewtopic.php?p=160833#p160833

At some point they will have more and better features on Linux than on other operating systems :mrgreen:

Already does ;). The best is that loopback is officially only available in Gen3+, but the Linux driver lets you assign the USB inputs arbitrarily since Gen2.

runiq
Established Member
Posts: 47
Joined: Fri Jun 09, 2023 9:55 am
Has thanked: 61 times
Been thanked: 15 times
Contact:

Re: Focusrite Scarlett Gen 4 mixer driver

Post by runiq »

geoffrey wrote: Thu Oct 12, 2023 2:21 pm

I wasn't kidding when I said "Once I'm done, Focusrite devices are going to be the best supported audio interfaces on Linux! :D".

In case you're not following the fundraiser thread, I just posted the final update which has the extraordinary news that Focusrite is now assisting me! See here for the full story: viewtopic.php?p=160833#p160833

Man, I had the biggest smile on my face when I read that news. Here's to you, thanks for your work <3

geoffrey
Established Member
Posts: 259
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 34 times
Been thanked: 174 times

Re: Focusrite Scarlett Gen 4 mixer driver

Post by geoffrey »

Time for another status update...

Lots of controls for the Gen 4 4i4, all working in both directions (changing state in alsamixer changes the hardware state, and pressing buttons on the hardware changes state in alsamixer):

Screenshot from 2023-10-23 02-50-46.png
Screenshot from 2023-10-23 02-50-46.png (14.82 KiB) Viewed 83205 times

That's controls for routing, air mode, autogain, gain, level, phantom power, safe mode, stereo link, and input select.

These are the commits so-far, mostly divided into refactoring, then adding support for new controls, then the last commit just adds the definitions for the new models:

Rename Gen 3 config sets
Infer has_msd_mode from config items
Infer standalone switch from config items
Check for phantom persistence config item
Check presence of mixer using mux_assignment
Add config set struct
Remove scarlett2_config_sets array
Add check for config_item presence
Refactor scarlett2_usb_set_config()
Parameterise notifications
Add missing error check to scarlett2_config_save()
Add missing error check to scarlett2_usb_set_config()
Remove repeated test in scarlett2_add_line_out_ctls()
Allow for interfaces without per-channel volume
Rename db_scale_scarlett2_gain to volume
Add support for air/phantom control on input 2
Split input_other into level/pad/air/phantom
Add missing error checks to *_ctl_get()
Add support for Gen 4 style parameters
Allow for controls with a "mute mode"
Add support for Air Presence + Drive option
Add support for software-controllable input gain
Add power status control
Add support for DSP channels
Add support for Solo, 2i2, and 4i4 Gen 4

Also working on support for firmware updates. Also also keeping in mind Vocaster support, GUI support for Gen 1, and those level meters still need work, and need to make sure everything still works on all the older models (12 of them). When done, it's going to be 17 distinct models supported!

tseaver
Established Member
Posts: 408
Joined: Mon Mar 13, 2017 6:07 am
Has thanked: 12 times
Been thanked: 102 times

Re: Focusrite Scarlett Gen 4 mixer driver

Post by tseaver »

@geoffrey

Code: Select all

When done, it's going to be 17 distinct models supported!

What an outstanding bunch of work you've done here!

Ubuntu, Mixbus32C; acoustic blues / country / jazz
Post Reply