flooper — Function-table-based crossfading looper.
This opcode reads audio from a function table and plays it back in a loop with user-defined start time, duration and crossfade time. It also allows the pitch of the loop to be controlled, including reversed playback. It accepts non-power-of-two tables, such as deferred-allocation GEN01 tables.
istart -- loop start pos in seconds
idur -- loop duration in seconds
ifad -- crossfade duration in seconds
ifn -- function table number, generally created using GEN01
asig -- output sig
kon -- amplitude control
kpitch -- pitch control (transposition ratio); negative values play the loop back in reverse
Example 219.
aout flooper 16000, 1, 1, 4, 0.05, 1 ; loop starts at 1 sec, for 4 secs, 0.05 crossfade out aout
The example above shows the basic operation of flooper. Pitch can be controlled at the k-rate, as well as amplitude. The example assumes table 1 to contain at least 5.05 seconds of audio (4 secs loop duration, starting 1 sec into the table, using 0.05 secs after the loop end for the crossfade).
Here is another example of the flooper opcode. It uses the file flooper.csd and fox.wav.
Example 220.
See the sections Real-time Audio and Command Line Flags for more information on using command line flags.
<CsoundSynthesizer> <CsOptions> ; Select audio/midi flags here according to platform ; Audio out Audio in No messages -odac -iadc -d ;;;RT audio I/O ; For Non-realtime ouput leave only the line below: ; -o flooper.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> sr = 44100 ksmps = 10 nchnls = 1 instr 1 kpitch line 1, p3, 4 aout flooper 26000, kpitch, 1, .53, 0.05, 1 ; loop starts at 1 sec, for .53 secs, 0.05 crossfade out aout endin </CsInstruments> <CsScore> ; Table #1: an audio file. ; Its table size is deferred, ; and format taken from the soundfile header. f 1 0 0 1 "beats.wav" 0 0 0 i 1 0 4 e </CsScore> </CsoundSynthesizer>