Class GestureGranularRenderer

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

public final class GestureGranularRenderer extends Object
TODO candidate for removal GestureGranularRenderer Renders a GestureSchedule into audio by triggering a granular "burst" (IndexGranularSource micro-train) at each scheduled event time. Option B renderer: schedule event i -> one burst starting at mapped sampleIndex(p_i), scheduled at schedule.timesMs[i].
  • Constructor Details

    • GestureGranularRenderer

      private GestureGranularRenderer()
  • Method Details

    • playBursts

      public static int playBursts(float[] buf, GestureSchedule schedule, GestureGranularConfig cfg, PAGranularInstrument gSynth, float sampleRate, GestureGranularRenderer.GestureMapping mapping)
      Render a GestureSchedule as fixed-hop granular bursts at each schedule event. Implementation notes: - Each event i schedules one IndexGranularSource at delaySamples derived from timesMs. - The burst uses fixed hop in time (cfg.hopLengthSamples) and fixed hop in source index (indexHopSamples == hopSamples), giving a simple forward micro-scan. - Per-event pan comes from mapping.pan(p). - Stream-level pitch is NOT applied here (IndexGranularSource uses SOURCE_GRANULAR policy). If you later want transpose, you can implement it by decoupling timeHop vs indexHop.
      Parameters:
      buf - mono source buffer
      schedule - GestureSchedule (points + timesMs; lengths should match)
      cfg - GestureGranularConfig (grain length, hop length, gain, env...)
      gSynth - PAGranularInstrument (sample-accurate scheduling)
      sampleRate - output sample rate (audioOut.sampleRate())
      mapping - maps points to (sampleIndex, pan)
      burstGrains - grains per burst (>=1). 1 approximates old “one grain per event.”
      Returns:
      number of events scheduled
    • clampPan

      private static float clampPan(float p)