Skip to content

Instantly share code, notes, and snippets.

@floer32
Created May 12, 2016 05:27
Show Gist options
  • Save floer32/f16ae2dd2ed9c8520dde40dcf0d50924 to your computer and use it in GitHub Desktop.
Save floer32/f16ae2dd2ed9c8520dde40dcf0d50924 to your computer and use it in GitHub Desktop.
old, old post. for posterity. relates to https://github.com/hangtwenty/borderlands-granular-pitch-patch
title date description categories tags
Building Borderlands Granular on Ubuntu 12.04 LTS
2012-10-23
music
linux
music
linux
synth
granular

##What Borderlands is

Borderlands is a granular synth by Chris Carlson. It has a really, really slick interface. Chris has released the most recent version of Borderlands for iPad and it looks absolutely incredible. Unfortunately, not all of us have an iPad. But fortunately, Chris released the source a while back.

Get Borderlands here. You can also get my monkeypatch of it, which changes the format for inputting the pitch parameter, here.

Below are instructions on how to build Borderlands from source on Ubuntu 12.04 LTS. This is the most complicated source build I've had to do yet, and more or less may be required for your environment. (I built this on a newish Samsung laptop.) Regardless I think that this should help most Ubuntu 12 users get this up and running.

##Prepare to make Borderlands There are various dependencies that we need to install before Borderlands will build or run properly.

###Download the source and unzip it Open a terminal then enter these two commands. (Keyboard shortcut for opening a terminal: Ctrl + Alt + T.)

wget https://ccrma.stanford.edu/~carlsonc/256a/Borderlands/Borderlands_v04.zip
unzip Borderlands*

###If you've never used make before If you've never used make to build something from source before, you may need to install build-essentials.

sudo apt-get install build-essential # sorry for the typo that was here before!

###Download and build libsndfile (from the Borderlands README)

Again, enter these commands. You can enter them one by one or copy and paste the whole block.

# get it
wget http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.25.tar.gz
# untar it
tar -zxvf libsndfile*
# change into that directory
cd libsndfile*
# configure, make, and install it
sudo ./configure && sudo make && sudo make install
# change back your home directory
cd ~

###Install other dependencies not in the README

####Install some OpenGL-related things OpenGL stands for Open Graphics Library.

sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev

####Install JACK dev files JACK stands for JACK Audio Connection Kit. It's a staple in Linux audio editing and recording, and it can do a lot of cool things like giving you a patch bay for routing audio between programs.

sudo apt-get install jackd2 libjack-jackd2-dev

You should be asked a question: whether you want JACK to run with real-time priority. Your answer will not break or break the build. It's just a tweak. I answered 'yes'. If you know what this means and don't want to enable real-time priority, just answer 'no'.

####Install ALSA dev files ALSA stands for Advanced Linux Sound Architecture - it provides open APIs to audio drivers and other cool stuff.

sudo apt-get install libasound2-dev

###Some configuration

####Add your user to the 'audio' group Replace 'username' with your own username in the command below.

sudo adduser username audio

####Free the audio device

You may need to disable the speech dispatcher (which is used for text-to-speech stuff) - so just run this command to be sure.

sudo /etc/init.d/speech-dispatcher stop

Make JACK play with Pulse Audio

Now we configure JACK to use Ubuntu's default Pulse Audio. Pulse Audio is a sound system used by Ubuntu, so you already have it. Configuring JACK to just interface with Pulse Audio is the easiest solution to getting JACK working, but it also has worse latency than some other options. It should be good enough to start playing with Borderlands and see if you want to optimize, later.

sudo apt-get install pulseaudio-module-jack

###Reboot your computer!

We're almost done, I promise.

Wrapping up

make Borderlands

Change into Borderlands source directory, then into Borderlands, and make it. (Make automatically compiles parts of a source package that need to be recompiled.) You should see a bunch of stuff pop up but no error messages.

cd ~ # if you're not in home any more
cd Borderlands*
cd Borderlands*
sudo make

Put your loops in the loops folder

Now Borderlands is ready to go, but first you should put WAVs or AIFFs in the loops folder within the Borderlands directory.

Start JACK

Lastly, every time you want to use Borderlands you will need to start JACK. This isn't Borderlands-specific but generally needed for audio stuff on Linux. There are commands for doing this, but the preferred method is to use QjackCtl. Download it from the Software Center (I wasn't able to get it with apt-get). Then open QjackCtl, click 'start', and hopefully JACK will start without a hitch.

Start Borderlands!

Finally, with JACK running, you should be able to use the command below to run Borderlands.

cd ~/Borderlands*/Borderlands/ # if you need to
./Borderlands # this actually runs it

Controls

You can find the documentation on controls here.

You won't remember all of these controls right of the bat. I recommend either opening these instructions in another workspace and switching workspaces as necessary (to switch workspaces: Ctrl + Alt + Cursor Keys). Alternatively, you could print them out.

borderlands-tools

I have made two little utilities that make it totally painless to (a) launch Borderlands with JACK, plus an effects rack, plus Audacity for recording - and (b) to manage your Borderlands loops folder. It's lightweight and has minimal setup.

Get it here: https://github.com/hangtwenty/borderlands-tools


####Please leave comments if you have any trouble

I will do my best to help. Also let me know if this helped you out or any other feedback, as this is the first technical or Linux tutorial I've written.

If you want to cut down on latency, read this

Using Pulse Audio, I get about ~40-50ms latency. This is not good for a live setting), but acceptible for just playing around and recording with Borderlands. Because face it, you're not going to have extremely responsive control using the trackpad and keyboard on this thing (compared with the iPad version at least).

You can view your own latency from the setup panel in JACK. The simplest way to improve your latency is to tweak JACK's set up. See an example setup and some commentary here for guidance, if you find you want to improve this. Decreasing 'Periods/Buffer' from 3 to 2 made the most immediate difference for me.

If, after that, you still want to improve the performance, you'll need to look into setting up "realtime audio" for Ubuntu. (See here if you want to pursue this route.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment