The LinuxSampler Project
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
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.
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.
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.
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 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.
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).
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.
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.
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 ?
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.
Similis sum folio de quo ludunt venti.
- New Products
- New Products
- Integrating Trac, Jenkins and Cobbler—Customizing Linux Operating Systems for Organizational Needs
- Dialog: An Introductory Tutorial
- Tech Tip: Really Simple HTTP Server with Python
- RSS Feeds
- Non-Linux FOSS: Remember Burning ISOs?
- EdgeRouter Lite
- Cooking with Linux - Serious Cool, Sysadmin Style!