The LinuxSampler Project

March 3rd, 2008 by Dave Phillips in

Your rating: None Average: 5 (1 vote)

This week we'll look at what's been going on recently with LinuxSampler, a very cool software audio sampler. I have to say at the outset that this article was tough to write, I was just having far too much fun with the program.

This statement from the LinuxSampler Web page concisely describes the project's aims:

"The LinuxSampler project was founded with the goal to produce a free, open source pure software audio sampler with professional grade features, comparable to both hardware and commercial Windows/Mac software samplers and to introduce new features not yet available by any other sampler in the world."

As short and sweet a rationale as ever could be expressed, and a perfect description of the project. However, before we see whether the description is indeed perfect, let's take a quick trip down MIDI Memory Lane for a little background on those other samplers, both hard and soft.

Some Sampler History

The modern studio sampler is an electronic musical instrument related to the digital audio synthesizer. The synthesizer creates its sounds from a set of audio synthesis parameters, but a sampler uses a recording of an actual sound as the basis for its sound-creation functions. Like the synthesizer, the sampled sound can be transformed and modulated by envelopes, LFOs, special effects, and other sound-shaping functions.

Unfortunately a single sample from an instrument is insufficient material for a convincing recreation of the sound of that instrument over its entire musical range. Thus, multisample libraries were developed that include dozens or even hundreds of recordings of an instrument sampled in different playing ranges, with different articulations and idiomatic performance techniques (bowing, embouchures, plucking) to more accurately represent the sonic possibility of the real instrument, while realtime MIDI control of parameters such as filter cutoff values and LFO rate added greater realism to the sound.

When I started using MIDI software in conjunction with hardware synthesizers I was amazed by the new freedom brought by these incredible tools. At the same time I had to confess that while imitative synthesized sounds could be useful, they rarely passed inspection when compared to the sounds from an actual instrument. Fortunately, it wasn't long before the growing digital music instruments industry unveiled MIDI-capable samplers at affordable prices. These early MIDI-capable samplers were designed for use with a keyboard or some other MIDI controller such as a wind controller or an external sequencer. To conserve precious RAM, most samplers let the user set up a map of discrete or overlapping zones of samples (a.k.a. splits and layers) across the span of the MIDI note range (0-127). Thus, MIDI note numbers 24 through 47 could be assigned to a string bass, numbers 48 through 71 might be a piano, and notes 72 though 96 could be an organ sound. Note-on/off velocity, key pressure, pedal status, wheel position, and slider values could be freely routed to a sampler's MIDI-controllable parameters, making the machine far more powerful than a mere sample playback device.

Major electronic instrument manufacturers developed a variety of now-classic hardware samplers. Affordable machines made by Roland, Yamaha, Akai, Ensoniq, and E-mu soon became studio stalwarts, while Fairlight and NED continued to advance their hardware for users less constrained by budget considerations.

Hardware samplers also introduced audio looping. Looping was originally utilized as a method for sustaining a sampled sound for the duration of a MIDI key-press. A relatively stable section of the sampled sound could be assigned start and end points to provide the loop boundaries. When the sample was played the designated section would repeat itself until the key-press was released, at which point the sample played until its end. Basic looping simply repeats the looped section from start to end, but sampler designers evolved more complex loop functions, many of which were exploited by rap and hip-hop artists.

As samplers developed, so did computers. By the late 1990s the hardware sampler's limitations had become apparent. Better samples require more memory, the proprietary RAM chips for samplers were expensive, and the operating systems for hardware samplers were often incapable of supporting the large amounts of memory required by sampled sounds such as the full decay of a cymbal crash or a complete multisampled piano. Consumers also wanted faster access to their samples and for new controls such as pitch-shifting and time-stretching. By the late 1990s it was apparent that most desktop computers exceeded the base capabilities of most available hardware samplers, and it didn't take long for manufacturers to realize the potential of the computer as sampler.

In the early 21st century the major name in software samplers has been Tascam. Long established as a manufacturer of quality recording hardware the company redefined the modern software sampler with their Gigasampler and Gigastudio product lines. Those programs embraced and extended the possibilities of the hardware samplers, but they also faced new challenges inherent to the new platform. Cheap and abundant system RAM mitigated old problems that were due to insufficient memory capabilities, but the size of high-qualiyt sample libraries quickly exceeded the limits of physical memory. The solution was to have the software read the sample data from the hard disk in a continuous stream, using a process called pre-caching to buffer the data flow to the sampler. The program must also manage multiple streams of data, and should allow some measure of realtime control over the audio output.

