← Back to Docs
  • index.html
  • Clayground
  • Clayground.Sound
  • SampleInstrument
  • Clayground 2026.14
  • SampleInstrument QML Type

    PCM sample playback with loop points, root note, and ADSR. More...

    Import Statement: import Clayground.Sound

    Detailed Description

    Loads a WAV from source and lets you play it at any pitch, with optional loop region, shaped by an ADSR envelope on top of the sample.

    Properties

    Path to a WAV file. Reloaded on change.

    MIDI note number that plays the sample at its native rate. Default: 60 (C4).

    Looping configuration. loopStart / loopEnd are fractions in 0..1 of the sample length.

    ADSR (attack/release only for now) applied on top of sample playback.

    Post-mix volume, 0..1.

    Stereo position, -1 (left) .. +1 (right); 0, the default, is centred. The same law as SynthInstrument.pan.

    The mixer bus: "sfx" (the default), "music" or "voice".

    How a note pitched away from rootNote reads between two source samples: "nearest" (the closest sample: hard and aliased, 8-bit grit), "linear" (the default, as before the modes existed) or "gaussian" (four samples weighted by a Gaussian, like the SNES: soft, the highs rolled off - a tone at a quarter of the sample rate plays at 0.63 of its level). Applies to notes triggered after the change. Any other name is refused with a warning.

    At most this many voices ring at once; a note beyond it cuts the oldest. The default 0 is no cap. As for SynthInstrument.maxVoices.

    Methods

    See also SynthInstrument and SongPlayer.