Skip to content

multisampler

Multisampler — Multi-sampled instrument. Loads a note-mapped sample pack over HTTP and pitch-shifts the nearest sample. preset / art / gain / attack / release / baseUrl.

Quick Start

multisampler({ preset: 'piano' })

Parameters

Name Type Default Range/Options Description
preset enum piano piano violin contrabass violinSection violaSection celloSection Sample preset
art enum normal normal Articulation
gain number 0.5 0–1 0–1 Output gain
attack number 0.002 0–2 s Attack time
release number 0.12 0–5 s Release time
baseUrl string — — Sample pack base URL (defaults to setSampleBaseUrl() value)

Sample pack

Samples are not bundled with the library, and incanto does not decide where they come from. Point the machine at a pack with baseUrl, or call setSampleBaseUrl() once at startup. The URL it builds is:

<baseUrl>/<preset>/<articulation>/<layer>/<midi>.m4a

Notes are sampled on a 3-semitone grid; anything in between is pitch-shifted from the nearest sample. Files load in the background from the middle of the range outwards, and until a key is ready the machine falls back to the nearest loaded sample, so an instrument becomes playable before the whole pack has arrived. Notes played before anything is loaded are silent rather than an error.

The pack ships a single format, AAC in .m4a — the only codec every browser decodes through decodeAudioData. Safari plays Ogg Vorbis in <audio> but still refuses it in decodeAudioData.

Presets and licenses

PresetArticulationsSource
pianonormalVCSL — Grand Piano, Steinway B
violin, contrabassarco, pizzVSCO 2 Community Edition (solo)
violinSection, violaSection, celloSectionarco, pizzVSCO 2 Community Edition (sections)

Every source is CC0-1.0 — public domain, no attribution required.

Each preset also has a shorthand of the same name, so piano() is multisampler({ preset: 'piano' }).