Page 1 of 2

A few questions

Posted: Fri Feb 21, 2014 10:54 am
by krsn
hi,

it's my 3rd month of managing to make definitive my transition from windows to linux, and i have to say i made really tangible progresses. still, i'm stuck with the same questions everytime i try to understand a new distrib...

because i tried lots of them. the one i'm most confortable with now is fedora. i've installed the kde "fedora audio", which to my surprise is running very smoothly and is very pleasant to use. anyway. here are my main points of misunderstanding with audio in linux.

(fedora audio 20, kde with sndcard: terratec dmx 6fire usb)

1. my card is recognized by all of the main audio oriented distribs out there, except for tango studio, which seems to think that i have just 1 out and no in... if someone can tell me why, i would apreciate.

2. some distribs came with pulseaudio (ubuntu studio, fedora, for example), some not (kxstudio, tango studio). why.

3. with the ones that come without pulseaudio, my latency capacities seem to be less than what i was experiencing on windows (11ms for kxstudio and 23 with ubuntu and tango studio). windows could give me around 6ms.

4. when the distrib includes pulseaudio, although my latency is still maintained above 20ms, i can manage to get it way much lower (0,677ms) by integrating pulseaudio with jack (procedure here: https://docs.fedoraproject.org/en-US/Fe ... _JACK.html). what does that mean? is it a "real" latency or what? i mean, that could be a fantastic option, but i really don't like the idea of managing two "layers" of sound depending on the characteristics of each program.

5. about the kernel. whatever the kernel (rt or not), with the "pulseaudio/jack integration" manip, i get the same latency results. so what's the point of having a realtime kernel?

6. again about the kernel: fedora is really up-to-date and cool, but these constant updates are starting to get on my nerves a bit to be honnest. i began to have problems with the rt kernel (crashes, freezes at boot, black screens...) since the last update of january (before that, everything was perfect). then (with the first update of february, the 8th i think), i could run it without problem. and then again, last tuesday, another version caused a major crash and i had to get back to the 3.11.10-301 default of the installation kit (even the last "regular" fedora kernel didn't work). so if one kernel out of 3 or 4 is making my system go mad, i understand that i'm kind of confronted to a dilemma: there's a problem with the card OR it's something else. but what.

so... now i'm thinking of buying a new sound card, but it's a risky move in my case ($$$...). or managing to somewhat settle the latency problem i'm experiencing with a distrib in a "non-pulseaudio" case.

sorry for the bombarding. i'm a bit desperate... but still not completely nuts :?

thanks in advance.

krsn

Re: A few questions

Posted: Fri Feb 21, 2014 9:06 pm
by varpa
1. I don't know what goes on with Tango Studio and your card, but guess that maybe TangoStudio is old it may only have an old alsa driver for you card which does not support all its features.

2. Pulse audio is to be avoided if you want to do professional audio work. Will almost always cause problems with Jack. Pulse supposedly allows more flexibility routing audio for general use, though I not found it fixes more problems than it causes. I would either remove pulseaudio or use a distro which does not have it. Jack is what you want to professional audio work to have control over latency and to have flexible routing between audio hardware and apps.

3. I can't imagine how pulseaudio could ever give lower latencies than Jack, so I suspect something funny in how you measure latency. "Latency" can be defined in different ways, for example "round trip" (meaning time to sent audio back and forth to your sound card) vs one-way (time to send audio to sound card). It may be that your windows latency is one-way and your linux latency is for both ways so windows appears to be 1/2 of linux. QJackCtl for example reports round trip latency.

5. RT kernel in fact has little to offer over the standard kernels for audio latencies. That is to say most the improvements for low-latency audio are already in regular kernels.

6. Frequent Fedora updates may well break things. Of course you are not obligated to do them. AVlinux distro in contrast takes the point of view of establishing a stable platform and not updating it (much) so that you can count on a stability to get your work done. There will always be a trade off with stability and frequency of updates.

Re: A few questions

Posted: Sun Feb 23, 2014 10:15 am
by torsten-schenk
Hi krsn,

to start at the beginning: the base of all sound drivers is alsa. pulseaudio and jack use alsa as their backend. So the best option is to use alsa immediately.

In your case a destribution with pulseaudio should be avoided since pulseaudio integrates itself into the system very deeply. It even creates an alsa device which loops back to pulseaudio which sends it then to the real alsa driver.

I developed the 6fire driver and I made some good experiences using jack. Of course it adds a layer but the comfort you get out of it is worth it in my opinion. Also, latency should not be influenced that much by jack.

Now to the card itself: The card - and also the driver - allows very low latencies. I don't remember the theoretical limit exactly but I think it is less than 1ms. Of course your system needs to be able to respond that fast for this. Practically I never measured latencies, so it would be of interest for me to see which latencies you can achieve.

If you want to experiment, you could also try the driver at sixfireusb.sourceforge.net, which also allows tweeking some settings. One disadvantage is that a reinstallation is required after a kernel update.
After you installed the driver, try the following:
$ sudo rmmod snd-usb-6fire
$ sudo modprobe snd-usb-6fire pcm_mode=1 tasklet_thresh=0
This unloads the previous driver and loads the new driver. The pcm mode disables digital output, tasklet_thresh disables a feature you wouldn't want in your case ;)

Regards,
Torsten

Re: A few questions

Posted: Sun Feb 23, 2014 5:16 pm
by tnovelli
I got Fedora 17 tuned pretty well for audio - it can be done - but you're right, the constant updates are a problem. ArchLinux even more so. Both distros have good docs and knowledgeable users. Ubuntu is the opposite; too much magical "stuff that just works" (or not) and lots of noobs (no offense) spewing misinformation. Debian (ubuntu's "parent") is more usable than it was back when everyone jumped ship to Ubuntu... I'm currently using vanilla Debian 7 "wheezy"... but it requires some know-how to install the right packages and tune it. I have another computer running AVLinux (Debian 6) which comes nicely tuned and configured, but it's a bit outdated, and 32-bit only. Tango Studio is somewhere in between, difficulty-wise. And last but not least, KXStudio is definitely worth a try; it's Ubuntu+KDE (too frilly IMHO) but well-tuned for audio.

About alsa, pulse, and jack...

ALSA is basically the hardware driver. Only one program can use it at a time. So you need something to route & mix audio signals...
- JACK (realtime low-latency with modular "patchbay" routing & synchronization for pro audio)
- PulseAudio (same idea really, but with simple routing and maybe no sync)
- dmix (built into ALSA, but totally obsolete, don't even bother)
- several others superseded by Pulse... esd, artsd, etc.

AVLinux routes ALSA programs through JACK. It's not perfect but at least I can use youtube/soundcloud/etc without stopping JACK. Good enough, I guess.

Little-known fact: there are 2 alternate implementations of JACK, jackd1 and jackd2. A lot of users (and distro maintainers!) assume 2 is newer/better, but that's not exactly true. It does have more features AND BUGS. Some things require jackd2 features, for example, the newer pulse-jack bridge needs jackd2's dbus support. Irritating.

PulseAudio (4.0) is great for what it is. Better than JACK in many ways, but no substitute. Early versions caused a lot of problems when Fedora and Ubuntu rolled it out prematurely, that's all. Only problem now is that it conflicts with JACK.

Re: A few questions

Posted: Mon Feb 24, 2014 12:37 pm
by krsn
thank you all for your very kind replies.

little update on that. i finally (re)switched to kxstudio, which was giving me some weird boots back then. i decided to give it another try, since after all it gave me the best results on all plans. the complexity of the cadence-catia-claudia kit also made me search for something more "main stream" (i had difficulties finding tutorials to make good use of all these tools).

so now i'm back with an 11,6ms latency, which is better than nothing for now. thank you torsten, i will try to install the driver and check all that.

as for the kernel, my 3.11.0 low-latency fixed my booting problems so now i'm afraid to touch it. but the idea of exploiting my sound-card to its full capacities is too strong to make me fear another (re-re-re-)reinstall of whatever you like :twisted: ...

:D

Re: A few questions

Posted: Tue Feb 25, 2014 12:14 pm
by krsn
back with some... well no news at all really.

torsten
i've installed the driver as you said, then did the 2 manips you suggested (the "sudo rmmod snd-usb-6fire" one gives me "Module snd_usb_6fire is in use"...) but without any new results. jack still gives me a 11,6ms latency at 512samples. cannot get lower than that (not that bad, i know, but... in fact, i "can" get lower if i just pump up the sample rate - for example 96000hz-521samples gives me a latency of 5,3 - but i don't know how long my system could go on with that config...)

maybe it's somewhere in my specs.
most probably somewhere 40cm in front of the screen... :arrow: :?

like i said, not that it's that big of an issue, but if it was possible i would like to find, if not a definitive solution, at least the beginning of an explanation, just for the sake of understanding why.

thanx again anyway.

Re: A few questions

Posted: Tue Feb 25, 2014 5:10 pm
by torsten-schenk
Ok, why cannot you go below 512 samples? What exactly happens if you select, let's say, 256 samples?

Re: A few questions

Posted: Tue Feb 25, 2014 5:38 pm
by krsn
i get this:

Controller activated. Version 1.9.10 (unknown) built on Thu Jan 23 07:13:12 2014
Tue Feb 25 21:38:01 2014: Loading settings from "/home/math/.config/jack/conf.xml" using expat_2.0.1 ...
Tue Feb 25 21:38:01 2014: setting parameter 'engine':'driver':'(null)' to value "alsa"
Tue Feb 25 21:38:01 2014: setting parameter 'engine':'realtime':'(null)' to value "true"
Tue Feb 25 21:38:01 2014: setting parameter 'engine':'realtime-priority':'(null)' to value "85"
Tue Feb 25 21:38:01 2014: setting parameter 'drivers':'alsa':'device' to value "hw:DMX6FireUSB,0"
Tue Feb 25 21:38:01 2014: setting parameter 'drivers':'alsa':'rate' to value "44100"
Tue Feb 25 21:38:01 2014: setting parameter 'drivers':'alsa':'period' to value "256"
Tue Feb 25 21:38:01 2014: setting parameter 'drivers':'alsa':'nperiods' to value "2"
Tue Feb 25 21:38:01 2014: Listening for D-Bus messages
Tue Feb 25 21:38:02 2014: Starting jack server...
Tue Feb 25 21:38:02 2014: JACK server starting in realtime mode with priority 85
Tue Feb 25 21:38:02 2014: Acquired audio card Audio0
Tue Feb 25 21:38:02 2014: creating alsa driver ... hw:DMX6FireUSB,0|hw:DMX6FireUSB,0|256|2|44100|0|0|nomon|swmeter|-|32bit
Tue Feb 25 21:38:02 2014: configuring for 44100Hz, period = 256 frames (5.8 ms), buffer = 2 periods
Tue Feb 25 21:38:02 2014: ALSA: final selected sample format for capture: 32bit integer little-endian
Tue Feb 25 21:38:02 2014: ERROR: ALSA: cannot set period size to 256 frames for capture
Tue Feb 25 21:38:02 2014: ERROR: ALSA: cannot configure capture channel
Tue Feb 25 21:38:02 2014: ERROR: Cannot initialize driver
Tue Feb 25 21:38:02 2014: ERROR: JackServer::Open failed with -1
Tue Feb 25 21:38:02 2014: ERROR: Failed to open server

Re: A few questions

Posted: Tue Feb 25, 2014 5:52 pm
by torsten-schenk
Hmm, this looks like a bug, because 256 frames should be possible...

Thanks for the report, I will have a look at the driver.

Re: A few questions

Posted: Tue Feb 25, 2014 6:07 pm
by torsten-schenk
Which driver do you use? The one from the kernel or from the sourceforge page? Because mine even allows a period size of 32 frames (EDIT: which is 0.6.1 from the sourceforge page).

Re: A few questions

Posted: Tue Feb 25, 2014 6:14 pm
by torsten-schenk
What also could be interesting for you is the fact, that you have to double the latency. You see this here (notice "buffer = 2 periods"):
> configuring for 48000Hz, period = 32 frames (0.7 ms), buffer = 2 periods

This is neccessary because of how the device works. So in fact you have a 22.x ms latency.

Re: A few questions

Posted: Wed Feb 26, 2014 9:20 am
by krsn
i get a 10,7ms with 48000hz, that's all i can do.

what is confusing me in fact is the order in which i have to make all the manips for the driver installation.
do you have a step-by-step procedure for that (like: for noobs if possible...)? i've searched but it seems that all the procedures are either confusing either outdated.
sorry for the stupid question...
krsn.

Re: A few questions

Posted: Wed Feb 26, 2014 2:22 pm
by torsten-schenk
the INSTALL file in the archive should provide help.

Here the order:
download sixfireusb-0.6.1.tar.bz2 and unpack it, f.ex. into /tmp.
On a terminal, enter:

$ cd /tmp/sixfireusb-0.6.1
$ make
$ sudo make kremove
$ sudo make install
If you get an error, ensure that the kernel headers are installed.
after that, the new driver is installed. Then, you can simply reboot the system.

If you enter
$ modinfo snd-usb-6fire
you see information about the driver that is being used. The "filename: " line should be like this (the crucial part is the "extra")

filename: /lib/modules/.../extra/...

Re: A few questions

Posted: Thu Feb 27, 2014 5:20 am
by krsn
:D
just woks perfect. wow!
in russian we say: nakonets-to!..

just for the records (well,from the "newbie" point of view...) i think this procedure should be put in the install file of the driver as you gave it to me here. the text of the install file is rather confusing for newcomers. also, it makes us think that the "fwinst" is necessary, which obviously is not (at least for new kernels. but maybe i'm wrong on that. works for me though). thus the confusion in the "sequence of manipulations".

don't know if it could be of any relevance, but as far as my experiments went, it only worked with the 3.11.0-11 lowlatency kernel. i tried it on the 3.13.02 lowlatency and it didn't work. i had a "no such file" message at the end when i did the "modinfo snd-usb-6fire" part.

anyway thanks a lot for your assistance!

Re: A few questions

Posted: Sat Mar 01, 2014 5:06 pm
by krsn
ok, now i'm confused.

i reinstalled kxstudio (in fact i did it 3 times since my last post here), just you know... to verify that the procedure is really working. no reason to think that it wouldn't. and because i messed up a "dual booting" with another distro...
in brief, i had to reinstall and i did it.

well, guess what. every time (every time!) i reinstalled, the card didn't install. i really don't get it.

here's what i get now, every time i install.

so, i follow the procedure you gave (from a fresh install of the lowlatency 3.11.0-11.5, that is the one that's marked "last version" in synaptic, the same version i had last thursday) : extract, make, make kremove, and when i do "make install" it gives me a "can't read private key" line like that (i didn't see that when it worked):

:/tmp/sixfireusb-0.6.1# sudo make install
make -C /lib/modules/3.11.0-11-lowlatency/build M=/tmp/sixfireusb-0.6.1 modules_install
make[1]: entrant dans le répertoire « /usr/src/linux-headers-3.11.0-11-lowlatency »
INSTALL /tmp/sixfireusb-0.6.1/snd-usb-6fire.ko
Can't read private key
DEPMOD 3.11.0-11-lowlatency
make[1]: quittant le répertoire « /usr/src/linux-headers-3.11.0-11-lowlatency »
root@math:/tmp/sixfireusb-0.6.1#


after that, i reboot and the mixer isn't there anymore (there's a white page-like icon instead) and when i go in the mixer, everywhere the 6fire is greyed out. and the modinfo command gives me that:

ERROR: modinfo: could not open /lib/modules/3.11.0-11-lowlatency/kernel/sound/usb/6fire/snd-usb-6fire.ko: No such file or directory

i'm kinda skuck right now.

any clue?... :oops: