Focusrite Scarlett 2i4, issues with JACK setup under Ubuntu

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

Moderators: MattKingUSA, khz

Post Reply
Arneb
Established Member
Posts: 4
Joined: Fri Nov 23, 2018 8:52 pm

Focusrite Scarlett 2i4, issues with JACK setup under Ubuntu

Post by Arneb »

Hi everyone,

I'm trying to get my Focusrite Scarlett 2i4 to work properly. Specifically, my setup has the Scarlett connected to my Linux machine via USB, and an external device (a Korg Electribe ESX-1) connected to it via Audio In plus MIDI In+Out. As long as the Electribe is turned off, everything's fine; however, as soon as I turn the Electribe on I lose sound from the PC.

I'm running Ubuntu 18.04 and using JACK as the sound server. There's also a PulseAudio instance bridged to JACK. However, the situation with PulseAudio looks somewhat strange on my machine:

Code: Select all

arneb@perimetr-MS-7816:~$ ps faux
[...]
gdm       4409  0.0  0.1 1229696 11960 ?       Ssl  12:09   0:00  \_ /usr/bin/pulseaudio --daemonize=no
arneb     5388  0.7  1.4 1580864 116420 ?      S<Ll 12:10   0:01 pulseaudio --daemonize --high-priority --realtime --exit-idle-time=-1 --file=/usr/share/cadence/pulse2jack/play+rec.pa -n
arneb     5302  0.4  1.6 295000 133072 ?       SLsl 12:10   0:01  \_ /usr/bin/jackdbus auto
Two PulseAudio instances, one under my own uid bridged to JACK via Cadence, one under uid "gdm" which doesn't seem to do anything. I can kill pid 5388 (and lose sound from applications which use a Pulse sink, obviously); however, whenever I try to kill process 4409, a new PulseAudio process is instantly spawned.

Some debug output from before turning the Electribe on:

Code: Select all

