Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Partially Outdated] JACK Audio Connection Kit Howto
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
rojaro
l33t
l33t


Joined: 06 May 2002
Posts: 732

PostPosted: Tue Sep 23, 2003 9:59 pm    Post subject: [Partially Outdated] JACK Audio Connection Kit Howto Reply with quote

Note
This Tutorial is now a little bit outdated and needs some points changed and/or replaced. I've started already writing a new completely new version of this document, but i currently i dont have much time to work on that and verify everything. So it will take a while until i have it finished.

Introduction
In my last tutorial, "Kernel support for MISC binaries" & Wine i showed how to run Windows (and other) binaries on Linux by just typing their names. While writing it i discovered that Wine now has JACK support and i just had to try it out. I never played with JACK before but read lots of good stuff about it and decided to install it myself and see if it works so well as people used to say. But that really gave me a hard time on hunting for howto's (which i havent found at all), Documentation etc., so i just started to write my own Howto. Although i havent recompiled Wine yet - therefore could not test it's JACK capabilities - i felt this paper is already good enough for a release.

But before we go on:

A BIG FAT WARNING: THIS HOWTO IS NOT FOR BEGINNERS OR PEOPLE THAT JUST WANT TO PLAY AROUND! THE SOFTWARE DISCUSSED (JACK) IS STILL UNDER DEVELOPMENT AND HAS SOME NASTY BUGS -> IT WILL CRASH YOUR MACHINE UNDER MANY CIRCUMSTANCES AND YOU MIGHT LOOSE PRECIOUS DATA. DO NOT TRY THIS IF YOU DONT KNOW WHAT THE SYSRQ KEY IS AS THAT ONE IS VERY LIKELY TO SAVE YOUR A**!

Jack, the Jack Audio Connection Kit, is still some pretty experimental stuff and to get the highest possible performance out of it , it still requires lots of hacking around. Right now there is no easy way to "just install" it and have it working. Also most audio applications still dont have support for it, but the ones that provide JACK support already are worth the time and effort installing it.

As it is still under development it still has quite some nasty downsides - you either have to run JACK and all the Applications that use it ass root or if you run JACK as a user, you loose most of it's advantages (that is it's high speed and low latency). But right now there is also another way available, but you should only do it on workstations without external services and you should be the only user on it.

Linux provides the so called "POSIX draft capabilities", which are a very nice idea for audio and video workstations, but in generall they are more likely to be consideresd as a security risk. These capabilities enable a setuid root program to get rights from the Kernel and give them to it's child's. Technically nothing bad, but this also allows these userspace programs to crash the kernel if they are not very carefully designed and as i said already, JACK will crash the machine under some certain circumstances. But as it seems it just likes to crash when a user presses the wrong button ... later more on that :)

I am using Linux-2.6.0-test-3-mm1 on my workstation with statically built ALSA drivers inside and i've had some weird effects here and there. I also could not compile everything i wanted (see the end of this document), but i assume that some of the problems that occured on my machine are very likely related to the gcc version i am running (3.2.3). I assume if you have a older kernel (2.4.x) and some older gcc (2.95.x) you will probably get much better results than i had with some of those packages.

However, the JACK installation itself worked well and alsaplayer works great ... with 2.67 milliseconds latency :)

REQUIREMENTS: A working ALSA installation and a properly configured soundcard -> this means YOU ALREADY HEAR SOUND out of it.

Step 1. - Kernel Setup
Make sure that you have the following Kernel Options Enabled:
  • CONFIG_PREEMPT (Processor tyoe and features -> Preemptibel Kernel)
  • CONFIG_RTC (Character Devices -> Enhanced Real Time Clock)
  • CONFIG_SND_RTCTIMER (Sound -> Advanced Linux Sound Architecture -> RTC Timer support)
To run JACK as a normal user but with realtime scheduling, you also need to enable the "POSIX draft capabilities" but right now there is no "nice" way to do this. Open /usr/src/linux/include/linux/capability.h with your favorit text editor and look for the following line:
Code:
#define CAP_INIT_EFF_SET    to_cap_t(~0 & ~CAP_TO_MASK(CAP_SETPCAP))

and replace it with
Code:
#define CAP_INIT_EFF_SET    to_cap_t(~0)

below this line, there should be another line that should look like this:
Code:
#define CAP_INIT_INH_SET    to_cap_t(0)

replace it with
Code:
#define CAP_INIT_INH_SET    to_cap_t(~0)

or if you know how to handle the patch program, apply this patch.
now recompile your kernel, install it and reboot.

Step 2. - Building alsa-lib with JACK plugin
As soon JACK is running later, even ALSA applications won't be able to use the Soundcard unless they have JACK support. As there are right now only a hand full of applications that have native JACK support we need a workaround here for all our ALSA apps. Luckily, alsa-lib provides us with a jack-plugin that enables ordinary ALSA applications to work together with jack.

Unfortunately, the module doesnt get build by default and somebody of the alsa folks decided that it might be a good idea to require everybody to compile it by hand. The handy "--with-jack" flag (which already existed once and was well documented) got removed again, so i've just hacked up the alsa-lib ebuild to have the module built automatically. This is actually a really ugly hack, but it works.

Open /usr/portage/media-sound/alsa-lib/alsa-lib-0.9.6.ebuild with your favorite texteditor and do the following additions:
  1. at the end of function scr_compile() add the following line:
    Code:
    (cd src/pcm/ext && (make jack || die "make jack failed"))

  2. in function src_install add a new line after "make DESTDIR=${D} install || die" that reads
    Code:
    (cd src/pcm/ext && (make DESTDIR=${D} pkglibLDLIBRARIES_INSTALL="/bin/install -c" install-jack || die "make jack-install failed"))
