Sampler

interface Sampler extends Instrument { uuid: string label: string enabled: boolean minimized: boolean audioUnit: InstrumentAudioUnit icon: string key: 'Sampler' voices: number glide: number legato: boolean octave: number transpose: number tune: number volume: number panning: number mono: number filter: SamplerFilter ampEnvelope: SamplerEnvelope modEnvelope: SamplerEnvelope lfos: readonly SamplerLFO[] groups: readonly SamplerGroup[] zones: readonly SamplerZone[] modulations: readonly SamplerModulation[] remove(): void addGroup(props?: Partial<Pick<SamplerGroup, 'label' | 'roundRobin' | 'choke' | 'trigger'>>): SamplerGroup addZone(sample: Sample, props?: Partial<Omit<SamplerZone, 'uuid' | 'remove' | 'sample'>>): SamplerZone addModulation(source: 0 | 1 | 2 | 3 | 4 | 5 | 6, target: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9, amount: number): SamplerModulation }

Multi-sample instrument: many samples mapped by key and velocity

Hierarchy


Properties

uuid: string

readonly

Inherited from uuid

Unique id

label: string

Inherited from label

Custom label

enabled: boolean

Inherited from enabled

Enable or bypass the device

minimized: boolean

Inherited from minimized

Collapse the device editor in the studio

audioUnit: InstrumentAudioUnit

readonly

Inherited from audioUnit

The audio unit this instrument belongs to

icon: string

Inherited from icon

Icon name (see IconSymbol)

key: 'Sampler'

readonly

Overrides key

Always "Sampler"

voices: number

Notes that sound at once (1 to 64, default 16)

glide: number

Glide in seconds (0 to 5, default 0)

legato: boolean

One voice that keeps its envelopes over tied notes (default false)

octave: number

Octave shift (-3 to 3, default 0)

transpose: number

Transpose in semitones (-12 to 12, default 0)

tune: number

Fine tune in cents (-100 to 100, default 0)

volume: number

Volume in dB (default -3)

panning: number

Pan (-1.0 to 1.0, default 0.0)

mono: number

Mono amount (0.0 to 1.0, default 0.0)

filter: SamplerFilter

readonly

The filter

ampEnvelope: SamplerEnvelope

readonly

The amp envelope

modEnvelope: SamplerEnvelope

readonly

The mod envelope, a modulation source

lfos: readonly SamplerLFO[]

readonly

The two LFOs, modulation sources

groups: readonly SamplerGroup[]

readonly

All groups in order. A new Sampler has one

zones: readonly SamplerZone[]

readonly

All zones

modulations: readonly SamplerModulation[]

readonly

All modulations in order. A new Sampler has velocity to gain at full amount

Methods

remove(): void

Inherited from remove

Removes the whole audio unit. Use InstrumentAudioUnit.setInstrument to swap the instrument. An instrument inside an InstrumentCompositeLayer removes that layer instead

Returns

  • void

addGroup( props?: Partial<Pick<SamplerGroup, 'label' | 'roundRobin' | 'choke' | 'trigger'>>, ): SamplerGroup

Add a group

Parameters

Returns

addZone( sample: Sample, props?: Partial<Omit<SamplerZone, 'uuid' | 'remove' | 'sample'>>, ): SamplerZone

Add a zone playing the sample. Without a group it joins the first one

Parameters

  • sample (Sample)
  • props (Partial<Omit<SamplerZone, "uuid" | "remove" | "sample">>, optional)

Returns

Example

CODE
const sampler = project.addInstrumentUnit("Sampler").instrument
sampler.addZone(low, {keyLow: 0, keyHigh: 59, rootKey: 48})
sampler.addZone(high, {keyLow: 60, keyHigh: 127, rootKey: 72, loopMode: 1})

addModulation( source: 0 | 1 | 2 | 3 | 4 | 5 | 6, target: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9, amount: number, ): SamplerModulation

Add a modulation

Parameters

  • source (0 | 1 | 2 | 3 | 4 | 5 | 6)
  • target (0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9)
  • amount (number)

Returns

Example

CODE
sampler.addModulation(2, 0, 0.01) // LFO 1 to pitch