Build LinuxSampler—Beginner’s guide

LinuxSampler is the best sampler available for Linux, yet the installation process requires a high level of technical expertise. I took several months to work successfully through the official instructions. Below is an attempt to simplify the process for others. If you are a musician on Ubuntu or Ubuntu Studio and want a decent sampler, these instructions should get you there.

My instructions differ from the official instructions by observing the following rules:

  1. The instructions are strictly sequential.
  2. The instructions explain any technical terms that are beyond the vocabulary of a typical computer user.
  3. The instructions are current. They refer to the latest versions of Ubuntu and the latest code for LinuxSampler
The instructions may be lengthy, but hopefully they are clear. If you get stuck, post a question in the LinuxSampler forums or contact me.

Obtain source code

Source code is a set of files created by computer programmers. The files tell the computer exactly how LinuxSampler should look and behave. The first step in your journey is to obtain the latest source code for LinuxSampler.

At the time of this writing the "latest official releases" from July 2009 are out-of-date and not recommended. However you can obtain the very latest source code using software called Subversion.

  1. Start the application called "Terminal Emulator".
    (If you have never used the Terminal before you might find Using the Terminal—Basic Guide helpful.)
  2. To install Subversion type the following (then press the Enter key):
    sudo apt-get install subversion
    (Subversion is a tool used by software developers to access the very latest source code for a given software project.)
  3. Type your password when prompted and type Y when asked to confirm the installation.
  4. Create a folder called "lssvn", by typing the following command:
    mkdir lssvn
    (The special command mkdir stands for "Make Directory". Technically you can call your directory/folder almost anything, except it cannot contain spaces or use the name "linuxsampler".)
  5. Open the folder you just created by typing the following:
    cd lssvn
    (The special command cd stands for "Change Directory".)
  6. Copy and paste the following line into Terminal. (Note: Terminal does not let you used keyboard shortcuts to paste. Instead you can right-click on the window and choose Paste.)
    svn co https://svn.linuxsampler.org/svn/libgig/trunk libgig
    (This downloads the first section of source code you need and saves it to a folder called "libgig".)
  7. Copy and paste the following line into Terminal.
    svn co https://svn.linuxsampler.org/svn/linuxsampler/trunk linuxsampler
    (This downloads the second section of source code and saves it to a folder called "linuxsampler". For now we only need two sections of the LinuxSampler source code, but the official site lists how to obtain all seven.)

Compile source code

Now that you have the source code, the next step is to convert this human-readable code into something that the machine can read and run. This process of converting into machine code is called compiling. It can take a while to convert, but the end result is a program that runs very fast.

Compile libgig

  1. Copy and paste the following line into Terminal:
    sudo apt-get install g++ debhelper pkg-config automake libtool fakeroot libsndfile1-dev doxygen uuid-dev lv2core lv2-dev
    (This installs several software tools required to compile libgig and linuxsampler. The last two, lv2core and lv2-dev are required if you want to use LinuxSampler as a plugin within another program such as Ardour, Rosegarden, etc.)
  2. Open the libgig folder:
    cd libgig
  3. Copy and paste the following line:
    dpkg-buildpackage -rfakeroot -b
    (This starts the compilation process for libgig. It takes several minutes.)
  4. Go back to the lssvn folder.
    cd ..
    (The double dot (..) means go to the folder directly above the current one.)
  5. If libgig compiled successfully you should see three ".deb" files in the lssvn folder.
    ls
    (The special command ls stands for "List" and displays the files and folders in the current directory.)
  6. Install each of the three ".deb" files that you see listed in the previous step. Note: The exact filenames differ for 64-bit Linux and 32-bit Linux, and the version numbers may change with time. So replace the filenames listed below with the ones you saw listed in the previous step. (Start with libgig6 because the other packages depend on it).
    sudo dpkg -i libgig6_3.3.0-6_amd64.deb
    sudo dpkg -i gigtools_3.3.0-6_amd64.deb
    sudo dpkg -i libgig-dev_3.3.0-6_amd64.deb

