home/ atoms/ sample-rate-pitch-speed

Changing a sample's playback rate simultaneously shifts its pitch and duration

A sample is a list of numbers representing speaker positions over time. Playing at rate 2 feeds numbers twice as fast: half duration, one octave higher pitch. Rate 0.5 doubles duration and drops pitch an octave. Negative rates play backwards. This relationship is fundamental: doubling rate yields one octave up; halving rate yields one octave down. The rpitch: opt translates semitone intervals into the equivalent rate automatically.

Examples

sample :loop_amen, rate: 0.5 # half speed, octave down sample :loop_amen, rate: 2 # double speed, octave up sample :loop_amen, rate: -1 # backwards at original pitch

Assessment

Predict pitch and duration change for a 2-second sample at rate 3. Explain why rate: -0.5 plays backwards at half speed.

“Doubling the playback rate halves the playback time”
corpus · sonic-pi-built-in-tutorial · chunk 7