jack...without jackctl ?

Post fully complete "how to" guides and tutorials here. This is a great place to get feedback on stuff you might put in the wiki.

Moderators: MattKingUSA, khz

Post Reply
phil123456
Established Member
Posts: 13
Joined: Sun Sep 30, 2018 7:12 pm

jack...without jackctl ?

Post by phil123456 »

Hi,
I have setup jack to start with systemd

- qjackctl does not find it running, but the same command ran on the command line works
- how to use jack so that it starts the qjackctl patchbay config, without running qjackctl ?

thanks

Code: Select all

[Unit]
Description=Jack audio server
After=sound.target

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
PrivateTmp=true
Environment="JACK_NO_AUDIO_RESERVATION=1"
#ExecStart=/usr/bin/jackd -T -ndefault -dalsa -dhw:0 -r48000 -p1024 -n2
ExecStart=/usr/bin/jackd -R -P20 -dalsa -dhw:0,1 -r49000 -p1024 -n2 

Loki Harfagr
Established Member
Posts: 66
Joined: Thu Aug 02, 2018 1:28 pm

Re: jack...without jackctl ?

Post by Loki Harfagr »

This setting smells quite baadfishyyd

Code: Select all

-r49000

phil123456
Established Member
Posts: 13
Joined: Sun Sep 30, 2018 7:12 pm

Re: jack...without jackctl ?

Post by phil123456 »

ok it's a typo, but that's not the point
it did not work with 48000 either
and it has nothing to do with the question

tramp
Established Member
Posts: 1675
Joined: Mon Jul 01, 2013 8:13 am

Re: jack...without jackctl ?

Post by tramp »

you need to run the service in your user environment.

Code: Select all

[Service]
User=USERNAME
Type=oneshot
Environment="XDG_RUNTIME_DIR=/run/user/USERID"
ExecStart=/usr/bin/jackd -R -P20 -dalsa -dhw:0,1 -r48000 -p1024 -n2 
replace USERNAME with your User name (logname) and USERID with your users ID (id -u $(logname))
On the road again.

phil123456
Established Member
Posts: 13
Joined: Sun Sep 30, 2018 7:12 pm

Re: jack...without jackctl ?

Post by phil123456 »

that makes sens, I'll give it a try

but do you know how to make jack "run" the qjackctl config automaticaly ? without running qjackctl ?

tramp
Established Member
Posts: 1675
Joined: Mon Jul 01, 2013 8:13 am

Re: jack...without jackctl ?

Post by tramp »

I don't know what you mean, the QjackCtl config file is usually located in ~/.config/rncbc.org/QjackCtl.conf and contain configuration for QjackCtl. That is only related when you run QjackCtl, and does nothing at all when you didn't use QjackCtl.

Maybe you mean the jackd configuration file? This one is in ~/.jackdrc and contain the jackd start parameters which are used (and saved) by Qjackctl.
On the road again.

phil123456
Established Member
Posts: 13
Joined: Sun Sep 30, 2018 7:12 pm

Re: jack...without jackctl ?

Post by phil123456 »

if I don't run qjackctl, nothing works, programs dont receive midi and no sound gets to alsa
this is how the wonderful audio linux world works, and it has basicaly always been like that

so I was wondering if I could run that config file so the patchbay is active so the routing works

tramp
Established Member
Posts: 1675
Joined: Mon Jul 01, 2013 8:13 am

Re: jack...without jackctl ?

Post by tramp »

QjackCtl is "just" a graphical front-end for jackd. So, if you want to have jackd started as if it was started by QjackCtl, check the file ~/.jackdrc, it contains the exact command line QjackCtl use to start jackd. Beside that, QjackCtl may also start some scripts or applications, when set so in the option tab.
Surly you need to connect ports to be able to receive/send midi events and audio buffers between applications and the hardware port. You could do that on the command line (jack_connect) or, with a graphical frontend like qjackCtl. Some apps providing there own patchbay as well.
On the road again.

phil123456
Established Member
Posts: 13
Joined: Sun Sep 30, 2018 7:12 pm

Re: jack...without jackctl ?

Post by phil123456 »

I'll dig this out thanks

phil123456
Established Member
Posts: 13
Joined: Sun Sep 30, 2018 7:12 pm

Re: jack...without jackctl ?

Post by phil123456 »

I applied the changes you suggested, but it fails to start at all

Code: Select all

[Unit]
Description=Jack audio server 
After=sound.target