Gigasampler and Gigastudio have been very successful with MIDI musicians, and other music software houses followed Tascam's lead, often adding new and unique features to the sampler's basic design. Eventually the FOSS sound and music software world evolved its own competitor, which brings us at last to the LinuxSampler project.

Meet The Family

Figure 1: The LinuxSampler server in its glory


The design philosphy for the LinuxSampler project includes a clear definition of its components and the provision for clean interfaces between them. The libgig library provides the core functions for loading, editing, and saving files in the GIG format. The linuxsampler engine (Figure 1) serves those functions to valid clients but is itself completely uncoupled from any front-end. Libgig is also required by the Gigedit software, whether running in standalone or plugin mode.

The liblscp library provides the control protocol for accessing the services of the linuxsampler engine. The GUI front-ends use this library to store and load a LinuxSampler session with all control states preserved intact. A session state includes MIDI and audio device settings, all loaded instruments and their parameter values, and the contents of the orchestra/instrument database.

Figure 2: QSampler at work


Two projects currently supply GUI front-ends for the linuxsampler server. Rui Nuno Capela's QSampler (Figure 2) follows the graphic designs of his other excellent software (QJackCtl, QSynth, QTractor) with its unadorned Qt4 GUI. QSampler is fast and light, but it currently lacks support for LinuxSampler's instrument database. The Java-based JSampler software is up-to-date with all linuxsampler services, but its resource hit is a little heavier. Figures 3 and 4 show JSampler in its two flavors, Classic and Fantasia.

Figure 3: JSampler Classic


Figure 4: JSampler Fantasia


Installation

LinuxSampler is included with most of the Linux distributions optimized for realtime audio performance. If you're already running a distro such as PlanetCCRMA or JAD you should check for a package in your distribution repos. If you're not running an RT-capable system, you should be, especially if you want a superior experience with LinuxSampler (and most other Linux audio applications). See linux-sound.org/distros for a partial list of such systems.

Building the software poses no unusual problems, as long as you have the required dependencies and development tools. I built current versions of everything in the project for my 32-bit and 64-bit systems, except for QSampler, which needed a newer version of Qt than I have on either system. Otherwise, I encountered no problems building or installing the LinuxSampler components.

Using LinuxSampler

Let's look at a typical session with LinuxSampler here at Studio Dave. These four steps get things rolling :

  • Launch JACK with QJackCtl
  • Start the LinuxSampler server
  • Launch and configure the JSampler Fantasia GUI
  • Start my sequencer

These steps can be automated with a simple bash script, and each step may take further options to fine tune conditions and connections. For example, QJackCtl's PatchBay saves connections templates for all audio and MIDI connections, and the program can be launched with a specific patchbay template, a very helpful amenity.

The Fantasia GUI supplies a simple and easy-to-navigate environment for operating linuxsampler. The interface includes a top menu-bar/tool-strip and a main window divided into an orchestra/instruments database, a virtual rack for your GIG samples, and a control panel for setting your system's audio and MIDI devices.

I've created Orchestra templates for my most typical ensembles. However, sometimes I start from scratch, so I also maintain Orchestras of instrument families (i.e. Basses, Plucked, Keyboards, et cetera). Each instrument in the sampler rack can be set to its own audio/MIDI port and channel, and samples from different orchestras may be mixed freely in the virtual rack.

Figure 5: LinuxSampler works out at Studio Dave


Figure 5 displays my usual setup when writing with LinuxSampler. The sampler is driven by my antique MIDI sequencer and is configured for ALSA MIDI connectivity and JACK audio output. QJackCtl handles all audio/MIDI routing and connections. I could easily add an effects processor such as JACK-Rack into the chain, but I've been keeping things simple lately. The sequencer's MIDI is routed to the sampler, the sampler's audio heads for my speakers.

Figure 6: Gigedit


The user interface could hardly be called complete without an editor for GIG files. Fortunately the project includes Gigedit, a GUI (standalone or plugin) for editing GIG files. In the Fantasia GUI you can summon Gigedit by resting the mouse cursor for a moment at the right of the sample name and clicking on the orange Edit button that will appear (Figure 7). The editor plugin will open, and you may then edit the GIG in realtime.

While working with Gigedit as a plugin I discovered that using Save As to save my work would instead corrupt it. Sure enough, this problem is well-known, and a search of the LinuxSampler bulletin board quickly revealed the solution (just use Save, not Save As).

Figure 7: The Edit button calls the Gigedit plugin


I've recorded two simple examples for this article, Enrique Granados's The Maiden And The Nightingale and Stefan Wolpe's Form For Piano. Both were sequenced by yours truly in 1989, and they've been played by many different synthesized and sampled pianos since that time. These realizations were performed by LinuxSampler showing off the sound of Mats Helgesson's Maestro Concert Grand, an excellent freely available sampled grand piano in GIG format, and I must say that the sequences have never sounded so good.

Licensing

There has been some controversy over the LinuxSampler licensing policy. This information from the project Web site should clarify the license assignments for the LinuxSampler software family :

  • libgig - (pure) GPL
  • liblscp - (pure) LGPL
  • jlscp - (pure) GPL v2
  • Gigedit - (pure) GPL
  • LinuxSampler - GPL with commercial exception
  • JSampler - (pure) GPL v2
  • QSampler - (pure) GPL

And this text is from the commercial exception :

"LinuxSampler is licensed under the GNU GPL with the exception that USAGE of the source code, libraries and applications FOR COMMERCIAL HARDWARE OR SOFTWARE PRODUCTS IS NOT ALLOWED without prior written permission by the LinuxSampler authors."

There you have it. The developers suggest that if you have further questions regarding the LinuxSampler license policies you should read the FAQ or contact the developers directly.

Documentation And Community

Documentation is currently rather thin, but the software is not particularly complicated to use. The Gigedit editor is perhaps the most complicated part of the package, but Alexander Methke's Gigedit Quickstart will bring you up to speed quickly and efficiently. Grigor Iliev's JSampler Manual is likewise invaluable to users of either the Classic or the Fantasia GUI.

The LinuxSampler community is growing steadily, and the recent release of LinuxSampler for Windows is sure to increase the size of its user base. The LinuxSampler Postboard is currently the best comm line for users, while the developers might be caught on the #linuxsampler IRC channel on Freenode.

LinuxSampler's Future

The LinuxSampler Development Roadmap indicates the project's present development status and what work needs to be done before the next public release. Remaining issues include expanded support for GIG3, DLS, and Akai file formats, improvements to the pitch-shifter, a VSTi front-end, and support for multi-processor systems. However, the list of fully-realized features in the current release is truly impressive.

I'll admit it, I've been seduced by LinuxSampler. It's become a fixture in my work these days, and I look forward to exploring it in greater depth. I still need to learn about the MIDI Instrument maps and the internal FX Sends, I'd like to check out some commercial GIG libraries, and I want to start making my own GIGs with Gigedit. And did I mention that I'd also like a 32-hour day ?

Outro

Next up: Who knows ? You'll just have to stop back in two weeks. Meanwhile, check out the LinuxSampler project, then hop over to linuxaudio.org to catch up on the audio and video recordings from the Linux Audio Conference 2008. That should keep you busy until we meet again.

__________________________


Special Magazine Offer -- Free Gift with Subscription
Receive a free digital copy of Linux Journal's System Administration Special Edition as well as instant online access to current and past issues. CLICK HERE for offer

Linux Journal: delivering readers the advice and inspiration they need to get the most out of their Linux systems since 1994.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Bilal Kuytul's picture

Thanks

On August 19th, 2009 Bilal Kuytul (not verified) says:

Thank you :)

Dave Turner's picture

I have been using the adobe

On February 23rd, 2009 Dave Turner (not verified) says:

I have been using the adobe audition sampler for years and I keep hearing good things about Linux but I had no idea that there was a sampler like this for linux. Looks waaaay more advanced with many other options then adobe and I need to get my hands on this, as I make hip hop beats and rnb also. Does anyone have any idea how much this will run me?

Dave Phillips's picture

extra extra

On March 6th, 2008 Dave Phillips says:

The MIDI Instrument feature turned out to be very easy to use. In the Fantasia interface a setup wizard will walk you through the process. Alternately, you can define a map in the MIDI Instruments tab and add instruments to it via the menu that pops up when you select an instrument from an orchestra list (Add To MIDI Map). The map simply assigns your selected instruments to MIDI Program Change numbers. Assign the appropriate MIDI Instrument Map in the instrument's rack-mount display (see Figure 7 in the article), and then you can select the sound with your MIDI keyboard or external sequencer.

