Record as long as space bar is held
This patch records while the spacebar is held down, and starts looping when the spacebar is released.
This patch records while the spacebar is held down, and starts looping when the spacebar is released.
This example shows how to change and reset the wavetable that a cycle~ object is linked to. Sending cycle~ a message set followed by the buffer name can change its wavetable reference and the set message will reset the wavetable.
To set a list of cue points in an audio file and have them played in order, use either sfplay~ (with a set of cues established by preload messages to sfplay~ or to sflist~) or buffer~ (with start messages to play~, the parameters of which are stored in a coll).
To record the output of a line~ as a series of numbers, a buffer~ can be used to capture the entirety of its output. To record the output, connect the line~ to a record~ with the same name as the buffer~. The buffer can then be played back by creating a play~ object with the same name as the buffer~ and sending it a start message.
The canonical way to get cyclic "oscillator" behavior is, for every sample number (n), take a step of a certain size (increment) at a certain rate of speed (sample rate) wrapping around to stay within a specific range (length) such that you complete a certain number of cycles (frequency). What you get is an index (x) that you can use to look up values in a table, or as input to an equation, to get a result (y). What should the step size (the increment) be? It’s determined by the formula “increment = n * frequency * length/sample rate”.
To coordinate the tempo of the transport object with the length of a recorded audio loop, get the duration of the loop in milliseconds, divide it by the number of beats, and divide the result in 60,000 (ms per minute) to calculate the tempo of the transport in beats per minute.
The groove~ object can be used to record a loop on the fly and use the loop length to set a master tempo which can send MIDI clock messages to other machines. The groove~ object sends out its right outlet a signal that goes from 0. to 1. as the current playback location of groove~ goes from its ‘loopstart’ point to its ‘loopend’ point. By default, groove~’s ‘loopstart’ point is 0 and its ‘loopend’ point is the end of the associated buffer~.
To load a sample into a buffer~ when the sample is shorter than the desired length of the buffer~, use the clear, size, and read messages. You empty and resize the buffer to the size you want, then read in the sound file. For example, you would use this procedure if you wanted to load a three-second sample into a five-second buffer~. The sample will be placed in the first three seconds of buffer space, followed by two seconds of silence.
This example shows how to retrieve the total duration in ms of a loaded file in a buffer~, using the info~ object. In fact, because the buffer~ object sends a bang out its right outlet whenever it loads in a sound file, you could use that bang to trigger info~, thus automatically obtaining the duration of any sound file you import.
This example shows how to create a buffer~ that always contains the last ten seconds of audio coming out of and adc~.