# Package net.paulhertz.pixelaudio.sampler

package net.paulhertz.pixelaudio.sampler
Digital audio sampling synthesis classes for PixelAudio, built on the Minim library for Processing.

The package provides shared-buffer sample playback, polyphonic sampler instruments, ADSR envelope support, pitch and playback utilities, and event objects used by gesture-driven sampler workflows.

Sampler instruments and playback

- `PASamplerInstrument` manages sampler playback, global pitch, pan, gain, and default envelopes.
- `PASamplerInstrumentPool` manages a collection of sampler instruments for polyphony and reuse.
- `PASamplerInstrumentPoolMulti` manages multiple sampler pools, useful for multi-buffer or multi-sample playback.
- `PASharedBufferSampler` plays multiple sampler voices from a shared mono buffer, with voice pooling, looping, panning, gain control, and smooth voice stealing.
- `PASamplerVoice` handles one active sampler voice.

Interfaces and playback support

- `PAPlayable` is the root interface for playable or renderable audio objects.
- `PASampler` defines fundamental sampler methods, including play and buffer access.
- `PASamplerPlayable` extends PAPlayable for sample-based playback with gain, pitch, pan, and envelope parameters.
- `PlaybackInfo` stores information about sampler playback events.
- `PitchPolicy` defines pitch behavior for sample playback.
- `SamplerBrushEvent` stores gesture-derived sampler event data such as location, timing, sample position, gain, pitch, pan, and envelope.

Envelope utilities

- `ADSRParams` wraps parameters for ADSR envelopes.
- `ADSRUtils` provides utility methods for ADSRParams.
- `SimpleADSR` provides an executable ADSR envelope for sampler voices.

- Related Packages
  Package
  Description
  net.paulhertz.pixelaudio
  Core classes for PixelAudio, a Processing library that maps between sound and image data.
  net.paulhertz.pixelaudio.curves
  Gesture, path, and Bézier curve modeling classes for PixelAudio.
  net.paulhertz.pixelaudio.example
  Package `net.paulhertz.pixelaudio.example` provides example Processing sketches and demonstrations of PixelAudio library functionality.
  net.paulhertz.pixelaudio.granular
  Granular synthesis classes for PixelAudio.
  net.paulhertz.pixelaudio.io
  Package `net.paulhertz.pixelaudio.io` provides JSON-based persistence for PixelAudio data structures.
  net.paulhertz.pixelaudio.schedule
  Package `net.paulhertz.pixelaudio.schedule` provides sample-accurate event scheduling, gesture-based time management, and audio utility functions for the PixelAudio library.
- Class
  Description
  ADSRParams
  Value object for Minim ADSR parameters.
  ADSRUtils
  Utility functions for ADSRParams.
  PAPlayable
  Generic interface for anything that can be "played." Provides a minimal playback API plus backward-compatible overloads for sampler instruments and other PAPlayable classes.
  PASampler
  Backend engine contract for sampler implementations.
  PASamplerInstrument
  PASamplerInstrument Represents a playable instrument that uses a PASampler instantiated as a PASharedBufferSampler to trigger audio playback from a shared buffer that is (currently) a Minim MultiChannelBuffer.
  PASamplerInstrumentPool
  PASamplerInstrumentPool Manages a group of PASamplerInstruments sharing the same source buffer and audio output.
  PASamplerInstrumentPoolMulti
  PASamplerInstrumentPoolMulti Manages multiple PASamplerInstrumentPool instances, each keyed by name.
  PASamplerPlayable
  Specialized playable interface for sample-based instruments.
  PASamplerVoice
  PASamplerVoice — a single playback "voice" reading from a shared mono buffer.
  PASharedBufferSampler
  UGen-based sampler that plays multiple PASamplerVoice instances from a single shared mono buffer (channel 0 of a MultiChannelBuffer) which is an array of floating point samples over (-1.0..1.0).
  PASharedBufferSampler.MixProfile
  PitchPolicy
  PitchPolicy determines how PASamplerInstrument / PASamplerVoice should interpret their pitch parameter in combination with a given PASource.
  PlaybackInfo
  Holds information about a triggered playback event.
  SamplerBrushEvent
  Stores values used for SamplerBrush event staging, used in tutorial examples such as `TutorialOne_03_Drawing`.
  SimpleADSR
  SimpleADSR — software envelope generator with optional exponential curves.
  SimpleADSR.Stage