The FX Send is a little trickier. First, create extra channels in your Audio panel, then assign those channels to the FX Send. Route those channel outputs to the input ports to JACK-Rack, jconv, or any other external processor, then route the effected (affected?) audio to whatever PCM output channels you desire. The send level is controlled by its dedicated fader, and a MIDI controller can be assigned to operate that fader (but the MIDI control doesn't seem to work right now).

Support for internal effects (LADSPA, VST, LV2) is high on the developers' TODO list.

Best,

dp

Dave Phillips's picture

MIDI CCs and the FX Send

On March 13th, 2008 Dave Phillips says:

MIDI control does work with the FX Send fader. Just make sure you don't use controllers #0 or #7, they're already reserved internally by LS.

Works perfectly now, very cool. :)

Wow, I'm running out of excuses. Your article and other LJ Audio/Video articles are convincing me I need to carve out some time to explore LinuxSampler and other Linux audio apps. I have tried Audacity and really like what it can do. Almost 3 decades ago(yikes) my plan was to become a recording engineer. During that brief pursuit I got to see a demo of the Fairlight Computer Musical Instrument. That demo did more to open my eyes to what could be done with computers than anything since. Life happened and I didn't pursue that career but I have often wanted to dabble in audio recording and sampling as a hobby. My typical excuse over the years was that it was too pricey. As I became a Linux snob, my excuse became that Linux recording and sampling was too unstable. Thanks for opening my eyes again to what can now be done in my own home if I just clear out some space and time to do it.

For anyone interested, a couple of years ago I posted scans of brochures of the Fairlight CMI I got to see way back when. Click here for a look.

__________________________

Mike Roberts is a bewildered Linux Journal Reader Advisory Panelist.

Dave Phillips's picture

re: Fairlight CMI

On March 7th, 2008 Dave Phillips says:

Hey, Mike, thanks for posting the Fairlight info pages, they're great fun to read. I especially liked the statement re: protecting "the investment of the purchaser against the problems of obsolescence common to most electronic musical instruments and microprocessor systems". The irony is delicious. :)

Anders Dahnielson's picture

Documentation

On March 5th, 2008 Anders Dahnielson (not verified) says:

Hopefully new and up-to-date documentation will materialize for gigedit in the near future. I.e. I'm working on it. ;-)

Anonymous's picture

Linuxsampler

On March 5th, 2008 Anonymous (not verified) says:

I've been using this gem for a couple of years.

I modified settings and recompiled it and my PC can effortlessly run up to 350 voices at at time (the limit at which I compiled it). This is sometimes needed when many notes are played with pedal down and new notes would ordinarily cause the decaying notes to truncate.

Due to this tool, Ardour, Rosegarden, Audacity, and Jack, I have long ditched my (cough cough) 'professional' CUBASE and Gigastudio Windows based PC.

Anonymous's picture

Another good MM distro

On March 5th, 2008 Anonymous (not verified) says:

Not listed at http://linux-sound.org/distro.html is StartCom MultiMedia Edition, another good MM distro with LinuxSampler and QSampler.

Anonymous's picture

author's reply

On March 5th, 2008 Anonymous (not verified) says:

Thank you, it has been added. :)

Post new comment

Please note that comments may not appear immediately, so there is no need to repost your comment.
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <pre> <ul> <ol> <li> <dl> <dt> <dd> <i> <b>
  • Lines and paragraphs break automatically.

More information about formatting options

Newsletter

Each week Linux Journal editors will tell you what's hot in the world of Linux. You will receive late breaking news, technical tips and tricks, and links to in-depth stories featured on www.linuxjournal.com.
Sign up for our Email Newsletter

Tech Tip Videos

From the Magazine

December 2009, #188

If last month's Infrastrucuture issue was too "big" for you then try on this month's Embedded issue. Find out how to use Player for programming mobile robots, build a humidity controller for your root cellar, find out how to reduce the boot time of your embedded system, and if you're new to embedded systems find out the basics that go into one. You can also read about the Beagle Board, the Mesh Potato and a spate of other interestingly named items. And along with our regular columns don't miss our new monthly column: Economy Size Geek.







Read this issue