But a delay line gives you the circular buffer for free. It isn't the first thing you'd think of but it is so much easier.
Pitch shifting can be done by modulating the delay time. If you're playing a 100 ms grain, run a line~ with "100, 0 100" as the delread4~ delay time and you'll get 2x speed, 2x frequencies.
hjh
a bit late to the party, but wanted to emphasize on this.
You can imagine delwrite~ as a tape loop that is constantly being written to and delread4~ as a movable tape head. So, if you have a circular buffer of 1000ms with [delwrite~ foo 1000], you can position the tape head at any point of the loop, like [delread4~ foo 400] and you hear the sound with a delay of 400ms... or you can move the head across the entire length of the loop in 1000ms like this:
[0, 1000 1000(
|
line~
|
delread4~ foo
...and you hear a second of silence, because the head moves at exactly the same speed as the tape and therefore outputs just a single sample for one second.
As @ddw_music mentioned, if you want to pitch up one octave, you move the tape head against the direction of tape travel, so that the relative speed of the tape is twice as fast.
And if you want to reverse playback, you move the tape head twice as fast in the direction of tape travel, so that the tape in relation to the head moves in the opposite direction:
[0, 1000 500(
|
line~
|
delread4~ foo