Class GestureGranularParams.Builder

java.lang.Object
net.paulhertz.pixelaudio.granular.GestureGranularParams.Builder
Enclosing class:
GestureGranularParams

public static final class GestureGranularParams.Builder extends Object
Builder for immutable GestureGranularParams instances.

The builder performs lightweight clamping for values that must remain positive or non-negative. It does not validate musical intent; for example, a very long grain or extreme pitch ratio may be valid for a particular texture.

  • Field Details

    • grainLengthSamples

      private int grainLengthSamples
    • hopLengthSamples

      private int hopLengthSamples
    • burstGrains

      private int burstGrains
    • autoBurstGainComp

      private boolean autoBurstGainComp
    • gainLinear

      private float gainLinear
    • pan

      private float pan
    • pitchRatio

      private float pitchRatio
    • env

      private ADSRParams env
    • looping

      private boolean looping
    • hopMode

    • timeTransform

      private GestureGranularParams.TimeTransform timeTransform
    • targetCount

      private int targetCount
    • targetDurationMs

      private float targetDurationMs
    • warpShape

    • warpExponent

      private float warpExponent
    • grainWindow

      private ddf.minim.analysis.WindowFunction grainWindow
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • grainLengthSamples

      public GestureGranularParams.Builder grainLengthSamples(int v)
      Sets the grain length in samples.
      Parameters:
      v - grain length; values below 1 are clamped to 1
      Returns:
      this builder
    • hopLengthSamples

      public GestureGranularParams.Builder hopLengthSamples(int v)
      Sets the hop length in samples.
      Parameters:
      v - hop length; values below 1 are clamped to 1
      Returns:
      this builder
    • burstGrains

      public GestureGranularParams.Builder burstGrains(int v)
      Sets the number of grains generated for each scheduled event.
      Parameters:
      v - burst grain count; values below 1 are clamped to 1
      Returns:
      this builder
    • autoBurstGainComp

      public GestureGranularParams.Builder autoBurstGainComp(boolean v)
      Enables or disables automatic gain compensation for burst grains.
      Parameters:
      v - true to compensate gain when an event creates multiple grains
      Returns:
      this builder
    • gainLinear

      public GestureGranularParams.Builder gainLinear(float v)
      Sets the default linear gain.
      Parameters:
      v - linear gain; negative values are clamped to 0
      Returns:
      this builder
    • pan

      public GestureGranularParams.Builder pan(float v)
      Sets the default pan.
      Parameters:
      v - pan value; clamped to [-1, 1] when the object is built
      Returns:
      this builder
    • pitchRatio

      public GestureGranularParams.Builder pitchRatio(float v)
      Sets the default pitch ratio.
      Parameters:
      v - pitch ratio; clamped to a small positive minimum when the object is built
      Returns:
      this builder
    • env

      Sets the playback envelope.
      Parameters:
      v - envelope parameters, or null to use the instrument or sampler default
      Returns:
      this builder
    • looping

      public GestureGranularParams.Builder looping(boolean v)
      Sets whether the granular source path should loop.
      Parameters:
      v - true to enable looping where supported
      Returns:
      this builder
    • hopMode

      Sets the hop mode.
      Parameters:
      v - hop mode
      Returns:
      this builder
      Throws:
      NullPointerException - if v is null
    • timeTransform

      Sets the primary timing transform label.
      Parameters:
      v - timing transform
      Returns:
      this builder
      Throws:
      NullPointerException - if v is null
    • targetCount

      public GestureGranularParams.Builder targetCount(int v)
      Sets the target event count for resampling.
      Parameters:
      v - target event count; negative values are clamped to 0
      Returns:
      this builder
    • targetDurationMs

      public GestureGranularParams.Builder targetDurationMs(float v)
      Sets the target duration in milliseconds.
      Parameters:
      v - target duration; negative values are clamped to 0
      Returns:
      this builder
    • warpShape

      Sets the timing warp shape.
      Parameters:
      v - warp shape
      Returns:
      this builder
      Throws:
      NullPointerException - if v is null
    • warpExponent

      public GestureGranularParams.Builder warpExponent(float v)
      Sets the timing warp exponent.
      Parameters:
      v - warp exponent; clamped to a small positive minimum when the object is built
      Returns:
      this builder
    • grainWindow

      public GestureGranularParams.Builder grainWindow(ddf.minim.analysis.WindowFunction wf)
      Sets the grain amplitude window.
      Parameters:
      wf - window function, or null to use the director default
      Returns:
      this builder
    • build

      public GestureGranularParams build()
      Builds an immutable runtime parameter set.
      Returns:
      a new immutable parameter set