Play a digital orchestra with Linux Sampler

Linux Sampler is a specialized multimedia tool aimed at musicians. You can play the whole orchestra with just a few gigs of samples.
29 readers like this.
CC-BY-SA William Kenlon  http://www.williamkenlon.com

William Kenlon. CC BY-SA 4.0

Synthesizers have been attempting to emulate real-world musical instruments for decades. Famous synthesist Wendy Carlos worked hard to understand (and document, in her Secrets of Synthesis album) how synthesizers could capture the intent of music initially written for physical instruments. Musicians came to understand, though, that if you wanted to capture the exact sound and feel of an instrument, you had to record it, and the Mellotron famously pioneered this idea with tape loops connected to a keyboard. When synthesizer technology transitioned from analog to digital, sampling became a standard practice.

In the context of musical synthesis, sampling is the process of recording a real instrument and then using that recording to make new music. It's an important idea in music because few people have access to every instrument they happen to want to compose music for. And if you want to write a score featuring a full symphonic orchestra for a video game, it's likely out of your budget to hire an orchestra, a studio, and engineers. However, with open source, you can certainly afford to hook your MIDI keyboard up to Linux Sampler.

Install Linux Sampler

Linux Sampler is a specialized multimedia tool aimed at musicians, so not all distributions package it in their repositories.

On Fedora, CentOS, Mageia, and similar, you can download Linux Sampler from the Planet CCRMA repository, or use a build from COPR:

$ sudo dnf copr enable klaatu/linuxsampler
$ sudo dnf install linuxsampler

On Debian and similar, download the DEB installer from linuxsampler.org and install:

$ sudo dpkg -i linuxsampler*deb

For macOS and Windows, download installers from linuxsampler.org and launch the installer.

Linux Sampler is actually just the engine to play sample files.

You also need a front-end application so that you can interact with it. There are two user interfaces provided on the Linux Sampler website: Qsampler and Fantasia. Fantasia is a Java desktop application, so it works regardless of your operating system. You can download Fantasia from the Linux Sampler website.

Getting samples

Linux Sampler plays three different kinds of sample files:

  • .gig (also known as Gigastudio or Gigasample files)
  • .sf2 (also known as Soundfont)
  • .sfz (an open standard with no relation to the .sf2 Soundfont format)

There are several sources for free and open source sound banks in all of these formats, including the Virtual Playing Orchestra project, the Versil Studio collection, Flame Studios guitar samples, and many more. You can also purchase bundles of Gigasamples from a number of sample bank companies. As long as you have Linux Sampler, you have a way to play Gigasamples, Soundfonts, and SFZ files.

Making music with Linux Sampler

The Fantasia interface for Linux Sampler has a three-column configuration.

  • On the right is the main configuration panel. This is where you select audio and MIDI devices.
  • In the middle is the rack. This is where you add virtual synths, each with a unique sample bank loaded.
  • On the left is the Orchestra and Instrument panel. This is largely an optional panel to build a collection of instruments you often use for quick access.

Audio configuration

To set your audio output, click the Power button on the left of the Audio Devices entry in the right column. For Linux, you can use Advanced Linux Sound Architecture (ALSA) or Jack Audio Connection Kit (JACK). The JACK system allows you to route sound from different applications as if they were all coming from the same application.

JACK is a powerful system, but it does take time to learn. If you want to use ALSA instead, you must suspend Pulse Audio so that Linux Sampler can lay claim to your audio output device.

To set Linux Sampler to use ALSA:

$ cat << EOF  >> fantasia.sh
> #!/bin/sh
> java -jar $HOME/Downloads/Fantasia-0.9.jar
> EOF
$ chmod +x ./fastasia.sh

Each time you launch Fantasia, use this command:

$ pasuspender ./fastasia.sh

MIDI configuration

Linux Sampler responds to MIDI signals. To create a new MIDI device, click the Power button on the left of the MIDI Devices entry in the right column. On Linux, you can use ALSA or JACK to manage MIDI.

Personally, I use ALSA for MIDI even when I'm using JACK.

Adding instruments

To play your samples, you need a synthesizer (a sampler channel, in Fantasia's terminology) in your rack with a sample bank loaded. To add a sampler channel, click the Power button on the left of the MIDI Devices entry in the middle column.

Linux Sampler defaults to GIG, but you can click the GIG button on the rack unit to choose a different format. Click the Load instrument button to select the file you want to load.

Playing sound

To play your samples, you can use the virtual keyboard at the bottom of the window. Click on an instrument in the middle column to make it active, and then click on the keyboard at the bottom of the window. Alternately, if you're using a USB MIDI keyboard, you can use it to trigger sounds.

Advanced MIDI setup

The virtual piano keyboard at the bottom of the screen uses MIDI channel 1 by default, and that's what all of your instruments in the middle rack are set to when you create them. Suppose you want to trigger sounds over a specific MIDI channel, either because you're using a MIDI keyboard that sends signals over that channel or because you're triggering sounds from a separate application. In that case, you can change the MIDI channel of each instrument. To see an instrument's MIDI settings, click the Options button on the right of the rack unit. You can set your MIDI input, port, channel, and more in the drop-down panel that appears.

Open source orchestration 

I love a good cinematic score, with a full orchestra, swelling crescendos, and plucky arpeggios when it comes to movies and video games. I also really enjoy old music, and it's amazing how many MIDI files are out there that provide a sort of "digital sheet music" for old classics. I don't have access to a full chamber orchestra myself, but I do have access to a lot of great open source technology and open culture work that, when combined, allows me to compose and play a digital orchestra. Linux Sampler doesn't have a sequencer built into it. It's just a player. Combine it with a digital audio workstation such as Ardour, Qtractor, or Rosegarden to create your own scores, songs, or just use it as a sound source for MIDI files. If you close your eyes, you might just convince yourself a real live band is serenading you.

Seth Kenlon
Seth Kenlon is a UNIX geek, free culture advocate, independent multimedia artist, and D&D nerd. He has worked in the film and computing industry, often at the same time.

Comments are closed.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.