Native Instruments USB driver: snd-usb-caiaq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



	Hi folks, I wanted to provide another update on my progress with the  
Native Instruments USB driver in Linux.  After patching the audio  
driver to have a minimum allowable buffer size of 32 frames, I have  
worked hard to tune my test system to eliminate contention and  
xruns.  Without system tuning I found the usb device to be very prone  
to the above problems where my other soundcard, the layla20, worked  
very well and reliably without much tuning.

	After patching and being able to freely assign buffer sizes down to  
32 samples, it became apparent that when connecting to jackd, xruns  
would appear randomly even at very large buffer sizes like 1024.  My  
hope was to find a magic combination of buffer, periods, channels,  
rate and depth (and other options like unlocking memory etc) that  
would be satisfactory for tracking and playing(instruments).  However  
I noticed that even when the jack messages indicated 5 ms to spare, a  
randomly initiated stream of xruns would occur all in the magnitude  
of .1 ms or less and once initiated would continue until shutting  
down the server or crashing jack.  Watching the 'top' system monitor  
the xorg process would go from 1-4% cpu to 30% or more at the same  
time.  Researching xorg process hogging I found copius threads dating  
back to 2001 that have not yet been solved.

	Since USB is notoriously sensitive to resource contention, I did my  
best to learn about system tuning for audio from the alsa help  
pages.  Specifically, dedicating irq's to pci hardware and setting  
pci bus priority policy for audio.

	With a saturday morning, some fresh coffee and a few hours available  
I set about providing my pci USB 2.0 host card with a dedicated IRQ.   
This required card shuffling, and becoming an expert with my bios  
options concerning the peripherals and pci irq allocation.  After  
quite some wrangling I was able to dedicate a high priority IRQ  
number, 10, solely to the card without any sharing.  Continuing, I  
used the setpci command to give this USB card the highest priority on  
the pci bus, and confirmed this.

	Now, after these two adjustments, the behaviour of jackd is much  
improved and the xrun streaming/xorg inflation would not occur until  
selecting very low buffer sizes like 128 or lower.  Trying my usual  
trick of running reaper with wine and the wineasio driver I was able  
to play windows vst instruments at 128 frames.  However, any use of  
the reaper gui or changing of the vst program would initiate the xrun  
stream that would not heal.  So, not quite there yet.  Whereas, with  
my layla20 without system tuning I could do the same thing with  
artifacts on gui use, but that would disappear afterwards.  This is  
similiar in XP to getting glitches when moving windows.

	Given that the whole wine/wineasio/reaper config is like a mutant  
retard configuration I tried a native linux application called Ardour  
2.0.  Starting jack with qjackctl, with no options except realtime,  
Ardour2 connected.  Then from Ardour you can select a buffer size.   
Here, it was necessary to select a very high number like 1024 or 2048  
to 'clear the pipes', and then select 128 frames.  In Ardour2 I  
opened a project containing 4 stereo tracks, and a freeverb on the  
master that used around 30% cpu total.  I reset the qjackctl  
statistics and left Ardour2 to run overnight and through the  
morning.  The NI Rig control has now been running for 17 hours at 128  
samples in Ardour2 without a single xrun.  Using the ardour gui,  
loading additional plugins on the master and min/maxing windows has  
not produced any more xruns.  Smooth as silk.

	Next I will try recording and live monitoring including the kore  
controller.

	I think some things in the driver could be improved as it seems very  
delicate and needing much more system tuning than my layla20.   
Specifically, there is a problem that happens with the xorg process  
that once initiated, does not heal.  I have seen reference to  
soundcard drivers setting their own pci bus priority.  For example  
without any adjustment, the layla20 driver loads with a high priority  
of 192, whereas of course my usb 2.0 card gets a typical default  
value of 32 like all the usual pci devices.  This is worth  
investigating for a future patch of snd-usb-caiaq, along with the  
lower minimum for buffer sizes.

	Thank you for reading this!

	-Jonathan Adams Leonard

http://www.jonathanleonard.com
First all Linux track:
http://www.jonathanleonard.com/songs/2007/mp3/reapers_wish.mp3

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user

[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux