[SOLVED] FR 2i2 (v2)

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

Moderators: MattKingUSA, khz

finotti
Established Member
Posts: 528
Joined: Thu Sep 01, 2011 9:07 pm
Has thanked: 88 times
Been thanked: 23 times

[SOLVED] FR 2i2 (v2)

Post by finotti »

I've just got the Focusrite 2i2 (v2, I assume -- metal case and knobs), as it is often mentioned around here, although v2 is pretty new.

I have two problems with it, though:

1) I can't get it to work pulseaudio (without jack). pavucontrol shows it, I see the input meters move when I play, but I hear no sound from it. I can record from it in Audacity (and hear back), but no sound from it.

2) I'm having lots of xruns, unless I run relatively high latency. 48k sample rate, 512 frames and 2 periods (21.3ms of latency), seems to holding up OK. From what I've read, other users can get much lower latency... EDIT: These settings are still giving me xruns all the time...

Now, I am really new to all this, so I am sorry if I am being obtuse here, but I'd appreciate any help.

About my system: I am running aptosid (basically Debian Sid with a custom kernel). Could the kernel be the reason for the xruns?

Here is some info on it:

Code: Select all

$ inxi -A
Audio:     Card-2 C-Media CMI8788 [Oxygen HD Audio] driver: snd_oxygen
           Card-3 Focusrite-Novation driver: USB Audio
           Sound: Advanced Linux Sound Architecture v: k4.9.0-4.slh.1-aptosid-amd64

Code: Select all

$ lsusb | grep Focus
Bus 003 Device 014: ID 1235:8202 Focusrite-Novation

Code: Select all

$ lsmod | grep snd
snd_usb_audio         131041  2
snd_usbmidi_lib        19005  1 snd_usb_audio
snd_seq_dummy           1467  2
snd_seq                45208  10 snd_seq_dummy
snd_usb_podhd           3865  0
snd_usb_line6          21723  1 snd_usb_podhd
snd_oxygen             15438  3
snd_oxygen_lib         28917  1 snd_oxygen
snd_hda_codec          84071  0
snd_mpu401_uart         5763  1 snd_oxygen_lib
snd_hda_core           44481  1 snd_hda_codec
snd_rawmidi            17932  3 snd_mpu401_uart,snd_usb_line6,snd_usbmidi_lib
snd_hwdep               5930  3 snd_hda_codec,snd_usb_audio,snd_usb_line6
snd_seq_device          3240  2 snd_seq,snd_rawmidi
snd_pcm                78327  7 snd_oxygen_lib,snd_hda_codec,snd_usb_audio,snd_hda_core,snd_usb_line6
snd_timer              19353  2 snd_seq,snd_pcm
snd                    56967  25 snd_oxygen_lib,snd_oxygen,snd_hwdep,snd_seq,snd_hda_codec,snd_usb_audio,snd_timer,snd_mpu401_uart,snd_rawmidi,snd_usb_podhd,snd_usb_line6,snd_usbmidi_lib,snd_seq_device,snd_pcm
soundcore               5283  1 snd
usbcore               165880  13 ath9k_htc,usbhid,snd_usb_audio,usb_storage,ehci_hcd,cdc_acm,snd_usb_podhd,snd_usb_line6,xhci_pci,snd_usbmidi_lib,uas,xhci_hcd,ehci_pci

Code: Select all

$ inxi -v3
System:    Host: debian Kernel: 4.9.0-4.slh.1-aptosid-amd64 x86_64 (64 bit gcc: 6.3.0) Desktop: KDE Plasma 5.8.4
           Distro: aptosid 2013-01 Ἑσπερίδες - kde-full - (201305050307)
Machine:   Device: desktop System: ASUS product: All Series
           Mobo: ASUSTeK model: Z87-PRO v: Rev 1.xx UEFI: American Megatrends v: 1707 date: 12/13/2013
CPU:       Quad core Intel Core i7-4771 (-HT-MCP-) cache: 8192 KB
           flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 28833
           clock speeds: max: 3900 MHz 1: 3500 MHz 2: 3500 MHz 3: 3500 MHz 4: 3484 MHz 5: 3481 MHz 6: 3500 MHz
           7: 3468 MHz 8: 3501 MHz
Graphics:  Card: Intel Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller bus-ID: 00:02.0
           Display Server: X.Org 1.19.1 driver: intel Resolution: 1280x1024@60.02hz, 1920x1080@60.00hz
           GLX Renderer: Mesa DRI Intel Haswell Desktop GLX Version: 3.0 Mesa 13.0.3 Direct Rendering: Yes
