Scarlett 18i20 gen 3 Linux - Crackling Audio

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

Moderators: MattKingUSA, khz

User avatar
sadko4u
Established Member
Posts: 986
Joined: Mon Sep 28, 2015 9:03 pm
Has thanked: 2 times
Been thanked: 359 times

Re: Scarlett 18i20 gen 3 Linux - Crackling Audio

Post by sadko4u »

lapsio wrote: Thu Nov 12, 2020 1:17 pm Anyways - does anyone here know ANY 16x16 or above interface (using ADAT) that IS NOT Behringer UMC1820 and works on Linux without this implicit feedback bug? Currently I'm using UMC1820 as master and 18i20 as ADAT slave (so I don't need to patch kernel) but I just realised UMC1820 is crap and its headphone amps don't keep balance correctly so I'm looking for something that can provide more decent quality and still work on Linux without manual kernel patching...
AFAIR, there are Presonus and RME devices which are supported. But that's not 100% guarantee. I believe you should ask about these devices somewhere, too.
Anyway, I'm currently working on Scarlett 18i20 gen3 device and have significant improvements. But this requires the kernel to be patched.
LSP (Linux Studio Plugins) Developer and Maintainer.
GannoK
Posts: 1
Joined: Wed Jan 20, 2021 11:08 pm

Re: Scarlett 18i20 gen 3 Linux - Crackling Audio

Post by GannoK »

puleglot wrote: Wed May 20, 2020 4:44 pm Updated patch. Added Scarlett 18i8 3rd Gen. Also slightly changed the way to get altsetting.
Hi, sorry if this is considered a bad bump or whatever, but I have a ficusrite 8i6 3rd gen and looked around and read the manual a bit, but I'm still a little confused as to how to apply this patch, as I think it's the solution to my problem, because I've tried dammn near everything else you can find on the internet.


I first tried running this patch in my terminal, because I have no clue how to apply it and I get;

