Class GestureGranularConfig

java.lang.Object
net.paulhertz.pixelaudio.granular.GestureGranularConfig

public final class GestureGranularConfig extends Object
End-user configuration for gesture-driven granular and sampler playback.

This class is the editable configuration model used by PixelAudio's gesture examples. A GestureGranularConfig.Builder is convenient for GUI controls, presets, and JSON serialization; calling GestureGranularConfig.Builder.build() creates an immutable snapshot that can be used to build a GestureSchedule and converted to runtime synthesis parameters with toParams().

The configuration covers four related areas:

  • which geometric points from a drawn gesture are selected for display to the screen
  • and how those points correspond to scheduled events, controlled by GestureGranularConfig.PathMode;
  • how those events are timed, resampled, duration-scaled, warped, or converted to fixed hops;
  • how each event is rendered, including grain length, envelope, gain, pitch, and burst settings.

See the GesturePlayground and Bagatelle examples for live interfaces that expose these settings and show their effect on playback.

See Also:
  • Field Details

    • pathMode

      public final GestureGranularConfig.PathMode pathMode
      Strategy for choosing the gesture points that become scheduled events.
    • rdpEpsilon

      public final float rdpEpsilon
    • curveSteps

      public final int curveSteps
      Number of divisions in each curve segment when polygonizing a curve path derived from a gesture.
    • curveBias

      public final float curveBias
      Curve-shaping value for Bezier control point scaling, not used for audio synthesis.
    • hopMode

      public final GestureGranularConfig.HopMode hopMode
      Timing mode for scheduled gesture events.
    • hopLengthSamples

      public final int hopLengthSamples
      Fixed hop length in samples; meaningful when hopMode is GestureGranularConfig.HopMode.FIXED.
    • timingMode

      public final GestureGranularConfig.TimeTransform timingMode
      User-facing timing mode for resampling, duration scaling, or warping.
    • resampleCount

      public final int resampleCount
      Target event count for GestureGranularConfig.TimeTransform.RESAMPLED_COUNT; values below 2 mean no resampling.
    • targetDurationMs

      public final int targetDurationMs
      Target gesture duration in milliseconds for duration scaling and warping; 0 means no override.
    • warpShape

      public final GestureGranularConfig.WarpShape warpShape
      Timing warp shape used when warping is enabled.
    • warpExponent

      public final float warpExponent
      Exponent used by exponential and square-root warp shapes.
    • grainLengthSamples

      public final int grainLengthSamples
      Length of each granular grain in samples.
    • env

      public final ADSRParams env
      Envelope applied to granular or sampler playback.
    • gainDb

      public final float gainDb
      Playback gain in decibels; converted to linear gain by gainLinear().
    • pitchSemitones

      public final float pitchSemitones
      Pitch offset in semitones; converted to a playback ratio by pitchRatio().
    • burstGrains

      public final int burstGrains
      Number of grains created for each scheduled gesture event.
    • autoBurstGainComp

      public final boolean autoBurstGainComp
      True to compensate gain automatically when one event produces multiple burst grains.
    • useArcLengthTime

      public final boolean useArcLengthTime
      True to derive curve timing from arc length rather than point index. TODO provide relevant case use in sample code, in a future release
  • Constructor Details

  • Method Details

    • defaultConfig

      public static GestureGranularConfig defaultConfig()
      Creates the default immutable gesture granular configuration.
      Returns:
      a configuration snapshot built from a new default builder
    • gainLinear

      public float gainLinear()
      Converts gainDb to a linear amplitude scalar.
      Returns:
      linear gain
    • pitchRatio

      public float pitchRatio()
      Converts pitchSemitones to a playback speed or pitch ratio.
      Returns:
      pitch ratio where 1.0 is untransposed playback
    • isRawGestureTiming

      public boolean isRawGestureTiming()
      Reports whether this configuration is set to raw gesture timing.
      Returns:
      true when timingMode is GestureGranularConfig.TimeTransform.RAW_GESTURE
    • toParams

      public GestureGranularParams toParams()
      Converts this user-facing configuration snapshot to runtime granular playback parameters.

      Path-building settings such as pathMode, rdpEpsilon, curveSteps, and useArcLengthTime are used by schedule-building code and are not represented in the returned GestureGranularParams.

      Returns:
      immutable runtime parameters for granular playback
    • toString

      public String toString()
      Returns a multi-line summary of the current configuration snapshot.
      Overrides:
      toString in class Object
      Returns:
      a human-readable description of this configuration