arneb@perimetr-MS-7816:~$ sudo fuser -v /dev/snd/*
                     USER        PID ACCESS COMMAND
/dev/snd/controlC0:  gdm        4409 F.... pulseaudio
/dev/snd/controlC1:  gdm        4409 F.... pulseaudio
                     arneb      5302 F.... jackdbus
/dev/snd/controlC2:  gdm        4409 F.... pulseaudio
/dev/snd/pcmC1D0c:   arneb      5302 F...m jackdbus
/dev/snd/pcmC1D0p:   arneb      5302 F...m jackdbus
/dev/snd/seq:        arneb      5304 F.... a2jmidid

arneb@perimetr-MS-7816:~$ sudo aplay -l
**** List of PLAYBACK Hardware Devices ****
[...]
card 1: USB [Scarlett 2i4 USB], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
The same debug output after turning the Electribe on:

Code: Select all

arneb@perimetr-MS-7816:~$ sudo fuser -v /dev/snd/*
                     USER        PID ACCESS COMMAND
/dev/snd/controlC0:  gdm        4409 F.... pulseaudio
/dev/snd/controlC2:  gdm        4409 F.... pulseaudio
/dev/snd/seq:        arneb      5304 F.... a2jmidid

arneb@perimetr-MS-7816:~$ sudo aplay -l
**** List of PLAYBACK Hardware Devices ****
[...]
card 1: USB [Scarlett 2i4 USB], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
I'm kind of at a loss here, and I'd be thankful for suggestions on how to proceed.
User avatar
Michael Willis
Established Member
Posts: 1451
Joined: Mon Oct 03, 2016 3:27 pm
Location: Rocky Mountains, North America
Has thanked: 68 times
Been thanked: 162 times
Contact:

Re: Focusrite Scarlett 2i4, issues with JACK setup under Ubuntu

Post by Michael Willis »

Do you have the first generation or second generation 2i4? I'm using the first-gen one and have had no such trouble.

When you say "I lose sound from the PC", do you mean that you have speakers wired up to the audio out from the 2i4, and they cease playing back sound from the computer when you turn on the Korg? At that point are you able to hear sound from the Korg?

The 2i4 has a dial that fades between "input" and "playback". What is it set for?

Somebody else may be able to deduce your problem based on the diagnostic output that you provided, but I'm not really sure what's going on.
User avatar
Linuxmusician01
Established Member
Posts: 1524
Joined: Mon Feb 23, 2015 2:38 pm
Location: Holland
Has thanked: 756 times
Been thanked: 135 times

Re: Focusrite Scarlett 2i4, issues with JACK setup under Ubuntu

Post by Linuxmusician01 »

Arneb wrote: [...]There's also a PulseAudio instance bridged to JACK.
Do you mean that you have a package like pulseaudio-module-jack installed to use Jack without having close PA?
Arneb wrote: [...]

Code: Select all

arneb@perimetr-MS-7816:~$ sudo fuser -v /dev/snd/*
                     USER        PID ACCESS COMMAND
/dev/snd/controlC0:  gdm        4409 F.... pulseaudio
/dev/snd/controlC2:  gdm        4409 F.... pulseaudio
/dev/snd/seq:        arneb      5304 F.... a2jmidid
Could you stop using a2jmidid just to test things?
Arneb wrote: arneb@perimetr-MS-7816:~$ sudo aplay -l
**** List of PLAYBACK Hardware Devices ****
[...]
card 1: USB [Scarlett 2i4 USB], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0[/code]
Looks like the audio device is properly recognised by Linux. What I'd do to test things: connect the Scarlett USB audio device and connect the Korg Electribe to it without the Midi (nice machine by the way), reboot and then start Jack w/ the command:

Code: Select all

jackd -d alsa --device hw:1 &
Now what? Still no sound?

Now connect the Midi IN cable, check sound and lastly connect the Midi OUT cable.

Good luck!

P.S. How are you trying to get sound out of the Korg/Scarlett: in a DAW or do you have speakers connected to the Scarlett?
merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: Focusrite Scarlett 2i4, issues with JACK setup under Ubuntu

Post by merlyn »

I would try switching the Electribe on, then booting the computer. Your before and after debug outputs show that switching the Electribe on stops jackdbus.
Arneb
Established Member
Posts: 4
Joined: Fri Nov 23, 2018 8:52 pm

Re: Focusrite Scarlett 2i4, issues with JACK setup under Ubuntu

Post by Arneb »

Thanks for all the replies!
Michael Willis wrote:Do you have the first generation or second generation 2i4? I'm using the first-gen one and have had no such trouble.
2nd gen.
When you say "I lose sound from the PC", do you mean that you have speakers wired up to the audio out from the 2i4, and they cease playing back sound from the computer when you turn on the Korg? At that point are you able to hear sound from the Korg?
Yes, exactly.
The 2i4 has a dial that fades between "input" and "playback". What is it set for?
About 40:60.
Linuxmusician01 wrote:Do you mean that you have a package like pulseaudio-module-jack installed to use Jack without having close PA?
Yes, pretty much, though JACK, as well as PulseAudio with the JACK sink from pulseaudio-module-jack, are both started at user login.
Could you stop using a2jmidid just to test things?
Sure, doesn't change the behaviour.
Looks like the audio device is properly recognised by Linux. What I'd do to test things: connect the Scarlett USB audio device and connect the Korg Electribe to it without the Midi (nice machine by the way), reboot and then start Jack w/ the command:

Code: Select all

jackd -d alsa --device hw:1 &
Now what? Still no sound?

Now connect the Midi IN cable, check sound and lastly connect the Midi OUT cable.

Good luck!
To do that, I'd have to not have jackd started automatically at user login, right? How do I get rid of that, and of the PulseAudio instance bridged to it?
P.S. How are you trying to get sound out of the Korg/Scarlett: in a DAW or do you have speakers connected to the Scarlett?
Not entirely sure what you're meaning with "getting sound out of the Scarlett"; I have speakers connected to the Scarlett. I'm using output from the DAW for debugging this because I felt it'd narrow the issue down by not involving PulseAudio.
merlyn wrote:I would try switching the Electribe on, then booting the computer. Your before and after debug outputs show that switching the Electribe on stops jackdbus.
Huh, that actually worked.

I'd still like to understand why, though... (Switching on the Electribe doesn't strictly stop jackdbus, i.e. the process is still alive according to ps faux, it just loses control over the Scarlett or something.)
User avatar
Linuxmusician01
Established Member
Posts: 1524
Joined: Mon Feb 23, 2015 2:38 pm
Location: Holland
Has thanked: 756 times
Been thanked: 135 times

Re: Focusrite Scarlett 2i4, issues with JACK setup under Ubuntu

Post by Linuxmusician01 »

Arneb wrote:[...]
merlyn wrote:I would try switching the Electribe on, then booting the computer. Your before and after debug outputs show that switching the Electribe on stops jackdbus.
Huh, that actually worked.

I'd still like to understand why, though... (Switching on the Electribe doesn't strictly stop jackdbus, i.e. the process is still alive according to ps faux, it just loses control over the Scarlett or something.)
Glad you got it working! :) Why you lost sound after switching on the Electribe? Power issue? USB is 5 Volt and cannot deliver a lot of Watts. Doesn't necessarily have to be a software issure if you ask me. If you really want to know then you can chek if Linux "can see" the Scarlett after said problems:

Code: Select all

cat /proc/asound/cards
Good luck. :)
merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: Focusrite Scarlett 2i4, issues with JACK setup under Ubuntu

Post by merlyn »

Arneb wrote:I'd still like to understand why, though...
The problem was happening with the hardware. When you switch a device on you get 'transients'. If you plug an amplifier in then switch it on you often hear a click or a thump. That's a transient. Good hi-fi amps often have a circuit to mute the output for a second or two at power on so you don't hear a thump.

In this case switching on the Electribe caused the Scarlett to lose contact with the computer. That could be because there was a voltage spike or because there was an increased load on the USB power momentarily.

You could figure out what it was, but since it's effectively 'crashing' the Scarlett it's probably best to stick to switching the Electribe on first. If you want to hot swap audio or MIDI connections make sure the device being connected to the Scarlett is already switched on.
Arneb
Established Member
Posts: 4
Joined: Fri Nov 23, 2018 8:52 pm

Re: Focusrite Scarlett 2i4, issues with JACK setup under Ubuntu

Post by Arneb »

merlyn wrote:
Arneb wrote:I'd still like to understand why, though...
The problem was happening with the hardware. When you switch a device on you get 'transients'. If you plug an amplifier in then switch it on you often hear a click or a thump. That's a transient. Good hi-fi amps often have a circuit to mute the output for a second or two at power on so you don't hear a thump.

In this case switching on the Electribe caused the Scarlett to lose contact with the computer. That could be because there was a voltage spike or because there was an increased load on the USB power momentarily.

You could figure out what it was, but since it's effectively 'crashing' the Scarlett it's probably best to stick to switching the Electribe on first. If you want to hot swap audio or MIDI connections make sure the device being connected to the Scarlett is already switched on.
I've just found that the same (loss of sound, JACK vanishes from /dev/snd) happens when I turn the Electribe off, which suggests that you're right and it's something about the hardware and power spikes.
Linuxmusician01 wrote:Glad you got it working! :) Why you lost sound after switching on the Electribe? Power issue? USB is 5 Volt and cannot deliver a lot of Watts. Doesn't necessarily have to be a software issure if you ask me. If you really want to know then you can chek if Linux "can see" the Scarlett after said problems:

Code: Select all

cat /proc/asound/cards
Good luck. :)
That it does:

Code: Select all

arneb@perimetr-MS-7816:~$ cat /proc/asound/cards
 0 [PCH            ]: HDA-Intel - HDA Intel PCH
                      HDA Intel PCH at 0xf7f10000 irq 30
 1 [USB            ]: USB-Audio - Scarlett 2i4 USB
                      Focusrite Scarlett 2i4 USB at usb-0000:00:14.0-7, high speed
 2 [HDMI           ]: HDA-Intel - HDA ATI HDMI
                      HDA ATI HDMI at 0xf7e60000 irq 31
Thanks to you guys!
Post Reply