buffer~

Play a sinusoidal melody

How would you go about playing a melody (or arpeggio) that has a sinusoidal shape? Using a steadily increasing number, you can step repeatedly through a sine function stored in a lookup table, and then scale and offset the result to be in the desired pitch range.

Live capture in buffer~

This shows how to record into a RAM (random-access memory) buffer, and how to play back the contents of the buffer at any rate (even backward by using a negative rate) starting at any point in the buffer. A timer is used to keep track of the duration of the recording. The example also demonstrates how one might use a quick fade-in and fade-out to avoid clicks when doing realtime capture during a performance.