lkubuntu
A listing of random software, tips, tweaks, hacks, and tutorials I made for Ubuntu
Creating an orchestral track under Ubuntu – Part 1: Setting up JACK
August 8, 2013
Posted by on In my previous post, I was talking about (okay, fine, advertising) a track I made under linux, using LMMS, and I said I would write a tutorial on setting up an audio studio, and creating a track with it, so here it is! I’ll dividing this tutorial into multiple parts, so stay tuned (one way to do this is to subscribe … hint, hint ;) )!
This part, as the title says, is to setup JACK. This is probably the most frustrating step in setting up your studio, but it’s very important! Most people will try to make it work with a program named QjackCtl. If that works for you, awesome! But it never worked for me. So instead, I’ll show you how I made it working, well, without it (mostly).
Here is the command I run on my computer to start JACK. It’s probably not optimal, but it works for me:
killall jackd;killall pulseaudio;jackd -R -t 1000 -d alsa -P hw:0,0 -r 48000 -n2 -D
This will probably not work on your computer, but we’ll test it, using alsaplayer (install it if you don’t have it yet, and make sure that the volume levels are at 100%, and nothing is muted):
alsaplayer -o jack PATH/TO/AUDIO/FILE.mp3
And, of course, replace PATH/TO/AUDIO/FILE.mp3 to the path to an audio file (that you know works, and for your convenience, I’ve uploaded a working test audio file here: http://www.uploadmb.com/dw.php?id=1375942423). The test is simple: Click on the play button. Do you hear audio? If yes, then JACK works! If no, then, well, do I need to clarify this? :P
Anyways, if it doesn’t work, what you’ll have to do is to try EVERY. SINGLE. AUDIO DEVICE. (and subdevices). Sounds like a lot of repetitive work, right? It is! So to get the audio device list, open up QjackCtl (I said that we’d get it working mostly without it, not completely!), select “Setup”, and click on the arrow beside “Interfaces”:
Now, if you look carefully, you might find a red circle around a certain area. That area contains the hardware ID (for lack of a better term) which we will be giving to JACK. So re-run this command, changing the part in bold with the ID you saw:
killall jackd;killall pulseaudio;jackd -R -t 1000 -d alsa -P hw:0,0 -r 48000 -n2 -D
And then re-test JACK (using the alsaplayer test I mentioned earlier). If it doesn’t work, keep on repeating the JACK step, changing the hardware ID each time, and, of course, test it. Once it works, package it up in a script, like this:
#!/bin/bash killall jackd;killall pulseaudio;jackd -R -t 1000 -d alsa -P HARDWARE_ID_HERE -r 48000 -n2 -D & # The ampersand at the end is intentional, as it runs it in the background
Save it, and chmod +x
it (set it as executable), then run it when you need JACK.
Bonus: Routing Pulseaudio to JACK
Don’t worry, this part is simple :D . Make sure JACK and pulseaudio are running (you can run pulseaudio by running this: pulseaudio &
), then run this:
pactl load-module module-jack-sink channels=2; pactl load-module module-jack-source channels=2;pacmd set-default-sink jack_out
You might have to re-run it, and restart applications using pulseaudio.
This is the full script I use to start JACK, and route pulseaudio to it:
#!/bin/bash killall -KILL jackd killall -KILL pulseaudio jackd -R -t 1000 -d alsa -P hw:0,0 -r 48000 -n2 -D & # REMEMBER TO CHANGE hw:0,0 sleep 3 pulseaudio & sleep 3 pactl load-module module-jack-sink channels=2; pactl load-module module-jack-source channels=2;pacmd set-default-sink jack_out pactl load-module module-jack-sink channels=2; pactl load-module module-jack-source channels=2;pacmd set-default-sink jack_out
I think you should check out Ubuntu Studio. Not only for `gladish` to help connecting all your JACK stuff (Guitarix/Hydrogen/Ardour/LMMS/Audacity/etc…) but also for the `low-latency` kernel. You can actually simply install is on top of an existing Ubuntu install, as well. It uses Xfce4 as the main interface with a nice custom menu. Though you can of course use your DE of choice, and still have the nice kernel and huge app set that Ubuntu Studio includes.
p.s. I haven’t had much trouble with JACK & QjackCtl, but gladish is super fancy for pluging in all your stuff like it is a physical rack
Yeah, Ubuntu Studio, KXStudio, and AVLinux seem to definitely be the best for this kind of thing, but this tutorial is for setting up a studio inside plain ubuntu (since I personally don’t like changing distros just to have a certain setup) :)
And thanks for letting me know about gladish, it looks quite interesting! It’s kind of like non-session-manager meets jackpatch meets patchage… looks really useful :D
Pingback: Creating an orchestral track under Ubuntu – Part 2: Setting up LMMS | lkubuntu
Pingback: Joel Leclerc: Creating an orchestral track under Ubuntu – Part 2: Setting up LMMS - itux.info
Pingback: How to set up WineASIO | lkubuntu
Pingback: Joel Leclerc: How to set up WineASIO | itux.info
Pingback: MIDI on ubuntu – Hanin.net
Pingback: JACK & PulseAudio on Ubuntu – Hanin.net