Focusrite Scarlett 2i4 - success!

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

Moderators: MattKingUSA, khz

tux99
Established Member
Posts: 346
Joined: Fri Sep 28, 2012 10:42 am
Contact:

Re: Focusrite Scarlett 2i4 - success!

Post by tux99 »

danboid wrote:"The output lets you know about the format the hardware uses on the wire.
Interesting, so that means the Focusrite Scarlett 2i4 records at 24 bit (i.e. the ADC uses 24 bit) but then transfers the recording over the wire as 32 bit.

I wonder why it does that, seems like an unnecessary waste of USB bandwidth to me?

It could be interesting asking Focusrite tech support why it does that.
danboid
Established Member
Posts: 1327
Joined: Sun Aug 26, 2012 11:28 am
Location: England
Has thanked: 1 time
Been thanked: 4 times

Re: Focusrite Scarlett 2i4 - success!

Post by danboid »

<facepalm>

Public apology time from me to the ffmpeg devs - it was the dunce writing this who was at fault all along for having qtractor set to record to 16bit signed wavs instead of 24 or 32bit so my ever active (a bit too much you might say) dreaded finger of questionability has now swung over to those naughty Audacity devs. I tried again with another 16bit wav (according to sndfile-info, mediainfo and ffmpeg) but Audacity was still telling me it was a 32bit float file - tssk tsk! sndfile-info is contained within sndfile-programs for Debuntu'ers btw.

I have re-done my basic test procedure of recording from two phantom powered mics simultaneously then overdubbing another couple of tracks, again at the default JACK settings of 1024 frames/period and 2 periods/buffer but this time recording to 32bit integer wavs under qtractor and the 2i4 passed again with no xruns under my stock Wheezy amd64 kernel so all seems well still.

I could very likely just as well record to 24bit integer wavs and get the same quality I presume but seeing as JACK says its using 32bit integer I'm a bit wary of any slight loss of quality due to resampling to 24bit. Would you care to comment RNCBC?
User avatar
autostatic
Established Member
Posts: 1994
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Has thanked: 32 times
Been thanked: 104 times
Contact:

Re: Focusrite Scarlett 2i4 - success!

Post by autostatic »

Why 2 periods/buffer? Or does using 3 periods/buffer not apply for USB2 devices?
j_e_f_f_g
Established Member
Posts: 2032
Joined: Fri Aug 10, 2012 10:48 pm
Been thanked: 357 times

Re: Focusrite Scarlett 2i4 - success!

Post by j_e_f_f_g »

tux99 wrote:the ADC uses 24 bit but then transfers the recording over the wire as 32 bit. I wonder why it does that
Many of the new interfaces are now using CPUs and DSP chips that can access memory only in 8, 16, or 32 bit words; not 24-bit. For example, Intel/AMD CPUs can't directly manipulate a 24-bit word. So internally, a 24-bit device must make each sample 32-bit. That doesn't mean you get any extra resolution. They just pad out the upper, or lower 4 bits with zeroes. I assume Focusrite transfers it as 32-bit because a driver running on Intel/AMD ultimately must pad out to 32-bit anyway. So in this case, it's not going to be less efficient (than if you converted 24 to 32, twice).

The OP should record at 32-bit linear. He should not use plughw to convert to 24-bit during recording/playback, as that will add latency. After recording, if desired, use the DAW's "sample conversion" function (most DAWs have such a feature) to convert to 24-bit linear. (Or just choose to save as 24-bit wave file). There will be no loss of fidelity whatsoever.

Author of BackupBand at https://sourceforge.net/projects/backupband/files/
My fans show their support by mentioning my name in their signature.

danboid
Established Member
Posts: 1327
Joined: Sun Aug 26, 2012 11:28 am
Location: England
Has thanked: 1 time
Been thanked: 4 times

Re: Focusrite Scarlett 2i4 - success!

Post by danboid »

Thanks Jeff!

Rui agrees I'm safe to stick with 24bit. He replied:

"For strict disk space savings and without any loss of quality you should use 24bit.

JACK uses 32-bit float and as it uses the mantissa to hold scalar values that maps neatly to 24-bit integer word-lengths.

Resampling has no place here, unless there's disparate sample-rates involved - what matters is sample format conversion. As said, converting 24-bit integer to/from 32-bit float has no significant loss of information, if any at all.

There's also no need for dithering, an option found useful when converting from different word-lengths eg. to/from 16-bit integer, which is not the case here."

So 24bit it shall be!
danboid
Established Member
Posts: 1327
Joined: Sun Aug 26, 2012 11:28 am
Location: England
Has thanked: 1 time
Been thanked: 4 times

Re: Focusrite Scarlett 2i4 - success!

Post by danboid »

Although I've not put much time into it, I have so far failed to get xrun free JACK with my 2i4 at anything smaller than 1024 frames/period and 2 periods/buffer (which equates to a 40+ ms latency) in my 'vanilla' Deb Wheezy amd64 install . Thats with its standard kernel and the Nvidia non-free binary blob driver from the Deb testing repos so I'm sure I could do much better if I installed their RT kernel (still not tried this yet), rtirq etc. Is the official Debian RT kernel any good?

