Focusrite-Scarlett-on-Linux / sound-usb-kernel-module

Latest driver development code for sound/usb on Linux
GNU General Public License v2.0
155 stars 7 forks source link

How to install? #22

Closed meszaros-lajos-gyorgy closed 3 months ago

meszaros-lajos-gyorgy commented 8 months ago

Hello!

I'm a noob when it comes to kernel drivers of linux which is also illustrated by the fact that I'm using Linux Mint 21.2, but I've recently bought a Focusrite Solo 4th gen and I tried installing the latest modules from this repo based on the instructions of the readme, but none of the methods seem to work.

The current linux kernel I have on my computer is 6.2.0-060200-generic and based on the readme I should grab the image-unsigned and modules packages from the mainline folder of the corresponding kernel version that I have (I used this folder: https://kernel.ubuntu.com/mainline/v6.2/amd64/). The steps in the readme also mention that I should install sound-usb-modules which are not present in the folder and I don't know how I can perform a search in the mainline folders to find a folder containing it.

I also tried downloading the repo and building the code with make based on the notes in the Development section, but all I got are a bunch of errors, probably I don't have the correct C/C++ versions installed:

image

I know this is probably not the best place to ask for help, but I'm truely lost and I don't really know where else to go. Thank you in advance for any infos!

geoffreybennett commented 8 months ago

Hi @meszaros-lajos-gyorgy,

You don't need any driver in order to starting using the Focusrite Solo 4th Gen as an audio interface under Linux, because it is USB Audio Class Compliant. Just disable Easy Start as per the user guide & start using it.

At least as of right now, the driver in this repo is only for Gen 2, Gen 3, and Clarett interfaces.

I am working on the Linux mixer driver for the 4th Gen interfaces, but especially for the Solo and 2i2 it's a "nice to have", certainly not mandatory. Follow my progress here: https://linuxmusicians.com/viewtopic.php?p=160814 The code will end up here before it goes into the mainline kernel: https://github.com/geoffreybennett/scarlett-gen2/releases And I'll update my GUI to work with the 4th Gen devices too: https://github.com/geoffreybennett/alsa-scarlett-gui/

Regards, Geoffrey.

HinTak commented 8 months ago

@meszaros-lajos-gyorgy the code here tracks current (6.5+) and compatibility with older kernel like 6.2 is limited. That's basically the compilation what you are experiencing. With new hardware, it is perhaps best to go as high up mainline as possible, and it looks to be 6.6.1:

https://kernel.ubuntu.com/mainline/v6.6.1/

You can have multiple kernel installed (up to 3), and switch them between reboots. So you can try 6.6.1 and go back to 6.2 if you don't like it.

@geoffreybennett you should consider making your work available as a 6.7 add-on to 6.6...

meszaros-lajos-gyorgy commented 8 months ago

Thank you very much for all the information from both of you!

The sound card does work, but the inputs of the device are not showing up in any of the mixers. This is what I see in pavucontrol for example: image When I configure the Profile for Scarlet Solo 4th Gen I can choose an analog or a digital output, or an analog with multi channel input or the same but with digital. When I record in OBS or Audacity then I can't record the inputs of the device on separate channels, but everything is mixed together with the output.

Here's what I see for the output (the first 2 is the scarlet, the 3rd is the hdmi of the videocard and the last is the optical on my motherboard if I'm not mistaken) image And I see nothing for input devices: image

I'll try updating the kernel to 6.6.1 and see if any of the input devices show up.

meszaros-lajos-gyorgy commented 8 months ago

Okay, I tried installing 6.6.1, then 6.6.0 and my wifi driver is completely broken now and the driver only supports kernels below 6.6.0. Also, I'm seeing the same as with kernel 6.2. I'll have another round with these stuff tomorrow with a fresh mind.

HinTak commented 8 months ago

Some WiFi driver requires firmware and so with newer kernel, also needs newer firmware blob (under /usr/lib/firmware/) . There should be an appropriate message at boot up (dmesg after boot up to read the boot messages).

I think you best option is use as recent a mainline kernel (6.5 maybe, 6.2 is definitely way too old), AND graft the 6.7+ driver code on top using a variant of this repo. The constructs here gives you the ability to run latest dev driver code against a "recent release kernel", so can't go too far back. I'll try make a graft branch here.

geoffreybennett commented 8 months ago

Hi @meszaros-lajos-gyorgy,