if you have done that, (re)emerge alsa-lib-0.9.6, which has to be done right now using the followin command:
Code:
ACCEPT_KEYWORDS="~x86" emerge alsa-lib


Step 3. - Install libcap
Libcap is required by the jackstart tool that gets compiled later when we install jack itself. But as there is no dependency in the ebuild you have to emerge it yourself.
Code:
emrge sys-libs/libcap


Step 4. - Which JACK version?
Now you have to choose which JACK version you want to use. There is the CVS version (media-sound/jack-cvs) and the release version (media-sound/jack-audio-connection-kit). For this tutorial it doesnt matter which version you are going to use; the steps to do are basically the same, but you do them on diffrent files. On the following Steps i will use the current version 0.80.0 as example (which is right now still masked, but works very well).

Be carefull, there is a package named jack which is also in media-sound but that one has nothing to do with the JACK Audio connection Kit. One of media-sound/jack-cvs or media-sound/jack-audio-connection-kit is what you want.

Step 5. - Installing JACK
because i am a lazy guy i am not going to use the PORTAGE_OVERLAY directory in this example as this would require lots more of typing :)
but you should use it. see the portage user document on how to use it. really.
Code:
cd /usr/portage/media-sound/jack-audio-connection-kit

open the jack-audio-connection-kit-0.80.0.ebuild file in your favorite texteditor and goto line 45 and modify it so it will read
Code:
myconf="${myconf} --enable-optimize --with-gnu-ld --enable-capabilities --enable-stripped-jackd"

save the file and finally install JACK :)
Code:
USE="jack-tmpfs" ACCEPT_KEYWORDS="~x86" emerge media-sound/jack-audio-connection-kit


Step 6. - Configure ALSA
to make jack and alsa work as a team, we will have to tell jack which soundcard's it should use. this is done either through /etc/asound.conf or ~/.asoundrc. if none of these files exist, create one of them (i prefer /etc/asound.conf) and read this document. as a example i provide my configuration here:
Code:
pcm.cmipci {
   type hw
   card 0
}
ctl.cmipci {
   type hw
   card 0
}
pcm.!default {
   type plug
   slave { pcm jack }
}
pcm.jack {
   type jack
   playback_ports {
      0 alsa_pcm:playback_1
      1 alsa_pcm:playback_2
   }
   capture_ports {
      0 alsa_pcm:capture_1
      1 alsa_pcm:capture_2
   }
   monitor_ports {
      0 alsa_pcm:monitor_1
      1 alsa_pcm:monitor_2
   }
}

remember, this is my configuration from my workstation, so you have to read the alsa-docs and create a config file for your own soundcard (it probably looks very similar if you dont have a MIDIMAN or RME HAMMERFALL card). my workstation has only a very cheap onboard soundchip - a C-MEDIA 8738 MC6. but as it has fiber ports which are connected directly to my hifi, so it doesnt matter much if it is onboard or not. the sound is superb.

Step 7. - Testing JACK
now login as a user and start jackd via the following command remeber to use the name of your soundcard and not cmipci, unless you've got the same card):
Code:
jackstart -v -R -d alsa -d cmipci -H -M -m

WARNING: DO NOT PRESS CTRL+S NOW TO STOP THE SCROLLING! IT WILL CRASH YOUR MACHINE - YOU CANNOT RECOVER BY PRESSING CTRL-Q! Happend to me and i was lucky that i had the magic sysrq enabled which still allowed me to sync and unmount the disks so nothing really important got lost, and vim also recovered this tutorial :)

The output shown is there for debugging reasons and you probably want to see it in the next step. If you want to stop it scrolling, press CTRL-C. This will stop JACK, but it wont crash your machine :)

Step 8. - Alsaplayer
Since version 0.99.70, the alsaplayer supports jack as a output-plugin, but it will not be compiled unless it's configure script detects the installed jackd. therefore you probably will have to recompile the alsaplayer if you had it installed already.
Code:
emerge alsaplayer

by default, the alsaplayer wants to use alsa directly for playback. this we're going to fix i a later step, so for now run
Code:
alsaplayer -o jack

play some tune and look at the output of jackd. if you hear sound and see no errormessages from jack (alsaplayer might throw a notice that your "interface" is running at some higher number than 44100) the hard part has been done. For testing you might want to start 10 other alsaplayers, all playing the same track (electrionic music is nice) and play with the pitch and the volume on all of them :)

Step 9. - Starting JACK
there are two ways to start jack:
  1. manually like in step x. but you probably don't want the debug output
    Code:
    jackstart -R -d alsa -d cmipci

    jackstart has a few options you can set - but watch it, the first occuring "-d alsa" separates the jackstart options from the alsa driver options which you can (and probably want) set as well. so
    Code:
    jackstart --help

    shows the first set of options (the jackstart options) and
    Code:
    jackstart -d alsa --help

    shows the driver options. Remember to put the jackstart options in front of the "-d alsa".

  2. or emerge qjackctl (HIGHLY RECOMMENDED)
    Code:
    ACCEPT_KEYWORDS="~x86" emerge qjackctl

    which is kind of a multifunctional jack control tool. with it you can start and stop jack, setup connections between applications and see a complete status. when it's done emerging run
    Code:
    qjackctl &
you cannot yet start JACK as a real deamon, and as it's used right now by very few applications. some alsa applications will work directly with JACK as we've created the asound config file above containing the jack plugin. Others that have a poorly designed ALSA driver will try to connect to the hardware device and wont work at all.