Network:   Card-1: Intel Ethernet Connection I217-V driver: e1000e v: 3.2.6-k port: f080 bus-ID: 00:19.0
           IF: eth0 state: up speed: 100 Mbps duplex: full mac: e0:3f:49:a3:4c:a6
           Card-2: NetGear WNA1100 Wireless-N 150 [Atheros AR9271] driver: ath9k_htc usb-ID: 003-003
           IF: wlx4c60de719837 state: N/A mac: N/A
Drives:    HDD Total Size: 9257.9GB (51.7% used)
           ID-1: model: WDC_WD10EALS
           ID-2: model: WDC_WD20EARX
           ID-3: model: WDC_WD20EARX
           ID-4: model: Samsung_SSD_840
           ID-5: model: WDC_WD40EZRX
Info:      Processes: 305 Uptime: 2 days Memory: 7234.8/15737.1MB Init: systemd runlevel: 5 Gcc sys: 6.3.0
           Client: Shell (bash 4.4.71) inxi: 2.3.5 
Best to all,

Luis
Last edited by finotti on Tue Jan 31, 2017 8:01 pm, edited 1 time in total.
User avatar
sadko4u
Established Member
Posts: 988
Joined: Mon Sep 28, 2015 9:03 pm
Has thanked: 2 times
Been thanked: 361 times

Re: FR 2i2 (v2)

Post by sadko4u »

You should use realtime kernel to get low latency.
LSP (Linux Studio Plugins) Developer and Maintainer.
CrocoDuck
Established Member
Posts: 1133
Joined: Sat May 05, 2012 6:12 pm
Been thanked: 17 times

Re: FR 2i2 (v2)

Post by CrocoDuck »

Very often some configuration is needed in order to get best audio performances. See this for links to various documentation pages.

I would recommend to use realTimeConfigQuickScan. It will check your system and give suggestions to improve performance by linking to documentation pages.

As long as ALSA sees your card, Pulse should be able to use it. Check your DE audio settings. Very often they are a GUI front end for PulsaAudio as well. Chances are they are overriding Pavucontrol.

See also this.
finotti
Established Member
Posts: 528
Joined: Thu Sep 01, 2011 9:07 pm
Has thanked: 88 times
Been thanked: 23 times

Re: FR 2i2 (v2)

Post by finotti »

CrocoDuck wrote:Very often some configuration is needed in order to get best audio performances. See this for links to various documentation pages.

I would recommend to use realTimeConfigQuickScan. It will check your system and give suggestions to improve performance by linking to documentation pages.

As long as ALSA sees your card, Pulse should be able to use it. Check your DE audio settings. Very often they are a GUI front end for PulsaAudio as well. Chances are they are overriding Pavucontrol.

See also this.
Again, thanks CrocoDuck for a very informative post! Really nice resources and I will look over them carefully soon to see if it will solve my latency problems. Unfortunately, I could not run realTimeConfigQuickScan as it gives me an error, but I will see if I can find out what is wrong.

BTW, the current kernel, according to the distro maintainer:
We use HZ_1000 and NO_HZ, that should get quite a long way, but I can't promise that it will be enough for professional use (and no, we don't/ won't offer a dedicated -rt patched kernel).
Does anyone familiar with kernel configurations think that these settings would be enough for relatively low latency? If at all possible, I'd like to stick with the distro's kernel.

Anyway, I see that Debian has an RT kernel and will give it a try too.
CrocoDuck
Established Member
Posts: 1133
Joined: Sat May 05, 2012 6:12 pm
Been thanked: 17 times

Re: FR 2i2 (v2)

Post by CrocoDuck »

finotti wrote:Does anyone familiar with kernel configurations think that these settings would be enough for relatively low latency?
Here you can find the "good" kernel characteristics. The matter was discussed here also.

I need a RT kernel to get the best out of my old gen 2i2. However, this might not be the case for you. It is worth to get realTimeConfigQuickScan running and go through the checklist. noatime can give very significant boost, for example. If that does not suffice, you will perhaps need an RT kernel or some other advanced stuff.

On Debian, I use the one from DebianMultimedia.
finotti
Established Member
Posts: 528
Joined: Thu Sep 01, 2011 9:07 pm
Has thanked: 88 times
Been thanked: 23 times

Re: FR 2i2 (v2)

Post by finotti »

CrocoDuck wrote:
finotti wrote:Does anyone familiar with kernel configurations think that these settings would be enough for relatively low latency?
Here you can find the "good" kernel characteristics. The matter was discussed here also.

I need a RT kernel to get the best out of my old gen 2i2. However, this might not be the case for you. It is worth to get realTimeConfigQuickScan running and go through the checklist. noatime can give very significant boost, for example. If that does not suffice, you will perhaps need an RT kernel or some other advanced stuff.

On Debian, I use the one from DebianMultimedia.
Thanks, again! I could get realTimeConfigQuickScan to work, and it is very nice. The http://wiki.linuxaudio.org/wiki/system_configuration page is a godsend! Thank you so much to point me to that!
User avatar
ufug
Established Member
Posts: 525
Joined: Tue Jan 10, 2012 12:28 am
Has thanked: 73 times
Been thanked: 22 times

Re: FR 2i2 (v2)

Post by ufug »

Also try 3 periods instead of 2. I can't remember where I read it, but 3 often works better for USB cards. My 2i2 runs 48k/128 with only a very, very rare xrun.

Crocoduck, what an amazing resource your page is. Can't believe I never saw it before.
listenable at c6a7.org
CrocoDuck
Established Member
Posts: 1133
Joined: Sat May 05, 2012 6:12 pm
Been thanked: 17 times

Re: FR 2i2 (v2)

Post by CrocoDuck »

ufug wrote:Also try 3 periods instead of 2. I can't remember where I read it, but 3 often works better for USB cards. My 2i2 runs 48k/128 with only a very, very rare xrun.
Perhaps here?
ufug wrote:Crocoduck, what an amazing resource your page is. Can't believe I never saw it before.
Uh thanks :D ! Hopefully I will be able to maintain the links.
finotti
Established Member
Posts: 528
Joined: Thu Sep 01, 2011 9:07 pm
Has thanked: 88 times
Been thanked: 23 times

Re: FR 2i2 (v2)

Post by finotti »

ufug wrote:Also try 3 periods instead of 2. I can't remember where I read it, but 3 often works better for USB cards. My 2i2 runs 48k/128 with only a very, very rare xrun.

Crocoduck, what an amazing resource your page is. Can't believe I never saw it before.
Thanks, I was not aware of that!
CrocoDuck wrote:
ufug wrote:Also try 3 periods instead of 2. I can't remember where I read it, but 3 often works better for USB cards. My 2i2 runs 48k/128 with only a very, very rare xrun.
Perhaps here?
Again, very helpful link! Thanks!
gimmeapill
Established Member
Posts: 564
Joined: Thu Mar 12, 2015 8:41 am
Has thanked: 44 times
Been thanked: 8 times

Re: FR 2i2 (v2)

Post by gimmeapill »

ufug wrote:Also try 3 periods instead of 2. I can't remember where I read it, but 3 often works better for USB cards. My 2i2 runs 48k/128 with only a very, very rare xrun.
Agree, 3 periods is the sane default for USB cards.
One thing to add: check the physical connectivity. No Hub, direct connection to the fastest USB ports on your mobo. Might be also worth trying another USB cable.
finotti
Established Member
Posts: 528
Joined: Thu Sep 01, 2011 9:07 pm
Has thanked: 88 times
Been thanked: 23 times

Re: FR 2i2 (v2)

Post by finotti »

OK, I've done virtually all the tweaks from http://wiki.linuxaudio.org/wiki/system_configuration.

Code: Select all

$ perl -I ./ ./realTimeConfigQuickScan.pl
== GUI-enabled checks ==
Checking if you are root... no - good
Checking filesystem 'noatime' parameter... 4.9.0 kernel - good
(relatime is default since 2.6.30)
Checking CPU Governors... CPU 0: 'performance' CPU 1: 'performance' CPU 2: 'performance' CPU 3: 'performance' CPU 4: 'performance' CPU 5: 'performance' CPU 6: 'performance' CPU 7: 'performance'  - good
Checking swappiness... 10 - good
Checking for resource-intensive background processes... none found - good
Checking checking sysctl inotify max_user_watches... >= 524288 - good
Checking access to the high precision event timer... readable - good
Checking access to the real-time clock... readable - good
Checking whether you're in the 'audio' group... yes - good
Checking for multiple 'audio' groups... no - good
Checking the ability to prioritize processes with chrt... yes - good
Checking kernel support for high resolution timers... found - good
Kernel with Real-Time Preemption... found - good
Checking if kernel system timer is high-resolution... found - good
Checking kernel support for tickless timer... found - good
== Other checks ==
Checking filesystem types... ok.
not found.
** Warning: no tmpfs partition mounted on /tmp
   For more information, see:
   - http://wiki.linuxaudio.org/wiki/system_configuration#tmpfs
   - http://lowlatency.linuxaudio.org
** Set $SOUND_CARD_IRQ to the IRQ of your soundcard to enable more checks.
   Find your sound card's IRQ by looking at '/proc/interrupts' and lspci
I also set jack to 512 frames and 3 periods. I tried 128 and 256 frames, but it was unusable. With 512 frames I still got a bunch of xruns (I'd say about 20 in a one hour recording session), but it was usable...

I could live with it, but I was expecting less xruns (or less latency). I might try a lighter DE (I'm currently running KDE), but I thought the system would be able handle it (Intel Core i7-4771, 16GB of memory, SSD).

I think my next step is to try different USB ports or cables. Is there anything more efficient than trial and error? Here is some info:

Code: Select all

$ lsusb
Bus 004 Device 002: ID 8087:8000 Intel Corp. 
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 8087:8008 Intel Corp. 
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 174c:3074 ASMedia Technology Inc. ASM1074 SuperSpeed hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 046d:c52f Logitech, Inc. Unifying Receiver
Bus 001 Device 004: ID 046d:c517 Logitech, Inc. LX710 Cordless Desktop Laser
Bus 001 Device 003: ID 0846:9030 NetGear, Inc. WNA1100 Wireless-N 150 [Atheros AR9271]
Bus 001 Device 007: ID 0e41:414a Line6, Inc. 
Bus 001 Device 002: ID 174c:2074 ASMedia Technology Inc. ASM1074 High-Speed hub
Bus 001 Device 006: ID 1235:8202 Focusrite-Novation 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
You can see the result of "lsubs -v" here: http://pastebin.com/AbC1TpXx

And, if relevant at all:

Code: Select all

 cat /proc/interrupts
           CPU0       CPU1       CPU2       CPU3       CPU4       CPU5       CPU6       CPU7       
  0:         18          0          0          0          0          0          0          0  IR-IO-APIC   2-edge      timer
  1:          1          0          0          0          0          1          0          0  IR-IO-APIC   1-edge      i8042
  8:          0          0          0          0          0          1          0          0  IR-IO-APIC   8-edge      rtc0
  9:          1          0          0          0          1          2          0          0  IR-IO-APIC   9-fasteoi   acpi
 12:          3          1          0          0          0          0          0          0  IR-IO-APIC  12-edge      i8042
 16:         18          0          5          6          1          4          0         87  IR-IO-APIC  16-fasteoi   ehci_hcd:usb3
 18:          0          0          0      20629          0          0          0     488037  IR-IO-APIC  18-fasteoi   i801_smbus, snd_oxygen_lib
 23:         21          0          1          1        109          5          4          0  IR-IO-APIC  23-fasteoi   ehci_hcd:usb4
 24:          0          0          0          0          0          0          0          0  DMAR-MSI   0-edge      dmar0
 25:          0          0          0          0          0          0          0          0  DMAR-MSI   1-edge      dmar1
 27:         62          3          1          3          6     183642          1          3  IR-PCI-MSI 409600-edge      eth0
 28:       4888    9763245       8715         67       2852   27707467     105896         80  IR-PCI-MSI 327680-edge      xhci_hcd
 29:       2733       1915        364        146     303205       2115       1252        428  IR-PCI-MSI 512000-edge      ahci[0000:00:1f.2]
 30:         38          3          2          0         15          6       5390          4  IR-PCI-MSI 1572864-edge      ahci[0000:03:00.0]
 31:          0          0          0          0          5          3          3          0  IR-PCI-MSI 360448-edge      mei_me
 32:         34          1     540171          0         31         38          6         21  IR-PCI-MSI 32768-edge      i915
NMI:         23         38         24         24         21         31         23         22   Non-maskable interrupts
LOC:     659321     593409     679865     606082     660441     755430     643218     678579   Local timer interrupts
SPU:          0          0          0          0          0          0          0          0   Spurious interrupts
PMI:         23         38         24         24         21         31         23         22   Performance monitoring interrupts
IWI:          0          0          0          0          0          0          0          0   IRQ work interrupts
RTR:          0          0          0          0          0          0          0          0   APIC ICR read retries
RES:      74618     159953      26643      31447      35757      74256      29171      27721   Rescheduling interrupts
CAL:     156993     154257     188460     159388     170081     187738     182483     164765   Function call interrupts
TLB:     153589     151753     185871     156248     167461     185189     179957     162240   TLB shootdowns
TRM:          0          0          0          0          0          0          0          0   Thermal event interrupts
THR:          0          0          0          0          0          0          0          0   Threshold APIC interrupts
DFR:          0          0          0          0          0          0          0          0   Deferred Error APIC interrupts
MCE:          0          0          0          0          0          0          0          0   Machine check exceptions
MCP:         38         38         38         38         38         38         38         38   Machine check polls
ERR:          0
MIS:          0
PIN:          0          0          0          0          0          0          0          0   Posted-interrupt notification event
PIW:          0          0          0          0          0          0          0          0   Posted-interrupt wakeup event
Thanks all for the valuable input!
finotti
Established Member
Posts: 528
Joined: Thu Sep 01, 2011 9:07 pm
Has thanked: 88 times
Been thanked: 23 times

Re: FR 2i2 (v2)

Post by finotti »

By the way, does it make any difference if I connect the input of the 2i2 to the output of my sound card (instead of input and output from the 2i2)? That's how I have it set up now.
gimmeapill
Established Member
Posts: 564
Joined: Thu Mar 12, 2015 8:41 am
Has thanked: 44 times
Been thanked: 8 times

Re: FR 2i2 (v2)

Post by gimmeapill »

By the way, does it make any difference if I connect the input of the 2i2 to the output of my sound card (instead of input and output from the 2i2)? That's how I have it set up now.
Do not combine several devices. Your latency is as good as the weakest link in the chain. Not sure how your stuff is connected exactly but it could be that you're getting xruns because of the other card...
gimmeapill
Established Member
Posts: 564
Joined: Thu Mar 12, 2015 8:41 am
Has thanked: 44 times
Been thanked: 8 times

Re: FR 2i2 (v2)

Post by gimmeapill »

Looking a the lsusb output, it seems like the 2i2 is on the same bus as a few other peripherals, including a wireless adapter and a line6 audio device (I assume this is your acquisition card).

I would advise to move the 2i2 to Bus 002:

Code: Select all

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Not sure how to identify it from the outside, this will probably take some trial and error. Those will likely be one of the ports closer to the motherboard, so probably the ones on the back.

Then, try instead with

Code: Select all

lsusb -t
to see the physical hierarchy

And of course recommendation is to take the Line6 device out of the equation - at least during troubleshooting and performance tuning.
Regarding the DE, yes it can also help to use something that doesn't require graphic acceleration. But this is not necessarily a deal breaker.
finotti
Established Member
Posts: 528
Joined: Thu Sep 01, 2011 9:07 pm
Has thanked: 88 times
Been thanked: 23 times

Re: FR 2i2 (v2)

Post by finotti »

gimmeapill wrote:
By the way, does it make any difference if I connect the input of the 2i2 to the output of my sound card (instead of input and output from the 2i2)? That's how I have it set up now.
Do not combine several devices. Your latency is as good as the weakest link in the chain. Not sure how your stuff is connected exactly but it could be that you're getting xruns because of the other card...
Yes, it just occurred to me when I was writing my other post. I will check if going only through the 2i2 makes a difference.
gimmeapill wrote:Looking a the lsusb output, it seems like the 2i2 is on the same bus as a few other peripherals, including a wireless adapter and a line6 audio device (I assume this is your acquisition card).

I would advise to move the 2i2 to Bus 002:

Code: Select all

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Not sure how to identify it from the outside, this will probably take some trial and error. Those will likely be one of the ports closer to the motherboard, so probably the ones on the back.

Then, try instead with

Code: Select all

lsusb -t
to see the physical hierarchy

And of course recommendation is to take the Line6 device out of the equation - at least during troubleshooting and performance tuning.
Regarding the DE, yes it can also help to use something that doesn't require graphic acceleration. But this is not necessarily a deal breaker.
Interesting... Physically, the USB port I've connected is far from some of the other stuff connected to the same bus... I will definitely try different ports, and thanks for your help! (I did have the Line 6 disconnected when recording. I turned it on only to have access to information about it while at work, if necessary.)
Post Reply