[Install]
WantedBy=multi-user.target

[Service]
Type=oneshot
User=pi
Environment="JACK_NO_AUDIO_RESERVATION=1"
Environment="XDG_RUNTIME_DIR=/run/user/USERID"
ExecStart=/usr/bin/jackd -R -P20 -dalsa -dhw:0,1 -r48000 -p1024 -n2
here is the log:

Code: Select all

May 09 20:35:10 raspberrypi jackd[413]: JACK is running in realtime mode, but you are not allowed to use realtime scheduling.
May 09 20:35:10 raspberrypi jackd[413]: Please check your /etc/security/limits.conf for the following line
May 09 20:35:10 raspberrypi jackd[413]: and correct/add it if necessary:
May 09 20:35:10 raspberrypi jackd[413]:   @audio          -       rtprio          99
May 09 20:35:10 raspberrypi jackd[413]: After applying these changes, please re-login in order for them to take effect.
May 09 20:35:10 raspberrypi jackd[413]: You don't appear to have a sane system configuration. It is very likely that you
May 09 20:35:10 raspberrypi jackd[413]: encounter xruns. Please apply all the above mentioned changes and start jack again!
May 09 20:35:10 raspberrypi systemd[1]: jackd.service: Main process exited, code=exited, status=255/EXCEPTION
May 09 20:35:10 raspberrypi systemd[1]: jackd.service: Failed with result 'exit-code'.
May 09 20:35:10 raspberrypi systemd[1]: Failed to start Jack audio server.

tramp
Established Member
Posts: 1675
Joined: Mon Jul 01, 2013 8:13 am

Re: jack...without jackctl ?

Post by tramp »

phil123456 wrote:
Sat May 09, 2020 6:38 pm
Environment="XDG_RUNTIME_DIR=/run/user/USERID"
You need to replace USERID with your real user id. When your user name is pi, you get your id with:

Code: Select all

id -u pi
usually on linux the first user have the id 1000.
On the road again.

phil123456
Established Member
Posts: 13
Joined: Sun Sep 30, 2018 7:12 pm

Re: jack...without jackctl ?

Post by phil123456 »

stupid of me, :-)

I followed this tutorial https://jackaudio.org/faq/linux_rt_config.html

I added 2 lines to /etc/security/limits.conf

Code: Select all

@audio   -  rtprio     95
@audio   -  memlock    unlimited
and added my user pi to the group audio

Code: Select all

usermod -a -G audio pi
maybe I should not use realtime audio ?

Code: Select all

Type=oneshot
User=pi
Environment="JACK_NO_AUDIO_RESERVATION=1"
Environment="XDG_RUNTIME_DIR=/run/user/1000"
ExecStart=/usr/bin/jackd -R -P20 -dalsa -dhw:0,1 -r48000 -p1024 -n2
it still fails

Code: Select all

May 10 13:16:35 raspberrypi jackd[424]: JACK is running in realtime mode, but you are not allowed to use realtime scheduling.
May 10 13:16:35 raspberrypi jackd[424]: After applying these changes, please re-login in order for them to take effect.
May 10 13:16:35 raspberrypi jackd[424]: You don't appear to have a sane system configuration. It is very likely that you
May 10 13:16:35 raspberrypi jackd[424]: encounter xruns. Please apply all the above mentioned changes and start jack again!
May 10 13:16:35 raspberrypi systemd[1]: jackd.service: Main process exited, code=exited, status=255/EXCEPTION

tramp
Established Member
Posts: 1675
Joined: Mon Jul 01, 2013 8:13 am

Re: jack...without jackctl ?

Post by tramp »

phil123456 wrote:
Sun May 10, 2020 11:23 am
maybe I should not use realtime audio ?
Oh, I think you should, you'll get other problems when you don't.

Maybe you need to run the service after multi-user.target, so that limits.conf is read by pam and takes the desired effect.

or you could try to add

Code: Select all

LimitRTPRIO=infinity
LimitMEMLOCK=infinity
to the service:

Code: Select all

[Service]
Type=oneshot
LimitRTPRIO=infinity
LimitMEMLOCK=infinity
User=pi
Environment="JACK_NO_AUDIO_RESERVATION=1"
Environment="XDG_RUNTIME_DIR=/run/user/1000"
ExecStart=/usr/bin/jackd -R -P20 -dalsa -dhw:0,1 -r48000 -p1024 -n2
On the road again.

Post Reply