Step 10. - Setup Alsaplayer to use JACK whenever it's available.
Open the file ~/.alsaplayer/config with your favorite text editor. look for a line that says
Code:
main.default_output=alsa

and change it into
Code:
main.default_output=jack

if you start alsaplayer now, it will automatically use JACK if it's running. otherwise it will fall back to use ALSA.

Unsolved Problems
media-libs/libjackasyn
    This tool can connect OSS applications to JACK. of course, they wont work in synchronous mode, but for stuff like mplayer, xine etc this should be good enough. It doesnt find jack/error.h, and there really is no such file. So i uncommented the include in the source and tried to compile by hand. That worked, but the resulting app did nothing more than crash the alsaplayer which was connected at that time through jackd. So i didnt do much more with it as i think this app is kinda outdated and needs to be "synced" with JACK.

    too bad, would have loved to use it.
media-libs/ladcca-0.3.1
    ladcca doest compile on my machine - dies with the following error message
    Code:
    depmode=gcc3 /bin/sh ../depcomp \
    gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g   -DLADCCA_BUILD -DHAVE_LADCCA -I/usr/include/alsa   -I.. -march=pentium4 -O3 -pipe -fomit-frame-pointer -c -o \
    ladccad-client.o `test -f 'client.c' || echo './'`client.c
    main.c: In function `main':
    main.c:133: `LONG_MAX' undeclared (first use in this function)
    main.c:133: (Each undeclared identifier is reported only once
    main.c:133: for each function it appears in.)
    main.c:134: `LONG_MIN' undeclared (first use in this function)
    main.c:136: `UINT_MAX' undeclared (first use in this function)
    make[2]: *** [ladccad-main.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    make[2]: Leaving directory
    `/var/tmp/portage/ladcca-0.3.1/work/ladcca-0.3.1/ladccad'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/var/tmp/portage/ladcca-0.3.1/work/ladcca-0.3.1'
    make: *** [all] Error 2

    therefore i could not compile other applications like media-sound/museseq (The Linux [midi] MUSic Editor [a sequencer]) and others that rely upon ladcca.
media-sound/ardour-0.9_beta3
    also dies while compiling with an error message
    Code:
    [ cutted compiler stuff ]
    diskstream.cc: In member function `int ARDOUR::DiskStream::do_flush(bool)':
    diskstream.cc:1309: no matching function for call to `min(long unsigned int, size_t)'
    [ cutted compiler stuff ]
    make[4]: *** [diskstream.lo] Error 1
Probably more to come ... :)

The End (?)
Nope, for sure not. Although JACK is not finished yet, i see a great future for the project. I will also update this document as soon as i have new informations, got more stuff running or got feedback from you folks :)

I hope someone can provide some patches or hacks to get more stuff working with JACK and please, people, provide some feedback on other applications that you've got working with JACK!
_________________
A mathematician is a machine for turning coffee into theorems. ~ Alfred Renyi (*1921 - †1970)


Last edited by rojaro on Fri Apr 30, 2004 11:01 am; edited 1 time in total
Back to top
View user's profile Send private message
Herodot
Guru
Guru


Joined: 29 Jul 2002
Posts: 429
Location: Professor Xavier's school for gifted youngsters

PostPosted: Mon Sep 29, 2003 2:25 pm    Post subject: Reply with quote

Nice work, well done!

I got most of these things to work last night, and then I found your guide - doh! So let me add my experiences with the things you mention.

- I've never had JACK crash my machine. Not even when running in realtime.

- I'm using a 2.4.20-gentoo-r7 kernel, so I can't use the "Enhanced Real Time Clock". Things are still working fine, though.

- The changes in /usr/src/linux/include/linux/capability.h also work with my kernel. They are described on the JACK homepage also.

- Building alsa-lib with JACK plugin is the one thing I can't get to work. As I understand it, this should route all calls to ALSA through the JACK server. It won't work. Maybe my asoundrc is wrong, I'll try again when I get the time.

- I can't get JACK to work when I use the ebuild. I can't get the realtime capabilities to work, no matter what arrangement of permissions on jackstart and jackd I try. Compiling it manually with the same configure parameters works for me, after I change the permissions on those two files.

- Configuring ALSA is a big problem. There's simply aren't any thorough guides to asoundrc, and it difficult to find specific hardware documentation. My soundcard is a Terratec DMX 6Fire 24/96. It's very nice, and has a lot of channels and mixers and monitors, and it's completely impossible for me to understand how to write a good asoundrc. The ALSA project obviously has a hard time getting hardware details from the hardware makers, and their sparse documentation is rarely helping us users. IMO. I'll try to find better documentation, and work more with it.

- qjackctl would be much more useful if it could store several settings for JACK, so you could start the server with different parameters. I haven't really looked into this, I must admit.


The reason I started looking on this was that I wanted to use a MIDI interface with ALSA. I started by cleaning out all traces of OSS in /etc/modules.d/alsasound (which turned out to be most of it...), and after several tries it actually started working.

I then emerged JACK 0.80, but it turns out that this blocks emerging other audio applications. They simply won't compile. So I downgraded JACK to 0.7? (latest stable), and emerged a couple of synths and stuff. They were rather disappointing, and mostly used OSS (bummer!). That's when I decided to get JACK working properly, OSS be damned. After too many hours of going through all of the above I had a working JACK, Rosegarden, Hydrogen and Alsaplayer. Then I found your guide.

It would be nice to replace Arts (in KDE) with JACK, or at least get XMMS, Xine and Mplayer to use JACK and then disable Arts. None of this is possible, to the best of my experience. It's just too new, and we have to patch a lot of programs to get JACK working at all. I suppose we'll just have to wait, and that's an awful solution to any problem! ( There is an JACK plugin for XMMS, but I can't get it to work.)

I have three sound devices: The aforementioned Terratec, which is my main soundcard. A small C-media 8738 that I'm not really using. And a Roland UM-1 USB MIDI interface. The ALSA layer works fine with the drivers in 0.9.6/7. There is a special mixer application for the ice1712 chip (in the Terratec) called envy24control. It is reportedly very good, but it has so many knobs and buttons that I go dizzy. And it's not clear wether all these options apply to my specific card - they probably don't. What I mean by "the ALSA layer works fine" is that the sound I get is indistinguisable from what I get from the same hardware in Windows, and directly from an audio CD-player. The UBS MIDI works fine also, which was a bit of a surprise - not much to say about that.

Running JACK with ASIO enabled actually works, which was a nice surprise after just about everything else failed to. Starting JACK with "jackstart -v -R -a -d alsa -d hw:0 -r 44100 -p 64" gives me a playback and record latency of 2 and 1 ms, as reported by Rosegarden. This with jackd having 10-15% cpu-load when running idle (Athlon 1800+), so it's not really usable, but it shows that it's possible to get the latency low enough for real audio work, which was my main concern. I'll look into this later.

I recommend qjackconnect, which gives a good overview of the current jack connections.

And now to something completely different: Maybe some of this should be added to the Gentoo sound guide (from the user docs)? It's actually "Gentoo Linux ALSA Guide", and doesn't touch upon JACK or MIDI. Judging from the questions in the Multimedia forum, many people have problems getting started, despite of this user doc. And the "only one sound at a time"-question is asked three times a day. That particular question (and others like it) should be answered in the Gentoo documentation (ie. the user docs), but the "Gentoo Linux ALSA Guide" doesn't cover everything. What does everybody think? Should we try to make a larger "Gentoo Linux sound Guide"?
_________________
Excelsior!
Back to top
View user's profile Send private message
rojaro
l33t
l33t


Joined: 06 May 2002
Posts: 732

PostPosted: Mon Sep 29, 2003 6:37 pm    Post subject: Reply with quote

Herodot wrote:
- I've never had JACK crash my machine. Not even when running in realtime.

well, i've got it running now for quite some time, and i also havent found anymore problems so far, except the ones which i've explained already

Herodot wrote:
- Building alsa-lib with JACK plugin is the one thing I can't get to work. As I understand it, this should route all calls to ALSA through the JACK server. It won't work. Maybe my asoundrc is wrong, I'll try again when I get the time.

i found out that it will work with any alsa application that uses alsalib for playback (which are just very few) while the ones that use the alsa-devices will not work. e.g. xine, xmms (with alsa driver) and mplayer won't work (which is a real pity).

Herodot wrote:
- I can't get JACK to work when I use the ebuild. I can't get the realtime capabilities to work, no matter what arrangement of permissions on jackstart and jackd I try. Compiling it manually with the same configure parameters works for me, after I change the permissions on those two files.

hmm.. works fine for me .. although i've modified the ebuild (as i wrote in the tutorial)

Herodot wrote:
- Configuring ALSA is a big problem. There's simply aren't any thorough guides to asoundrc, and it difficult to find specific hardware documentation. My soundcard is a Terratec DMX 6Fire 24/96. It's very nice, and has a lot of channels and mixers and monitors, and it's completely impossible for me to understand how to write a good asoundrc. The ALSA project obviously has a hard time getting hardware details from the hardware makers, and their sparse documentation is rarely helping us users. IMO. I'll try to find better documentation, and work more with it.

actually, the whole alsa documentation seems to be VERY outdated and very incomplete. the only document about the asoundrc i've found was a basic parameter listing (which looked like being generated with doxygen or something similar) which doesnt contain a single example.

Herodot wrote:
- qjackctl would be much more useful if it could store several settings for JACK, so you could start the server with different parameters. I haven't really looked into this, I must admit.

qjackctl 0.0.8 stores it's settings in ~/.qt/qjackctlrc, but it seems it only does this when it is creating the file. if you change something later on, it won't be saved.

Herodot wrote:
After too many hours of going through all of the above I had a working JACK, Rosegarden, Hydrogen and Alsaplayer. Then I found your guide.

still could not get ardour, rosengarten and hydrogen working on my machine, but mostly due to compilation errors of other libraries (as noted above) :(

Herodot wrote:
It would be nice to replace Arts (in KDE) with JACK, or at least get XMMS, Xine and Mplayer to use JACK and then disable Arts. None of this is possible, to the best of my experience. It's just too new, and we have to patch a lot of programs to get JACK working at all. I suppose we'll just have to wait, and that's an awful solution to any problem! ( There is an JACK plugin for XMMS, but I can't get it to work.)

I don't use Arts at all. i found it to be too slow for me, memory consuming and completely laggy to do anything with it. there are options to disable it completely in kcontrol. I also configured all the other programms (like xmms, mplayer and xine) to use alsa natively. there is no need for the big bloated artsd ...

Herodot wrote:
I have three sound devices: The aforementioned Terratec, which is my main soundcard. A small C-media 8738 that I'm not really using.

thats the one i have ... it's analogue outputs are really bad, but the sp/dif is pretty much flawless :)

Herodot wrote:
This with jackd having 10-15% cpu-load when running idle (Athlon 1800+), so it's not really usable, but it shows that it's possible to get the latency low enough for real audio work, which was my main concern. I'll look into this later.

i think the cpu-load which jackd reports is kinda unreliable. on my machine (which is a p4/3ghz) it also always reports something around 10% but my top actually never ever reported it to be using more than 1.7%. i've also ran for testing like 10 alsaplayers simultaneously together with freqtweak (which produced kind of a very weird sound as all where playing diffrent shoutcast streams) but even then top reported it to be just around 4% which is f***ing cool.

Herodot wrote:
I recommend qjackconnect, which gives a good overview of the current jack connections.

well, qjackctl also provides that feature, and it even looks better ... :)

edit: fixed typo
_________________
A mathematician is a machine for turning coffee into theorems. ~ Alfred Renyi (*1921 - †1970)


Last edited by rojaro on Mon Jan 05, 2004 1:22 am; edited 1 time in total
Back to top
View user's profile Send private message
Herodot
Guru
Guru


Joined: 29 Jul 2002
Posts: 429
Location: Professor Xavier's school for gifted youngsters

PostPosted: Tue Sep 30, 2003 12:58 pm    Post subject: Reply with quote

rojaro wrote:
Herodot wrote:
- I can't get JACK to work when I use the ebuild. I can't get the realtime capabilities to work, no matter what arrangement of permissions on jackstart and jackd I try. Compiling it manually with the same configure parameters works for me, after I change the permissions on those two files.

hmm.. works fine for me .. although i've modified the ebuild (as i wrote in the tutorial)
I tried again, and this time it worked. I didn't even have to chmod anything.

rojaro wrote:
actually, the whole alsa documentation seems to be VERY outdated and very incomplete. the only document about the asoundrc i've found was a basic parameter listing (which looked like being generated with doxygen or something similar) which doesnt contain a single example.

Exactly - it's borderline worthles. Many projects need better documentation, but ALSA is certainly one of the worst.

rojaro wrote:
still could not get ardour, rosengarten and hydrogen working on my machine, but mostly due to compilation errors of other libraries (as noted above) :(

I'm also having problems with several programs. At first I managed to get some compiled by having a JACK 0.7, not 0.8. But ladcca and ardour still won't compile. Somebody ought to file a bug!

rojaro wrote:
I don't use Arts at all. i found it to be too slow for me, memory consuming and completely laggy to do anything with it. there are options to disable it completely in kcontrol. I also configured all the other programms (like xmms, mplayer and xine) to use alsa natively. there is no need for the big bloated artsd ...
True, I've seen that particular light as well. But it would certainly be preferable to go through JACK, to get multiple streams.

rojaro wrote:
i think the cpu-load which jackd reports is kinda unreliable. on my machine (which is a p4/3ghz) it also always reports something around 10% but my top actually never ever reported it to be using more than 1.7%.

I agree. Not do I think top is completely reliable.

rojaro wrote:
i've also ran for testing like 10 alsaplayers simultaneously together with freqtweak (which produced kind of a very weird sound as all where playing diffrent shoutcast streams) but even then top reported it to be just around 4% which is f***ing cool.

Yes! I'll have to try that!

rojaro wrote:
Herodot wrote:
I recommend qjackconnect, which gives a good overview of the current jack connections.

well, qjackctl also provides that feature, and it even looks better ... :)

You're absolutely right. It seems that checking "Details" in qjackctl was too difficult for me, so I thought it was just a start/stop button. Now that I've seen what it really does, I use it all the time.

I claimed that there's no "CONFIG_RTC (Character Devices -> Enhanced Real Time Clock)" in the 2.4.20 kernel. That's wrong, it's there. But there's no "CONFIG_SND_RTCTIMER (Sound -> Advanced Linux Sound Architecture -> RTC Timer support)" - I wonder if I can emerge the alsa-driver with a similar parameter?

I just got fluidsynth to work with JACK, that's important. But I'm still having problems with figuring out how everything connects.
_________________
Excelsior!
Back to top
View user's profile Send private message
keef
n00b
n00b


Joined: 02 Jul 2002
Posts: 45
Location: Third Stone from the Sun

PostPosted: Sat Oct 11, 2003 9:29 pm    Post subject: Reply with quote

rojaro said:

Step 2 - 2
Quote:
in function src_install add a new line after "make DESTDIR=${D} install || die" that reads
Code:

(cd src/pcm/ext && (make DESTDIR=${D} pkglibLDLIBRARIES_INSTALL="/bin/install -c" install-jack || die "make jack-install failed"))


For alsa-lib-0.9.7 (don't know about previous revs) pkglibLDLIBRARIES_INSTALL should be pkglibLTLIBRARIES_INSTALL.

---

Quote:
media-libs/ladcca-0.3.1

ladcca doest compile on my machine - dies with the following error message


Same here...I've entered a bug report for this as well as the a fix...including ebuild, digest, and patch:

Bug# 30925
Back to top
View user's profile Send private message
azhyd
n00b
n00b


Joined: 17 Nov 2003
Posts: 1

PostPosted: Tue Nov 18, 2003 4:00 am    Post subject: Reply with quote

just a very basic advise : you may have to re-emerge alsa-driver after the kernel recompiling (the correcponding modules are deleted) and fix the mixer volumes.
Back to top
View user's profile Send private message
fireboy1919
n00b
n00b


Joined: 28 May 2002
Posts: 47

PostPosted: Sat Nov 29, 2003 7:38 am    Post subject: More questions Reply with quote

I've gotten it working, and libjackasyn compiled fine for me.

I'm not exactly sure what to do AFTER that, though. How exactly do you make libjackasyn do it's thing? I've tried using LD_PRELOAD and jacklaunch, but the result is the same: /dev/dsp is considered busy.

Also, anybody know how to get one machine's client to communicate with another? Is this beyond jack's capabilities?
Back to top
View user's profile Send private message
orb9
Tux's lil' helper
Tux's lil' helper


Joined: 02 Sep 2002
Posts: 82
Location: Germany

PostPosted: Sun Jan 04, 2004 8:55 pm    Post subject: Reply with quote

First of all: I mainly followed the howto of the original poster rojaro (thanks man) and now i have JACK running in realtime as an ordinary user on my MAudio Delta 66 (which is one the none standard cards i guess). I'm currently working with JACK version 0.90.1, ALSA-lib v 0.9.8, ALSA driver v 0.9.8 (kernel modules) and everything described below was tested with this configuration. Here are my little additions to some of the steps:

1) Kernel setup for JACK realtime-priority

Besides the kernel setup i needed to suid root the jackstart executable via
Code:
chmod u+s `which jackstart`

to be able to run JACK with realtime-priority as an ordinary user.
I am using kernel-2.6.0 (development-sources-2.6.0) and everything described under Step 1 worked well with this kernel.

2) Building alsa-lib with JACK plugin

In my portage tree alsa-lib is no longer in media-sound but rather in media-libs.
Additionally the alsa-lib-0.9.8.ebuild already contains the code to build the jack-plugin when your USE flags contain "jack".

5) Installing JACK

The jack-audio-connection-kit-0.90.1-r1.ebuild (and above) already contains the described modifications. They are activated only if your USE flags contain "jack-tmpfs jack-caps". Summarized my JACK part of the USE environment variable contains the three items "jack jack-tmpfs jack-caps". With this you should be able to emerge alsa-lib and jack-audio-connection-kit without ebuild modifications.


Now on to the applications. Since i want music during the day i need an MP3 player. And here the struggle begins. I know there is alsaplayer which is working with JACK but i'm into xmms for years now and i wanted to get it JACKified.

XMMS

In short: it should work - but not for me. It only works if your JACK demon is running at 44100hz. My soundcard is driven by 48000hz so xmms complains about incompatile sample rates (most of the mp3 files are 44100hz). So if you're running JACK at 44100hz this should work and here's what i've done:

1) Used this (selfmade) ebuild:

Code:

# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2

S=${WORKDIR}/${P}
DESCRIPTION="Allows XMMS to output via jack."
HOMEPAGE="http://xmms-jack.sourceforge.net/"
SRC_URI="http://cesnet.dl.sourceforge.net/sourceforge/xmms-jack/xmms-jack-0.6-20031201.tar.gz"

SLOT="0"
LICENSE="GPL-2"
KEYWORDS="x86 ~ppc"

DEPEND="media-sound/xmms
   >=media-libs/alsa-lib-0.9.2
   >=media-sound/alsa-driver-0.9.2"

src_compile() {   
   cd ${WORKDIR}/${PN}
   rm config.cache
   econf || die
   emake || die
}

src_install() {
   cd ${WORKDIR}/${PN}
   einstall \
      libdir=${D}/usr/lib/xmms/Output || die

   dodoc AUTHORS README NEWS COPYING ChangeLog
}


Put this into your PORTDIR_OVERLAY dir under media-plugins/xmms-jack and name it xmms-jack-0.6.ebuild.
Then do
Code:
ebuild $PORTDIR_OVERLAY/xmms-jack/xmms-jack-0.6.ebuild digest

and
Code:
emerge $PORTAGE_OVERLAY/xmms-jack/xmms-jack-0.6.ebuild

and xmms now offers an jack output plugin. Hurray - one may say at 44100hz. As described above my card runs 48000hz. When running JACK with this rate (which is possible) the sound is pitched up because my card interprets it as 48000hz. What is necessary here is some kind of sample-rate conversion. Can anybody tell me if this should theoretically be done by the JACK demon or the xmms output plugin?


Hydrogen
Hydrogen is a drum-machine with JACK support. Compiled cleanly and works fine here.

Ardour
Compiled and running. Never tried it, though.

KDE, Arts and JACK
Short story.. doesn't work for now. There are some bugs filed at bugs.kde.org which vote for JACK support in arts. If you are a registered kde developer vote for these over there.
Bug 62465: aRts: more output modules needed, expecially JACK
Bug 64696: Make artsd able to use alsa and especially jackd

Interesting also (it's ALSA related only):
Bug 70802: showstopper: artsd fails at using a modern alsa setup: pcm.default not used
_________________
"Without music, life would be a mistake - I would only believe in a god who knew how to dance." (Nietzsche)
Back to top
View user's profile Send private message
krinkle
Guru
Guru


Joined: 04 Feb 2003
Posts: 338
Location: Garden Grove, CA

PostPosted: Mon Feb 16, 2004 3:26 am    Post subject: Reply with quote

just an update, i followed the guide and everything works fine. I'm using alsa-lib 1.0.2, jack .94, and 2.6.2 kernel. getting alsa to emerge took a couple steps though. i had to emerge alsa-lib without the jack flags, then emerge jack, then re-emerge alsa-lib with the jack flags. xmms-jack now works again as of version .8. also, i think it is because of the version of jack i am using, i had to modify the headers of spiral modular to get it to compile. i'll look up what I did and post it.
Back to top
View user's profile Send private message
sumin k'adra
n00b
n00b


Joined: 20 Sep 2003
Posts: 65
Location: santa fe, nm

PostPosted: Tue Feb 17, 2004 10:34 pm    Post subject: Reply with quote

@orb9: Your soundcard is not 'driven' at any rate. You can set your sample rate to 44100--or whatever proper number you want for that matter--with envy24control (media-sound/alsa-tools). Starting jack with '-r 44100' should automagically set your card to 44100 hz. But seeing as it apparently doesn't, just set it with envy24control. Always remember, young grasshopper, resampling is bad!

'tis a shame to not know the full capabilities of one's own $200+ sound card : ) j/k, we're all here to learn.

-sk, proud delta 44 owner and lover
Back to top
View user's profile Send private message
spitzwegerich
l33t
l33t


Joined: 04 Mar 2003
Posts: 697
Location: Lower Bavaria, Central Europe

PostPosted: Sun Feb 22, 2004 7:54 pm    Post subject: Reply with quote

I loosely followed this tutorial for getting jack working and want to mention some points:

1) Great! Many thanks for this tutorial!!
2) Some things are easier as described, using the USE-flags jack, jack-caps and jack-tmpfs which may not have existed when this tutorial was written.
3) An updated Version (using the USE-flags) of this tutorial would be very nice! Also, as suggested by Herodot , I think a "Gentoo Linux sound Guide" is a great idea. In my opinion, gentoo with its huge possibilities to tweak and optimize makes it a perfect joice for serious linux audio work.
4) I may be blind, but where can I look up the actual latency of my system?
5) As far as I can see, the jackstart parameter -a for using ASIO got removed. Does anyone know why?
6) My card is a Terratec EWX 24/96 (ice1712 alsa-driver). This card is capable of 96kHz sampling frequency. When running
Code:
jackstart -v -R -d alsa -d ice1712 -r 96000
i get this output:
Code:
back from read, ret = 1 errno == Success
getting driver descriptor from /usr/lib/jack/jack_dummy.so
getting driver descriptor from /usr/lib/jack/jack_alsa.so
jackd 0.94.0
Copyright 2001-2003 Paul Davis and others.
jackd comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details

registered builtin port type 32 bit float mono audio
capabilities: =i cap_setpcap,cap_ipc_lock,cap_sys_nice,cap_sys_resource+ep
loading driver ..
new client: alsa_pcm, id = 1 type 1 @ 0x805cb58 fd = -1
apparent rate = 96000
creating alsa driver ... ice1712|ice1712|1024|2|96000|0|0|hwmon|swmeter|rt|32bit
configuring for 96000Hz, period = 1024 frames, buffer = 2 periods
new buffer size 1024
registered port alsa_pcm:capture_1, offset = 4096
[snip]
registered port alsa_pcm:playback_10, offset = 0
++ jack_rechain_graph():
client alsa_pcm: internal client, execution_order=0.
-- jack_rechain_graph()
15766 waiting for signals
load = 0.1969 max usecs: 42.000, spare = 10624.000
delay of 12528.000 usecs exceeds estimated spare time of 10624.000; restart ...
delay of 12405.000 usecs exceeds estimated spare time of 10624.000; restart ...
delay of 12423.000 usecs exceeds estimated spare time of 10624.000; restart ...
delay of 12426.000 usecs exceeds estimated spare time of 10624.000; restart ...
delay of 12399.000 usecs exceeds estimated spare time of 10624.000; restart ...
delay of 12405.000 usecs exceeds estimated spare time of 10624.000; restart ...
delay of 12424.000 usecs exceeds estimated spare time of 10624.000; restart ...
delay of 12417.000 usecs exceeds estimated spare time of 10624.000; restart ...
delay of 12417.000 usecs exceeds estimated spare time of 10624.000; restart ...
delay of 12404.000 usecs exceeds estimated spare time of 10624.000; restart ...
delay of 12407.000 usecs exceeds estimated spare time of 10624.000; restart ...
delay of 12426.000 usecs exceeds estimated spare time of 10624.000; restart ...
delay of 12426.000 usecs exceeds estimated spare time of 10624.000; restart ...
delay of 12397.000 usecs exceeds estimated spare time of 10624.000; restart ...
delay of 12408.000 usecs exceeds estimated spare time of 10624.000; restart ...


I don't get the delay lines with other frequencies, and I do not really understand what they mean. Are these the good old XRuns? Does anyone have an idea on this? I want to get rid of them.
_________________
"Work is the curse of the drinking classes."
-Oskar Wilde
Back to top
View user's profile Send private message
Kristleifur
n00b
n00b


Joined: 04 Jan 2004
Posts: 41
Location: Iceland

PostPosted: Thu Mar 11, 2004 1:29 am    Post subject: Reply with quote

spitzwegerich wrote:
4) I may be blind, but where can I look up the actual latency of my system?


In qjackctl, there's a little box in the lower right corner of the Setup window that shows you the latency, according to the buffers you've set.

I like this thread. How's everybody doing?

Qjackctl starting jack with jackstart and then running alsaplayer is now working on an Audiophile card (ice1712).

Sometimes, the programs connecting to the jack server don't seem to want to connect unless run as root. Sometimes they do. Any ideas about that?

Any must-try tricks?
Back to top
View user's profile Send private message
Kristleifur
n00b
n00b


Joined: 04 Jan 2004
Posts: 41
Location: Iceland

PostPosted: Fri Mar 12, 2004 6:16 pm    Post subject: Reply with quote

Today I learned that DRI / GLX aren't compatible with jack running in realtime. It caused many things to hang on my system, including ps and top. Disabling the glx line in my xf86config seems to have fixed it. Here's a link to a thread on the jack developer mailing list: http://sourceforge.net/mailarchive/message.php?msg_id=7005966

Tomorrow will be fun.
Back to top
View user's profile Send private message
spitzwegerich
l33t
l33t


Joined: 04 Mar 2003
Posts: 697
Location: Lower Bavaria, Central Europe

PostPosted: Fri Mar 26, 2004 10:47 am    Post subject: Reply with quote

Now I know the reason why I got these lines:
Code:
delay of 12408.000 usecs exceeds estimated spare time of 10624.000; restart ...


My sample rate was locked at 44,1 kHz. After unlocking it in envy24control, everything is fine.
_________________
"Work is the curse of the drinking classes."
-Oskar Wilde
Back to top
View user's profile Send private message
Blahbbs
n00b
n00b


Joined: 15 Jul 2002
Posts: 42

PostPosted: Thu Apr 29, 2004 8:55 pm    Post subject: Reply with quote

I'm planning on tackling this soon, but using the 2.4.x kernel. My question is this: The 2.4.25-gentoo-sources kernel doesn't seem to have the low latency patches, so I thought I'd apply Andrew Morton's 2.4.25 patches and do it myself.

If I do it that way, should I be using the 2.4.25 vanilla sources, or is there another set of 2.4 sources that has the low latency patches in it?

I tried patching the 2.4.25-gentoo-r2 sources, but I had a few failed patched. I made a best guess to resolve them, and the kernel did compile, but I'm not a kernel hacker, so I'm not sure that's the best way to do it.

Any suggestions? I'm anxious to get a audio workstation going....

Thanks!
Back to top
View user's profile Send private message
spitzwegerich
l33t
l33t


Joined: 04 Mar 2003
Posts: 697
Location: Lower Bavaria, Central Europe

PostPosted: Thu Apr 29, 2004 10:36 pm    Post subject: Reply with quote

As far as I know, the gentoo-sources already should contain the low-latency patch. But you have to enable it in make menuconfig.
_________________
"Work is the curse of the drinking classes."
-Oskar Wilde
Back to top
View user's profile Send private message
krinkle
Guru
Guru


Joined: 04 Feb 2003
Posts: 338
Location: Garden Grove, CA

PostPosted: Mon May 10, 2004 4:17 am    Post subject: Reply with quote

dunno if it's a bug in the ebuild or just a brand new ebuild, but the USE flag jack-caps has changed to just caps in the .98.1 ebuild
Back to top
View user's profile Send private message
spitzwegerich
l33t
l33t


Joined: 04 Mar 2003
Posts: 697
Location: Lower Bavaria, Central Europe

PostPosted: Mon May 10, 2004 7:23 am    Post subject: Reply with quote

In fact, this already changed some time ago.
_________________
"Work is the curse of the drinking classes."
-Oskar Wilde
Back to top
View user's profile Send private message
shakti
Guru
Guru


Joined: 15 May 2002
Posts: 358
Location: omnipresent

PostPosted: Fri Jun 11, 2004 12:52 am    Post subject: Reply with quote

deleted wrong info about /tmp and jack
_________________
Using Gentoo since 2002.
Back to top
View user's profile Send private message
shakti
Guru
Guru


Joined: 15 May 2002
Posts: 358
Location: omnipresent

PostPosted: Thu Jun 17, 2004 6:32 am    Post subject: Step 2 alsa-libs Reply with quote

the alsa-libs ebuild is in media-libs/alsa-lib/... and not media-sound
_________________
Using Gentoo since 2002.
Back to top
View user's profile Send private message
BennyP
Guru
Guru


Joined: 09 May 2003
Posts: 497
Location: Toronto, Canada

PostPosted: Mon Jun 28, 2004 3:40 pm    Post subject: Reply with quote

everytime I try to start JACK, I get this error:
Code:
 loading driver ..
apparent rate = 44100
creating alsa driver ... hw:0|hw:0|1024|2|44100|0|0|nomon|swmeter|-|32bit
control device hw:0
configuring for 44100Hz, period = 1024 frames, buffer = 2 periods
Couldn't open hw:0 for 32bit samples trying 24bit instead
Couldn't open hw:0 for 24bit samples trying 16bit instead
Couldn't open hw:0 for 32bit samples trying 24bit instead
Couldn't open hw:0 for 24bit samples trying 16bit instead
19:47:02.580 MIDI connection change.
19:47:04.593 Could not connect to JACK server as client.

_________________
Could it be?
Back to top
View user's profile Send private message
krinkle
Guru
Guru


Joined: 04 Feb 2003
Posts: 338
Location: Garden Grove, CA

PostPosted: Tue Jun 29, 2004 6:19 pm    Post subject: Reply with quote

what is your sound card/what are you starting jack with?
(should this go in another thread?)
Back to top
View user's profile Send private message
BennyP
Guru
Guru


Joined: 09 May 2003
Posts: 497
Location: Toronto, Canada

PostPosted: Tue Jun 29, 2004 10:16 pm    Post subject: Reply with quote

i have an sblive value and i use qjackctl (jackd)
_________________
Could it be?
Back to top
View user's profile Send private message
shakti
Guru
Guru


Joined: 15 May 2002
Posts: 358
Location: omnipresent

PostPosted: Tue Jun 29, 2004 10:53 pm    Post subject: Reply with quote

Make sure ARTS is not running, use USE="jack" when emerging alsa...
_________________
Using Gentoo since 2002.
Back to top
View user's profile Send private message
BennyP
Guru
Guru


Joined: 09 May 2003
Posts: 497
Location: Toronto, Canada

PostPosted: Thu Jul 01, 2004 1:38 am    Post subject: Reply with quote

I followed up till STEP 7, but i dont have jackstart
_________________
Could it be?


Last edited by BennyP on Thu Jul 01, 2004 2:28 am; edited 1 time in total
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum