1. Tobias Dammers
  2. sampson


SAMPSON, a sonic sampler for the Jack Audio system.


Sampson is a software sampler for Linux (and probably other platforms). It uses
the Jack Audio System to interface with other audio applications. The main
design goal is to provide a no-frills, low-footprint sampler that is robust,
easy to use, and efficient, true to the Unix spirit of "Do One Thing Right".

Development focuses on drums and percussion, but sampson can be used for any
kind of instrument samples. Patches ("kits") are defined in a simple textual
file format that is both easy to process and human-readable.


* Jack-based low-latency MIDI/audio processing
* floating-point processing
* loads a wide range of audio file formats (anything supported by libsndfile)
* ADSR envelopes
* fixed-pitch and variable-pitch layers
* velocity layering
* per-layer gain & pan
* group-based muting (e.g., the open hi-hat sample gets muted when the closed
  hi-hat sample triggers)

Features not yet available:

* Loops
* Filters
* Multi-channel output
* Vibrato and other LFO effects
* Lash support
* LV2 or VST versions


Sampson is Copyright (c) 2012-2013 by Tobias Dammers and released under a
BSD-style license. In short, this means you can do almost anything you like
with it, as long as you keep the original copyright notice and attribution. See
the enclosed LICENSE file for the legally binding license text.

Check out the code (if you haven't already):

$ git clone ssh://git@bitbucket.org/tdammers/sampson.git sampson && cd sampson

Install the required libraries:

* jack2
* libsndfile

Both these should be available from your favorite distro's repositories.

Now it's just a matter of building and installing:

$ make
$ sudo make install

The default install path is `/usr/local`; if you want to install elsewhere,
edit the Makefile to change `INSTALL_PREFIX` before issuing the make install

Sampson does not come with a GUI; it is just a command-line program that acts
as a software sampler. Sampler patches and configuration are defined in .kit
files (see below). Sampson automatically registers itself as a Jack client on
the server named 'default'. So:

1. Start a jackd server named 'default'.
2. Start sampson, passing a suitable kit as the first argument.
3. Connect sampson's MIDI input and audio outputs as desired.
4. ???
5. Profit.


Patches are defined in .kit files. The basic syntax works as follows:

* The semicolon (;) starts a line comment, which runs to the end of the current
* Each line consists of a setting name and a value, separated by whitespace.
* A line with two dashes indicates the end of a cell and the beginning of the
  next cell.

For each cell, the following variables can be set:

* `file` - An audio file. Relative paths are interpreted as relative to the
  .kit file.
* `refkey` - The sample's reference key (pitched layers only). At this key, the
  sample should play at its original speed. Keys can be specified as symbolic
  note names (scale step, optional accidental, 0-based octave, e.g. `eb2` or
  `f#3`), or as MIDI key numbers (0..127).
* `keyrange` - Limit the layer to a range of keys. The specified range is
  inclusive on both ends; this means that specifying the same key for lower and
  upper bounds yields a single-note range.
* `velorange` - Limit the layer to a range of velocities. Velocities are
  specified in MIDI units (0..127).
* `velorangex` - Limit the layer to a range of velocities, and apply fading at
  both ends. The parameters are `xfade_low`, `low`, `high`, `xfade_high`; the
  cross-fading parameters indicate the width of the cross-fading zones.
* `nonoteoff` - A boolean flag that causes the cell to ignore note-off events.
  This is useful for drum samples, which are typically triggered once and then
  play until the end of the sample. Note that group-based muting still applies
  to such notes.
* `fixedpitch` - A boolean flag indicating that the pitch of this sample should
  not be changed at all, that is, the `refkey` parameter has no effect, and all
  keys in the cell's range play the sample at its original speed.
* `group` - Specify an integer group number. Within each group, only one note
  may play at a time; when a second note is triggered, all previous notes are
  stopped. (NOTE: this does not currently work well with overlapping velocity
* `pan` - Panning position, specified as a floating point number in the -1..1
  range (where -1 is hard left, 0 is dead center, and 1 is hard right).
  Additionally, the symbolic constants 'l', 'r', and 'c' (and their uppercase
  variants) can be used.
* `amp` - Per-cell gain, specified as an absolute factor in the 0..1 range, or
  in decibels (append "dB").
* `att`, `dec, `sus`, `rel` - ADSR envelope parameters. `sus` is the sustain
  level, the other parameters indicate time in seconds. The release time is
  calculated based on the sustain level; pre-sustain release can lead to longer
  release times, because the envelope level has to decrease from a higher level
  than the sustain level.

There is an XSLT stylesheet in xslt/hydrogen.xsl that can be used to convert
Hydrogen drumkits to sampson kits. Since hydrogen has no explicit cell/key
mapping, the stylesheet assumes that the first cell (id 0) is at c2 (where the
bass drum maps in the GM drum map), and positions subsequent cells
sequentially. Most likely, you will have to hand-edit the resulting kit to map
drums correctly. In order to use the XSLT stylesheet, you need an xslt
processor such as `xsltproc`; armed with this, you can convert a hydrogen patch
like this:

$ xsltproc /path/to/sampson/xslt/hydrogen.xsl drumkit.xml > drumkit.kit

And then run it with sampson:

$ sampson drumkit.kit