Have you got "Analogue Stereo Duplex" selected in the pavucontrol configuration?

Screenshot_mint_2023-11-19_14:53:38

Or if you are using Pipewire, try the "Pro Audio" configuration:

Screenshot_mint_2023-11-19_13:42:40

You can see from those screenshots, audio in Mint is working fine using the 6.2 kernel. I just did a fresh install of Mint to double-check, and it works fine out of the box with the Mint 5.15 kernel too.

Regards, Geoffrey.

geoffreybennett commented 8 months ago

@geoffreybennett you should consider making your work available as a 6.7 add-on to 6.6...

Does my snd-usb-audio-kmod-6.5.11c1.tar.gz not work on 6.6?

meszaros-lajos-gyorgy commented 8 months ago

@geoffreybennett not really, these are the profiles I see:

So I seem to have options and it does record correctly, but everything is mixed into one input channel when I record: microphones and whatever output I hear in my headphones.

And if I select Multichannel Input on it's own, then there's no output, I can't hear anything.

It does work correctly when I switch to my Scarlet 2i4 1st gen though, but that has other issues, which are not really relevant here.

Anganthier commented 8 months ago

@meszaros-lajos-gyorgy

I am using Mint 21.2. I switched to pipewire and replaced pulse. After that the Scarlett 2i2 4th gen appears in the individual controls as expected.

meszaros-lajos-gyorgy commented 8 months ago

@Anganthier thank you for the info, I'll try that out and report back later on how that went.

geoffreybennett commented 8 months ago

Hi @meszaros-lajos-gyorgy,

Sorry I missed this before because for some dumb reason I tested with my Scarlett 3rd Gen Solo, not my 4th Gen.

The reason you see the behaviour you do is because PulseAudio is mixing all 4 channels from the Scarlett down to 1 (if you select Mono recording) or 2 (if you select Stereo recording). Two of the channels from the Scarlett are Loopback audio from what your computer is playing, therefore you get the observed behaviour of recording your playback.

Try this experiment: in Audacity, change the number of recording channels to 4. You should then be recording the line input, the mic input, and the loopback inputs separately.

If that works, you can configure PulseAudio to create a virtual mono device which only records the microphone.

First, find the PulseAudio name of your Scarlett:

g@mint:~$ pactl list sources short | grep multichannel
5       alsa_input.usb-Focusrite_Scarlett_Solo_4th_Gen_XXXXXXXXXXXXXXXX-00.multichannel-input     module-alsa-card.c      s32le 4ch 44100Hz       RUNNING

Then copy-paste that long name into this command:

pactl load-module module-remap-source source_name=Mic master=alsa_input.usb-Focusrite_Scarlett_Solo_4th_Gen_XXXXXXXXXXXXXXXX-00.multichannel-input master_channel_map=front-right remix=no channel_map=mono

In pavucontrol you'll then have a new "Remapped" Input Device: image

Which you'll find works much better: image

If you like that, you can make the change permanent by creating a ~/.config/pulse/default.pa file with contents like this:

g@mint:~$ cat .config/pulse/default.pa
.include /etc/pulse/default.pa

load-module module-remap-source source_name=Mic master=alsa_input.usb-Focusrite_Scarlett_Solo_4th_Gen_XXXXXXXXXXXXXXXX-00.multichannel-input master_channel_map=front-right remix=no channel_map=mono
update-source-proplist Mic device.description=Mic

(I also updated the device.description so it doesn't appear as "Remapped Scarlett Solo etc...")

I'm a huge fan of PipeWire, but I think the above PulseAudio configuration would be simpler for your use case.

If you want to try PipeWire anyway, this is what I did to install it and disable PulseAudio:

sudo apt install pipewire-audio-client-libraries pipewire-pulse wireplumber
systemctl --user daemon-reload
systemctl --user --now mask pulseaudio.service pulseaudio.socket
systemctl --user --now enable pipewire pipewire-pulse wireplumber

And to return to PulseAudio:

systemctl --user --now mask pipewire pipewire-pulse wireplumber
systemctl --user --now unmask pulseaudio.service pulseaudio.socket
systemctl --user --now enable pulseaudio.service pulseaudio.socket

Good luck!

meszaros-lajos-gyorgy commented 3 months ago

@geoffreybennett I finally had some time to look into the tips you sent and it is working correctly. Thank you for the detailed description, I'm gonna close the ticket now.