Compile linuxsampler proper

  1. Copy and paste the following line:
    sudo apt-get install bison libjack-jackd2-dev flex
    (Bison is an additional software tool required to compile linuxsampler. The libjack-jackd2-dev package installs files needed to support MIDI via JACK 2. If you want to use JACK 1 instead install libjack-dev. Flex is required to for the instrument script parser.)
  2. Open the linuxsampler folder.
    cd linuxsampler
  3. Copy and paste the following line:
    dpkg-buildpackage -rfakeroot -b
    (This starts the compilation process for linuxsampler. It takes longer to compile than libgig.)
  4. If you get an error "No rule to make target `parser.h', needed by `all'." then type:
    make parser
    And repeat the previous step to restart the compilation process.
  5. Go back to the lssvn folder.
    cd ..
  6. If linuxsampler compiled successfully you should see three new ".deb" files in the lssvn folder.
    ls
  7. Install each of the three new ".deb" files that you see listed in the previous step. Note: As before, the exact filenames on your computer may differ from the ones listed below, but they should all contain the word "linuxsampler" and end with ".deb". Just replace the filenames listed below with the ones you saw listed in the previous step.
    sudo dpkg -i liblinuxsampler_1.0.0-1_amd64.deb
    sudo dpkg -i liblinuxsampler-dev_1.0.0-1_amd64.deb
    sudo dpkg -i linuxsampler_1.0.0-1_amd64.deb

Future updates

Now that you successfully compiled libgig and linuxsampler, you are ready to proceed to the next section, "Download and run Fantasia". However the next time you want to update libgig or linuxsampler you can skip many of the steps listed above. All you need to do is use the cd command to open the libgig folder, type svn update to obtain the latest code, then proceed with step 3 listed in the instructions above. Do the same with the linuxsampler folder.

Download and run Fantasia

The code you have compiled so far is the backend of LinuxSampler. The backend is basically invisible to the user when running, but performs all the computational duties. The last part you need is the frontend which displays a window and gives you access to all the features of LinuxSampler. The frontend of LinuxSampler is called "Fantasia". Unlike the backend, Fantasia doesn't require any compilation. You just need to check you have Java installed, download Fantasia, and set it to run as a program.

  1. Copy and paste the following line into Terminal:
    sudo apt-get install default-jre
  2. Download Fantasia:
    http://downloads.sourceforge.net/jsampler/Fantasia-0.9.jar
  3. Go back to the Terminal and open the Downloads folder:
    cd ~/Downloads
    (Linux is case-sensitive. Be sure to spell with an upper-case "D".)
  4. Since this file was downloaded from the Internet you need to manually give it permission to run as software.
    chmod a+x Fantasia-0.9.jar
  5. Open the Downloads folder using your normal point-and-click File Manager (rather than Terminal).
  6. Right-click on Fantasia-0.9.jar and choose "Open With Other Application..."
  7. From the list of Recommended Applications select "OpenJDK Java 7 Runtime" (the exact name may vary, but should include the word "Java).
  8. Click "Open".

Congratulations! After a few moments the Fantasia window should display and you are ready to use LinuxSampler.

If you have not used LinuxSampler before, set aside a few evenings to learn it. The OpenOctaveProject created a guide that is more complete than the official documentation. See https://github.com/ccherrett/oom/wiki/Linuxsampler_guide.pdf

Optimize LinuxSampler

You can optimize LinuxSampler to run even faster on your particular machine. The optimization process is beyond the scope of this simplified guide, but the official site has instructions (see LinuxSampler for Debian HOWTO). At the time of this writing the official instructions are a little disorganized. You need to read two sections all the way through, "3. Building the Backend" and "4. Benchmark", before you can understand what to do.

David Bolton, 3 November 2013. Updated 12 July 2014.