home/ atoms/ grain-playback-parameters-start-duration

Grain start position and duration together determine which region of a sample buffer each grain plays back

In a sampling granular synthesizer, each grain reads a specific segment of a loaded audio buffer. Two parameters jointly define this segment: Start position (in samples or milliseconds from the buffer start) — sets where in the sample the grain begins. Duration — sets how many samples the grain plays. Playback rate (pitch) scales the relationship between time and sample position. Because the line object steps from a start sample to an end sample over the grain duration, the actual end sample is start + (duration × rate). When rate = 1, grain duration in time equals grain duration in samples. Boundaries must be enforced: a start position beyond the buffer length is impossible and must be clamped.

Examples

Grain start = 2000 ms, duration = 100 ms, rate = 1: the grain plays samples from 2000ms to 2100ms. Rate = 0.5: same grain sounds pitched down an octave and plays twice as slowly.

Assessment

A grain generator has buffer length 5000ms, grain start = 4900ms, grain duration = 200ms, rate = 1. Predict what happens at the end of the grain and what constraint should be enforced to prevent it.

“some various kind of parameters that we want to control in our grade generator we need to think about where we're gonna play from in our audio sample and we're going to play - and how long that's going to take”
corpus · granular-synthesis-building-a-granular-synth-with-max-oliver · chunk 3