Low latency possible with usb sound card?

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

Moderators: khz, MattKingUSA

Post Reply
fourfour
Established Member
Posts: 32
Joined: Sat May 28, 2011 6:16 pm

Low latency possible with usb sound card?

Post by fourfour »

Let's say I have two USB keyboards and a USB sound card. I want to be able to play my keyboard and hear a sound while having the 2ms latency like I did when I used ASIO. Can this be accomplished with a basic M-Audio USB sound card? I've heard bad things about USB sound cards and latency. I'll only have two output channels, and at the moment I don't need to input audio.

i2productions
Established Member
Posts: 544
Joined: Sun May 22, 2011 6:14 pm
Location: New Hampshire, US

Re: Low latency possible with usb sound card?

Post by i2productions »

2 ms latency can mean many things, but will never TRUELY get that out of any system. But I can tell you I'm getting pretty close the real time with my lexicon omega usb. Even when recording 4 channels simultaneous.

User avatar
Louigi Verona
Established Member
Posts: 402
Joined: Mon Aug 24, 2009 8:56 am

Re: Low latency possible with usb sound card?

Post by Louigi Verona »

Low latency is possible with usb soundcard.

fourfour
Established Member
Posts: 32
Joined: Sat May 28, 2011 6:16 pm

Re: Low latency possible with usb sound card?

Post by fourfour »

I just want my keyboard to be responsive enough that it is pleasant to play, in particular when I am playing it live. I don't plan on using a RT kernel. I had problems the last time I tried that. Another option is the ExpressCard, but I don't want to splurge $400 on a sound card.

hellalive
Established Member
Posts: 91
Joined: Mon Nov 29, 2010 7:10 pm

Re: Low latency possible with usb sound card?

Post by hellalive »

I own an usb M audio soundcard and i can say RT kernel with rtirq helped me a lot in reaching low latency. You could try the 2.6.39.1 kernel with rtirq - just be shure the USB controller you have connected your card to gets the higher priority possible. Pablo said me this:
Edit /etc/default/rtirq and change the order of "snd" and "usb" in RTIRQ_NAME_LIST, so that usb audio devices have greater priority than pci audio devices.
It worked good.
He had a lot of nithing to say, we'll miss him

User avatar
Capoeira
Established Member
Posts: 1312
Joined: Tue May 12, 2009 1:01 pm
Location: Brazil

Re: Low latency possible with usb sound card?

Post by Capoeira »

hellalive wrote: said me this:
Edit /etc/default/rtirq and change the order of "snd" and "usb" in RTIRQ_NAME_LIST, so that usb audio devices have greater priority than pci audio devices.
It worked good.
you can specify it even more. use lsusb and find out the full name of the usb-port, st like this: usb:ehci1 and put there instead of just USB. Before that, make sure you use a usb-port wich doesn't share the IRQ with another device, els you should unplug all that devices while recording.

hellalive
Established Member
Posts: 91
Joined: Mon Nov 29, 2010 7:10 pm

Re: Low latency possible with usb sound card?

Post by hellalive »

Mmmh..that's interesting. I'll give it a try...just a question: if i have and usb keyboard, should i plug it in an USB sharing the irq with my sound card?
He had a lot of nithing to say, we'll miss him

User avatar
Capoeira
Established Member
Posts: 1312
Joined: Tue May 12, 2009 1:01 pm
Location: Brazil

Re: Low latency possible with usb sound card?

Post by Capoeira »

hellalive wrote:if i have and usb keyboard, should i plug it in an USB sharing the irq with my sound card?
No, that's the point. there should NOT be any usb-device using the same IRQ as your sound-card.
check your irqs. if you are lucky the usb-ports aren't all on the same irq. than change the (fisical)port(s) until your usb-soundcard uses an IRQ allone (only usb-device). than you find out the port with lsusb and put it in the ircq-config-file.
if you do so, and use up to 4 channels there, you should get low latencys as low as with firewire

fourfour
Established Member
Posts: 32
Joined: Sat May 28, 2011 6:16 pm

Re: Low latency possible with usb sound card?

Post by fourfour »

Louigi Verona wrote:Low latency is possible with usb soundcard.
In looking into this more, I would think that USB would be almost as good as a PCI card as the bandwidth on USB is more than what what I use.
Last edited by fourfour on Tue Jul 12, 2011 12:02 am, edited 1 time in total.

