# Package net.paulhertz.pixelaudio.schedule

package 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.

Core Scheduling

The AudioScheduler is a generic event scheduler supporting both point events (one-shot at a sample time) and span events (active over an interval). It provides sample-accurate callback delivery with thread-safe enqueuing and block-based processing on the audio thread.

- `AudioScheduler` provides a sample-accurate scheduler for one-shot point events and duration-based span events, with support for late event policies, block-wise processing, and thread-safe scheduling.

Gesture and Time Management

- `GestureSchedule` is a data container for a PAGesture with immutable points, times in milliseconds, and optional start time, serving as the base structure for gesture-driven playback.
- `GestureScheduleBuilder` builds schedules for classes that implement PAGesture or use PAGesture implementers, supporting resampling, duration scaling, time warping, and hop mode conversion for flexible gesture playback control.
- `TimedLocation` is used to schedule or track events that take place at specific coordinate locations, with support for duration and staleness tracking.
- `GesturePerformer` (deprecated) is a placeholder interface for future gesture performance abstractions.

Audio Utilities

AudioUtility provides a comprehensive collection of audio processing functions including time/frequency conversions, gain/decibel conversions, signal level computation, normalization, resampling, and file I/O operations.

- `AudioUtility` provides utility conversions for audio including:
  - Time conversions: milliseconds ↔ samples, seconds ↔ samples
  - Gain conversions: dB ↔ linear amplitude
  - Pitch/frequency: semitones ↔ frequency ratio, MIDI key number ↔ frequency
  - Signal analysis: peak, RMS, and normalization (by peak, by RMS, or with ceiling)
  - Resampling: mono and multi-channel buffer resampling with linear interpolation
  - File I/O: save audio to 16-bit or 32-bit PCM WAV format (mono or stereo)

- 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.sampler
  Digital audio sampling synthesis classes for PixelAudio, built on the Minim library for Processing.
- Class
  Description
  AudioScheduler<H>
  AudioScheduler: A sample-accurate scheduler for things that should occur at specific times in an audio stream.
  AudioScheduler.LatePolicy
  Policy for point events whose sampleTime is already in the past when processed.
  AudioScheduler.PointEvent<H>
  A one-shot event that occurs at an absolute sample index.
  AudioScheduler.PointHandler<H>
  AudioScheduler.SpanEvent<H>
  A duration event active on [startSample, endSample) where endSample is exclusive.
  AudioScheduler.SpanHandler<H>
  AudioUtility
  Utility conversions for audio.
  AudioUtility.NormalizationMode
  GesturePerformer
  Deprecated.
  GestureSchedule
  Data container for a `PAGesture` with immutable points and times and an optional start time (in milliseconds).
  GestureScheduleBuilder
  Build schedules for classes that implement PAGesture or use PAGesture implementers, for example to to build, interpolate, and warp time and point lists.
  TimedLocation
  Used to schedule or track events that take place at specific coordinate locations.