Quantcast
Channel: Planet Ubuntu
Viewing all articles
Browse latest Browse all 12025

Joel Leclerc: Creating an orchestral track under Ubuntu – Part 1: Setting up JACK

$
0
0

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”:

qjackctl-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

Hope this helps!



Viewing all articles
Browse latest Browse all 12025

Trending Articles