fourfour
Established Member
Posts: 32
Joined: Sat May 28, 2011 6:16 pm

Re: Low latency possible with usb sound card?

Post by fourfour »

i2productions wrote:2 ms latency can mean many things, but will never TRUELY get that out of any system. But I can tell you I'm getting pretty close the real time with my lexicon omega usb. Even when recording 4 channels simultaneous.
I had an Emu 1212m in Windows with a keyboard and a software synthesizer. I ran it with the ASIO latency set to 2ms. It wasn't stable enough to use live, but it was great to compose with.

Pablo
Established Member
Posts: 1271
Joined: Thu Apr 17, 2008 9:57 pm

Re: Low latency possible with usb sound card?

Post by Pablo »

You can only rely on a tool like jack_iodelay or jack_delay (or something equivalent in the windows world) to measure real round-trip latencies.

OTOH, after changing priorities with rtirq, it is a good idea to check them. You can use ps or htop. I like htop, sort by PRI (you have to disable "hide kernel threads"). In Rui's site there is a discussion on rtirq, see below. The only thing that should be added to that thread is that if you run a kernel >= 2.6.39 you don't need the RT patch (at the time of writing this, there does not even exist for kernels > 2.6.33) in order to run rtirq, but you need to set a kernel boot parameter: "threadirqs"

http://www.rncbc.org/drupal/node/107

Cheers, Pablo

danboid
Established Member
Posts: 1306
Joined: Sun Aug 26, 2012 11:28 am
Location: England

Re: Low latency possible with usb sound card?

Post by danboid »

Capoeira wrote:
hellalive wrote: said me this:
Edit /etc/default/rtirq and change the order of "snd" and "usb" in RTIRQ_NAME_LIST, so that usb audio devices have greater priority than pci audio devices.
It worked good.
you can specify it even more. use lsusb and find out the full name of the usb-port, st like this: usb:ehci1 and put there instead of just USB. Before that, make sure you use a usb-port wich doesn't share the IRQ with another device, els you should unplug all that devices while recording.
I'm interested in what Cap says here - does specifying the exact usb port make a notable difference over just having usb high (2nd) in the rtirq name list? He gives usb:ehci1 as an example so I presume the 1 is the USB bus number as output from lsusb? No need to specify the device number too?

Just seems strange that I've not seen reference to this anywhere else and Rui doesn't mention the ability to do this in the linked thread, in the rtirq config file nor anywhere else that I've seen but it'd be great if it works!
Are you new to Linux Audio? This manual explains how to install KXStudio, set up and use JACK, mimimize latency, lists the best Linux AV apps and much more all in a concise and easy to understand format.

http://wiki.linuxaudio.org/wiki/kxstudio_manual

User avatar
autostatic
Established Member
Posts: 1728
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Contact:

Re: Low latency possible with usb sound card?

Post by autostatic »

danboid wrote:I'm interested in what Cap says here - does specifying the exact usb port make a notable difference over just having usb high (2nd) in the rtirq name list?
It probably won't make a notable difference but it does allow you to 'isolate' a given USB port regarding priorities.
danboid wrote:He gives usb:ehci1 as an example so I presume the 1 is the USB bus number as output from lsusb? No need to specify the device number too?
Afaik rtirq does pattern matching in some way. ehci would match all entries in /proc/interrupts with ehci in it, usb all entries with usb in it and ehci_hcd:usb1 for instance would match only ehci_hcd:usb1. usb1 means USB bus 1 in this case so not the device ID. Afaik you can't match an exact device ID (since it doesn't have an IRQ). With lsusb you can find out which device is connected to which USB bus. So if your soundcard is connected to a port on bus 1 for instance you could prioritize bus 1 with rtirq.

danboid
Established Member
Posts: 1306
Joined: Sun Aug 26, 2012 11:28 am
Location: England

Re: Low latency possible with usb sound card?

Post by danboid »

Great!

Thanks for clarifying that J! I may have to try that soon.
Are you new to Linux Audio? This manual explains how to install KXStudio, set up and use JACK, mimimize latency, lists the best Linux AV apps and much more all in a concise and easy to understand format.

http://wiki.linuxaudio.org/wiki/kxstudio_manual

Post Reply