SSampler:
Filter:
Classes (extension) | SuperSampler

SSampler
ExtensionExtension

A sampler synthesizer that knows what it's doing.
Location: NOT INSTALLED!

Description

Make sure you have installed SC3 plugins before using SuperSampler.

Sampler is a sampling synthesizer that applies SampleDescript for sound quality detection, and using detected information to determine playback bahavier. Most features of Sampler is done automatically for you.

For example, it detects the beginning of your sound samples, if there are more than one onset, it separates each onsets as different samples. There are lots of other figures you may want to experiment.

Class Methods

.new

Create a new SSampler.

Arguments:

samplerName

Name of Sampler.

dbname

Name of Sampler database. Each database may contain different Sampler libraries.

Returns:

this SSampler

.allSampler

Returns a dictionary of all samplers created.

.playArgs

Play a SamplerArguments instance. Use this method if you want to play an exactly the same sound you have created before.

Arguments:

args

A SamplerArguments to play;

.limiterOn

(Re)starts the master safety limiter (Limiter.ar(sig, 0.95, 0.01)), which is on by default. SuperSampler voices default-route to a dedicated internal stereo bus; the limiter reads that bus at the tail of the default group and mixes the limited signal into defaultOutputBus with a plain Out — other music on the destination bus is untouched. defaultOutputBus remains the user's routing decision: point it at your own FX-chain bus (SSampler.defaultOutputBus = ~fxBus) and the limiter output follows it live. Call limiterOn only to re-enable after limiterOff. The internal bus is allocated per server boot and the synth re-spawns after every ServerTree rebuild. Voices given an explicit out: argument bypass the limiter chain.

.limiterOff

Bypasses the master limiter: frees the limiter synth; voices then default straight to defaultOutputBus (which is left untouched).

.defaultOutputBus

The user's routing decision: the bus SuperSampler's final output goes to (default 0, the hardware output). Point it at your own FX-chain bus (SSampler.defaultOutputBus = ~fxBus) and the running limiter follows it live.

.headroomRef

The peak level (default 0.7) that normalized samples are aligned to. See -normalize.

Inherited class methods

Instance Methods

.init

Create a new SSampler and add it to SamplerDB.

Arguments:

samplerName

Name of SSampler.

dbname

Name of SamplerDB this SSampler belongs to. If the name of SamplerDB is not created, it will create a new SamplerDB class.

Returns:

(describe returnvalue here)

.key

Play samples by giving key numbers. If no key number provided, it chooses a random MIDI key number. Defaults are also provided by SamplerArguments class.

Arguments:

keynums

The MIDI key numbers to play, can be a single number, an array of numbers, or a function that generate the number. Negative key numbers reverses the buffer to play. It's default is a random number between 0-127.

syncmode

The strategy to syncronize different samples:

\keeplength: keep the length of all playing sound, align all at peak point of the sample with the longest attack time. This is the default strategy.

\percussive: make a percussive sound, starts all sounds from peak point. Reversed (negative) keys keep a minimum audible snippet of about 0.03 seconds.

[\peakat, time]: the peaks of all sounds are aligned to the given time, in wall-clock seconds after the call (also under expand).

\stretchshort: stretch each shorter samples to fit the longest sample duration. The stretch is two-segment (before and after the peak), so mixed positive/negative keys still land their peaks together.

\nosorting: just play every sample as it is, like conventional sampler synthesizer.

All peak-aligning strategies work with bendenv: the onset of every voice is compensated through the bend curve's cumulative integral, so peaks stay together while the pitch bends.

dur

Duration

amp

Overall amplitude, a multiplier.

ampenv

An Envelop for amplitude, in normalized XY format. Each node in the Envelope is describe as a pair of time and amplitude in the array.

pan

Overall panning. O is the center, -1 is left and 1 is right.

panenv

An Envelop for panning, in normalized XY format. Each node in the Envelope is describe as a pair of time and panning in the array.

bendenv

An Envelop for bending pitch in the sound in normalized XY format. Each node in the Envelope is describe as a pair of time and pitch bending in the array.

texture

The number of sample sounds to be played in the same time. If nil, it will play every triggered sounds.

expand

Stretch the played samples with insertion algorithm using granular synthesis. The value will be the expected time to be stretched.

Granulation runs only when this value is not nil.

grainRate

The grain rate for stratching granular synthesizer.

grainDur

The grain duration for stratching granular synthesizer.

out

Output Bus

midiChannel

A midiChannel for storing the playing UGens in SamplerQuery class, supporting live response.

play

If true, play this sound.

Returns:

a instance of SamplerArguments class

.db

Return an array of SSamplers in the same SamplerDB database

Arguments:

samplerName

The name of the SSampler to return.

Returns:

a SSampler with the name, or a list of SSamplers if not specified.

.filenames

Get filenames loaded to this SSampler.

Returns:

An array of filenames.

.setKeyRanges

Reset range response to each key related to the anchor key number.

In SSampler, every loaded sound files is anchored to a MIDI key number. When the method .key is used, a range of MIDI key numbers are determined for each sampler to respond to the key number played.

Arguments:

strategy

Determine the method to arrange the responded MIDI key numbers for each sample:

\keynumRadious: Give a range radious in infoArray from each anchor keynums as responsive range.

\fullrange: Every sample is responded in full range of midi key number.

\keynumOnly: Only respond to the anchored key numbers. Keys outside the mapping fall back to the nearest sample played untransposed (at its original pitch), so no out-of-tune transpositions can occur.

infoArray