I finally got round to installing the latest (last) AV Linux 6 and JACK steadily and happily purrs along on the Scarlett 2i4 at a far superior 128 frames w/ 2 periods/buffer giving me a much more usable ~5ms latency. Great work Gmaq and trulan!
User avatar
autostatic
Established Member
Posts: 1994
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Has thanked: 32 times
Been thanked: 104 times
Contact:

Re: Focusrite Scarlett 2i4 - success!

Post by autostatic »

Why 2 periods/buffer? Or does using 3 periods/buffer not apply for USB2 devices?
danboid
Established Member
Posts: 1327
Joined: Sun Aug 26, 2012 11:28 am
Location: England
Has thanked: 1 time
Been thanked: 4 times

Re: Focusrite Scarlett 2i4 - success!

Post by danboid »

2 periods simply because I can achieve lower latency - seems to work for me. I have normally had to set periods to 3 with onboard audio devices to avoids xruns but that doesn't seem to apply here.
User avatar
autostatic
Established Member
Posts: 1994
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Has thanked: 32 times
Been thanked: 104 times
Contact:

Re: Focusrite Scarlett 2i4 - success!

Post by autostatic »

In the case of USB, JACK works best if the software latency is a multiple of 1ms. You can only achieve this if the sample rate is 48kHz, 96kHz or 192kHz (because software latency is frames/sample rate*periods). Using 64 frames, 3 periods and 48kHz sample rate yields a software latency of 4ms for instance and a USB interface should work fine without xruns with these settings. You can go even lower as ending up with a software latency that has to be a whole number in ms can also be achieved with 2 periods, for instance you should be able to achieve 2ms of software latency with a setting of 2 periods, 48 frames and a sample rate of 48kHz. My Edirol UA-25 starts up with this setting and I can also run some software without xruns.
danboid
Established Member
Posts: 1327
Joined: Sun Aug 26, 2012 11:28 am
Location: England
Has thanked: 1 time
Been thanked: 4 times

Re: Focusrite Scarlett 2i4 - success!

Post by danboid »

Autostatic & (potential) Linux Scarlett 2i4 users:

Excellent suggestion J and I'm kicking myself for having not thought to try it myself before because it turns out using 3 Periods/Buffer with Frames/Period at 64 not only gives me better latency (4ms) but it seems to run rock steady with qtractor and my fave plugins under AVL6. It would seem that is the optimum setting as it falls over quickly if I reduce frames to 32.

No-ones going to complain about 4ms so I'm a very happy Focusrite / Linux camper now! :D
User avatar
autostatic
Established Member
Posts: 1994
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Has thanked: 32 times
Been thanked: 104 times
Contact:

Re: Focusrite Scarlett 2i4 - success!

Post by autostatic »

danboid wrote:It would seem that is the optimum setting as it falls over quickly if I reduce frames to 32.
Does JACK start with 32 frames??? I can't go below 48, that's the lowest setting possible for my UA-25.
danboid
Established Member
Posts: 1327
Joined: Sun Aug 26, 2012 11:28 am
Location: England
Has thanked: 1 time
Been thanked: 4 times

Re: Focusrite Scarlett 2i4 - success!

Post by danboid »

Yes, I can start JACK at 32 and even 16 frames but both suffer regular and frequent xruns - especially at 16.
User avatar
autostatic
Established Member
Posts: 1994
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Has thanked: 32 times
Been thanked: 104 times
Contact:

Re: Focusrite Scarlett 2i4 - success!

Post by autostatic »

Wow, that's nice to know! That means the Scarlett can achieve lower latencies than my revered UA-25 and probably with lower DSP load too. So in case I'd need a replacement I know where to look ;)
tbritton
Established Member
Posts: 33
Joined: Sun Jan 29, 2012 4:22 am
Been thanked: 2 times

Re: Focusrite Scarlett 2i4 - success!

Post by tbritton »

AutoStatic wrote:Wow, that's nice to know! That means the Scarlett can achieve lower latencies than my revered UA-25 and probably with lower DSP load too. So in case I'd need a replacement I know where to look ;)
I just used your calculations and set the FocusRite 2i2 USB interface to 24 frames, 2 periods at 48000 and am amazed that no xruns exist.

As your forumula predicts (frames/sample rate)*periods, which theoretically produces 1ms, though JACK reports that I have a 0.5ms latency -- and with no xruns. This is using the Realtime setting in KXStudio 12.04.1's low-latency kernel. So, I imagine the 2i4 will be able to pull this off also! (I was surprised that KXStudio's Cadence allowed me to type in my frames entries - I thought I would be constrained to the values in the drop-down!)

Interestingly, using your proposed (48/48000)*2 for 2ms latency gave me a single xrun upon restart, but then never got another one.

(32/48000)*3 stayed steady at a reported 0.7ms rather than the predicted 2ms. Got one xrun in fifteen minutes. Well, we'll have to see how it goes in real life! I can certainly live with (64/48000)*3 for a 4ms latency and never an xrun any day of the week! (Cadence reports 1.3ms latency - which do I believe? The math ... or Cadence?)

Terry
Pablo
Established Member
Posts: 1274
Joined: Thu Apr 17, 2008 9:57 pm
Been thanked: 3 times

Re: Focusrite Scarlett 2i4 - success!

Post by Pablo »

For measuring real round-trip latency, use jack_iodelay.

http://www.linuxmusicians.com/viewtopic.php?f=19&t=8022
Post Reply