Class GestureGranularRenderer
java.lang.Object
net.paulhertz.pixelaudio.granular.GestureGranularRenderer
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].
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classDefault mapping for PixelAudio: - sample index from PixelAudioMapper.lookupSample(x,y) - optional mapping offset (totalShift) and modulo mapSize - soft pan range mapped from x across screenWidth Designed to be stateful: totalShift and panRange can change over time (e.g., sliding window through a larger buffer).static interface -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static floatclampPan(float p) static intplayBursts(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.
-
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 bufferschedule- 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)
-