Information array provided to respond to the strategy.

.keynums

Anchor key numbers for each sample.

Returns:

An array of key numbers setted as anchor for each sample in the list.

.setKeynums

Re-anchor the samples to new MIDI key numbers. The key ranges are rebuilt afterwards, reusing the current strategy (a \keynumOnly mapping stays \keynumOnly).

Arguments:

keynumArray

An array of key numbers (one sub-array per sample, one entry per section).

resetKeyRanges

[rebuild?, radius] — whether to rebuild the key ranges, and the radius used by the \keynumRadious strategy.

.free

Release everything load created: removes this sampler from its SamplerDBs (their kd-trees rebuild without it), frees every sample's server buffers, and clears the global name registry — SSampler(\name) afterwards starts from a clean slate.

.gui

Opens a gui window, for now you can listen to each sample in the sampler independently, set the anchor key number and response range of each sample.

.samples

All samples are stored here. Samples in SuperSampler is stored as classs of SampleDescript. You can extract sample informations stored in the class.

Returns:

An array of SampleDescript classes.

.dbs

The database storing this SSampler. The name \default is assigned if not specified.

Returns:

A SamplerDB class.

.load

Load sound files into a Sampler. All sound files will be analyzed and stored as SampleDescript class, and load into buffers.

Arguments:

soundfiles

A list of sound sources to load. Each entry can be:

  • a file path (String)
  • a Buffer — e.g. a live recording. It is rendered to a temp file (float WAV, auto-named after its server and bufnum) and then analyzed like any file. The stable auto-name means loading the same Buffer twice is skipped as a duplicate — if you re-recorded into the same Buffer, pass override: true to re-analyze. The temp file is deleted when the sampler (or sample) is freed.
  • a Buffer -> name association, to name the recording yourself: ~sampler.load([b -> \riff]) loads it as riff.wav in the temp directory.
NOTE: Analysis takes a few seconds per recording — the workflow is "record, then load, then play", not simultaneous record-and-play.
server

The server to load all samples into buffers.

filenameAsKeynum

Use key numbers provided in the file names as anchored key number for each file.

normalize

This is a argument for SCMIR, making SCMIR to normalize it's data for analyzation.

startThresh

Threshold for starting time detection, it's a multiplier to the peak amplitude of this sound sample.

endThresh

Threshold for ending time detection, it's a multiplier to the peak amplitude of this sound sample.

override

A boolean that determines whether to override samples that has loaded before with the same filename.

action

A function evaluated once, after every file's buffers are loaded and the sampler's bookkeeping (averages, kd-tree, key ranges) is rebuilt — the sampler is fully playable inside it. It receives the sampler:

NOTE: The incoming file list is pre-checked before any analysis: files repeated within the list, or already loaded with live server data, post a warning and are skipped (they still count as done for action). If a file was loaded before but its server data is gone — e.g. the server rebooted — load detects that and re-reads the file.

.keyRanges

Ranges of responding MIDI key numbers of each samples.

Returns:

An array of MIDI key numbers indicating the upper and lower key numbers with each key ranges. In a format like this:

|-------- Each Sample -------------| |-----Each Sample---

|----Section----| |----Section----| |----Section----|

[[[upper, lower], [upper, lower]..], [[upper, lower], [upper, lower]...], ....]

.playArgs

Play a SamplerArguments instance. Use this method if you want to play an exactly the same sound you have created before.

Arguments:

args

A SamplerArguments to play;

.playEnv

The SSampler will fit it's sound into the provided Envelope automatically.

Arguments:

env

The amplitude envelope to play. It can be an instance of Env class or an breakpoint envelope, such as [x1, y1, x2, y2, ..]

keynums

The MIDI key numbers assigned to play. It can also be an array of nubwers or a function generating the number. It's defaulted a random number between 0-127.

dur

Duration of the sound to play. The sound will start from 1/2 of this value before the peak of the sample, not the beginning of the sound file.

amp

Amplitude multiplier.

pan

Panning, from -1 (left) to 1 (right).

maxtexture

The maxinum number of sounds to be played simultaneously base on the amplitude value in the envelope. More sounds would be played at the peak of the envelope.

ampenv

An additional amplitude macro-contour, in normalized XY format (or an Env), spanning the full duration of env. Each gesture receives the slice of this contour around its own climax. Defaults to nil (each gesture's loudness is simply the value of env at its peak — gestures carry no automatic contour of their own).

panenv

A panning contour spanning the full duration of env, in normalized XY format (or an Env). Each gesture gets the slice of this envelope around its own climax. Defaults to nil (uses pan for every voice).

bendenv

A pitch-bending contour spanning the full duration of env, in normalized XY format (or an Env), sliced per gesture the same way as panenv. Defaults to nil (no bend).

out

Output Bus

midiChannel

A midiChannel for storing the playing UGens in SamplerQuery class, supporting live response.

NOTE: When the envelope finishes (env.duration seconds after playEnv is called), any voices from this call that are still sounding are released automatically, so long-ringing samples do not linger indefinitely past the end of the envelope.

.normalize

When true (the default), each sample's playback gain is stamped at query time so its peak aligns to headroomRef (default 0.7), making envelope and amp values consistent across differently-recorded samples. Set this to false on a SSampler instance (e.g. ~yourSampler.normalize = false) to get the pre-0.6 behavior of unscaled playback. Note that dense layering of normalized samples can sum above full scale — the master limiter (on by default, see *limiterOn) acts as the safety net.

Inherited instance methods

Examples