zsh: parse error near `/*'

i then read this and got more confused and thus more research and manual reading.
https://wiki.archlinux.org/index.php/Ke ... figuration
https://wiki.archlinux.org/index.php/Ke ... e_PKGBUILD
https://forum.level1techs.com/t/solved- ... inux/95538


I read this one and tried what they have done
lapsio wrote: Sun Mar 15, 2020 6:36 pm Any assistance / tutorial on how can I apply this patch? It's not like I'm patching my kernel twice a day xD
It's quite old kernel but I have kernel sources installed since they were needed for VMWare and VBox DKMS modules.

But if it's not really possible to do on old kernel I can spin up quickly some Arch Linux just to confirm whether this patch works and then I'll be screwing around with my old junk.

EDIT:
`/usr/src/linux-x.x.x/sound/usb/pcm.c` file on my desktop from kernel 4.6 looks significantly different and path is not applicable directly. However I found pcm.c file on my laptop (kernel 5.3.7) to be similar so I applied source patch here. Can I compile this module now in some relatively automated way? I mean I'd like to preserve as many settings as possible in order to not break something else in system.
and it didn't look like this was much help either. I tried looking for a specific version of the linux kernel as indicated in the previous post but there was only Linux and linux-vfio-lts(which I'm setting up later after I get audio fixed) in the /usr/src/linux directory. I looked in both and in the sound/usb but no pcm.c file exists. I dont know if I am supposed to create one or run the script, and I don't want to break the kernel.
puleglot wrote: Sun Mar 15, 2020 10:58 pm
lapsio wrote: Sun Mar 15, 2020 6:36 pm EDIT:
`/usr/src/linux-x.x.x/sound/usb/pcm.c` file on my desktop from kernel 4.6 looks significantly different and path is not applicable directly. However I found pcm.c file on my laptop (kernel 5.3.7) to be similar so I applied source patch here.
The 4.6 kernel is pretty old and the code in set_sync_ep_implicit_fb_quirk() was reorganized since then. So it is better to try 5.4 or newer, but 5.3 should be also fine I guess.
lapsio wrote: Sun Mar 15, 2020 6:36 pm Can I compile this module now in some relatively automated way? I mean I'd like to preserve as many settings as possible in order to not break something else in system.
To preserve configuration of the running kernel:
# cd /usr/src/linux-x.x.x/
# zcat /proc/config.gz > .config
# make oldconfig
# cd /usr/src/linux/
su (because these commands wont work as normal user, even with sudo)
# zcat /proc/config.gz > .config
# make oldconfig

last command gives me this output

lib/Kconfig.debug:2449: can't open file "Documentation/Kconfig"
make[1]: *** [scripts/kconfig/Makefile:71: oldconfig] Error 1
make: *** [Makefile:602: oldconfig] Error 2


currently trying sudo patch -p0 scarlett_gen3_implicit_fb\ \(3\).txt in the /Downloads/linux-5.4.91/sound/usb directory
also tried sudo patch -p1 scarlett_gen3_implicit_fb.txt(same patch just renamed it) in /Downloads/linux-5.4.91
also turned it into a .patch file via vim, and its curently sitting on a blank prompt as I run the patch command

looks like it's running and doing something, but I will edit if/when it finishes and if any difference is made after regenerating initramfs and recompiling

Edit: I let it run for a long time, a few hours and I have a pretty decent PC but it still hasnt done anything past asking for my password. Nothing has changed, just sitting on a blank screen after entering the password. I also tried editing the /etc/pulse/daemon.conf to enable all the proper parameters as per the wiki dictates before running the patch command. really bummed I can't figure this out.

currently running the 5.4.91-1-lts kernel


Update:

I have tried the patch on the vfio-lts kernel, and it's able to run t he updpkgsums command properly with the patch applied, but when I run makepkg -s or makepkg -si, I get the following

Code: Select all

> makepkg -si
==> Making package: linux-vfio-lts 5.4.90-1 (Thu 21 Jan 2021 08:20:39 PM PST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Found linux-5.4.90.tar.xz
  -> Found linux-5.4.90.tar.sign
  -> Found config
  -> Found 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
  -> Found 0002-virt-vbox-Add-support-for-the-new-VBG_IOCTL_ACQUIRE_.patch
  -> Found sphinx-workaround.patch
  -> Found add-acs-overrides.patch
  -> Found i915-vga-arbiter.patch
  -> Found patch.patch
==> Validating source files with sha256sums...
    linux-5.4.90.tar.xz ... Passed
    linux-5.4.90.tar.sign ... Skipped
    config ... Passed
    0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch ... Passed
    0002-virt-vbox-Add-support-for-the-new-VBG_IOCTL_ACQUIRE_.patch ... Passed
    sphinx-workaround.patch ... Passed
    add-acs-overrides.patch ... Passed
    i915-vga-arbiter.patch ... Passed
    patch.patch ... Passed
==> Verifying source file signatures with gpg...
    linux-5.4.90.tar ... Passed
==> Extracting sources...
  -> Extracting linux-5.4.90.tar.xz with bsdtar
==> Starting prepare()...
Setting version...
Applying patch 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch...
patching file init/Kconfig
patching file kernel/fork.c
patching file kernel/sysctl.c
patching file kernel/user_namespace.c
Applying patch 0002-virt-vbox-Add-support-for-the-new-VBG_IOCTL_ACQUIRE_.patch...
patching file drivers/virt/vboxguest/vboxguest_core.c
patching file drivers/virt/vboxguest/vboxguest_core.h
patching file drivers/virt/vboxguest/vboxguest_utils.c
patching file include/linux/vbox_utils.h
patching file include/uapi/linux/vbox_vmmdev_types.h
patching file include/uapi/linux/vboxguest.h
Applying patch sphinx-workaround.patch...
patching file Documentation/conf.py
Applying patch add-acs-overrides.patch...
patching file Documentation/admin-guide/kernel-parameters.txt
Hunk #1 succeeded at 3419 (offset 11 lines).
patching file drivers/pci/quirks.c
Hunk #2 succeeded at 4927 (offset 30 lines).
Applying patch i915-vga-arbiter.patch...
patching file drivers/gpu/drm/i915/display/intel_display.c
Hunk #1 succeeded at 15960 (offset 1 line).
Hunk #2 succeeded at 16628 (offset 1 line).
Hunk #3 succeeded at 17125 (offset 4 lines).
patching file drivers/gpu/drm/i915/display/intel_display.h
patching file drivers/gpu/drm/i915/i915_drv.c
patching file drivers/gpu/drm/i915/i915_params.c
patching file drivers/gpu/drm/i915/i915_params.h
Applying patch patch.patch...
patching file sound/usb/pcm.c
Hunk #1 FAILED at 365.
Hunk #2 FAILED at 387.
2 out of 2 hunks FAILED -- saving rejects to file sound/usb/pcm.c.rej
==> ERROR: A failure occurred in prepare().
    Aborting...
I am manually editing the kernel with the lines provided in the patch, and making sure there aren't any duplicate lines. Currently Compiling the linux-vfio-lts AUR Kernel, which is the one I want to use mainly so I can have Arch and Windows Running, and when I just want to solo boot arch, I want to boot into the zen or LTS kernel(not 100% sure how to do this as I can't find a PKGBUILD file to edit to just put the patch.patch file in there to load, so I am assuming I have to manually patch it), I'm assuming the steps are the same?


Update again, ran the patch, compiled the kernel and I am booted into the system on vfio-lts kernel, but I am getting even more choppiness stuttering and pops. However it might be because I am running through IGFX and it's putting an interrupt on the threads for the sound or something, or it might have to do with resampling or bit depths coming from programs, I honestly have no clue at this point other than just throwing more money at this problem. I dont have a real opportunity to try a separate IOMMU for a second GPU for the host, because my case is too small for me to fit the GPU on the bottom PCI slot without taking my motherboard completely out of it's case, which i assume is on a separate iommu and would allow me to run a GPU for the host there and avoid IGFX thus any possible stuttering on the host audio, which is why I am running IGFX and VFIO PCI passthrough for my GPU. I'm sure to any vet of Arch, Linux in general, and programming/patching is looking at this mess and is scoffing, but I'm a complete noob and I'm diving into this head first and this is the most frustrating aspect of linux so far, everything else has been a breeze to get to work and navigate and learn but Audio has been the biggest nightmare and the cause of many lost nights of sleep for me so far.

Last and final update:

I applied to the patch to the linux-rt kernel successfully, built it and installed it, but I still have popping and crackling. Back to square 1 for me.

Funny enough, I said I had enough of this with this, I just swapped hardware interfaces, to an old mbox2, and it works perfectly, :?: :?: I feel like I wasted my time, but I also feel like I learned a lot, and hopefully someone can learn something from my manic writings LOL, mostly be patient, calm and read the wiki COMPLETELY and click relevant links. if someone could help me find a solution to this, I would appreciate it, but I might just give this interface to my wife who is a mac user, instead of having her buy a new one for her music production. could I possibly get a recommendation on an out of the box just works interface for modern kernels from you kind folks?

I thought I was done editing..... but the interface magically started working a day later after I made the kernel, i'm not sure why but I think when I plugged in the mbox2 it solved any and all issues I was clearly having lol. Anyone familiar with this would be a wizard.
Last edited by GannoK on Sun Jan 24, 2021 3:08 am, edited 24 times in total.
User avatar
khz
Established Member
Posts: 1648
Joined: Thu Apr 17, 2008 6:29 am
Location: German
Has thanked: 42 times
Been thanked: 92 times

Re: Scarlett 18i20 gen 3 Linux - Crackling Audio

Post by khz »

lapsio wrote: Thu Nov 12, 2020 1:17 pm Anyways - does anyone here know ANY 16x16 or above interface (using ADAT) that IS NOT Behringer UMC1820 and works on Linux without this implicit feedback bug?
An RME Hammerfall DSP MADI/RayDAT/AIO. I have been using the AIO (18/20 I/O, the MADI/RayDAT has even more I/O) successfully for almost 10 years without any problems. Both sound quality and reliability are excellent. The RME MADI/RayDAT/AIO modules (drivers) are included in the main kernel since kernel version 2.6.39.

Code: Select all

  │ │    <M>   RME Hammerfall DSP MADI/RayDAT/AIO                             │ │ 
RME AIO >> viewtopic.php?p=101909#p101909

Edit: Or use menuconfig to look directly in the kernel - you can also do this online albeit with an older kernel https://menuconfig.org.
. . . FZ - Does humor belongs in Music?
. . GNU/LINUX@AUDIO ~ /Wiki $ Howto.Info && GNU/Linux Debian installing >> Linux Audio Workstation LAW
  • I don't care about the freedom of speech because I have nothing to say.
e1ed
Posts: 1
Joined: Mon Feb 08, 2021 3:58 pm

Re: Scarlett 18i20 gen 3 Linux - Crackling Audio

Post by e1ed »

I've tried @tmsmr's updated patch on top of Ubuntu 20.04.2's 5.8.0-41-lowlatency kernel and it works extremely well under Jack2.
User avatar
Fmajor7add9
Established Member
Posts: 218
Joined: Sun Dec 31, 2017 3:56 am
Location: Might be moving to Montana soon
Has thanked: 48 times
Been thanked: 27 times
Contact:

Re: Scarlett 18i20 gen 3 Linux - Crackling Audio

Post by Fmajor7add9 »

@GannoK were you ever able to VFIO connect audio?
mateopero
Posts: 1
Joined: Mon Apr 26, 2021 5:39 pm

Re: Scarlett 18i20 gen 3 Linux - Crackling Audio

Post by mateopero »

Hi everybody,

I am a new member here, and I have to say that I was happy to find LinuxMusicians community.
That topic saved me also, troubleshooting all my crackling problems with my freshly bought Scarlett 8i6 gen 3 with Ubuntu Studio 20.1

Just as @e1ed I managed to patch and rebuild a 5.8.18 kernel with @tmsmr's last version, and everything sounds all right now.

By the way, I renamed it with a "-lowlatency" queue so that grub accepts to include it in the menu (unless it was not found by "update-grub"), though it is not a true lowlatency kernel. That does the trick anyway:my computer boots on the patched kernel by default and I didn't encounter painful latency problems by now.

EDIT: I've now found that I could "apt source " a lowlatency kernel. I will try this asap.

Let's record music now!

Thank you all for doing this precious job!
Last edited by mateopero on Fri Apr 30, 2021 8:38 pm, edited 2 times in total.
Post Reply