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, with one or two channels.
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[,asig2] -- output sig (mono or stereo)
kamp -- amplitude control
kpitch -- pitch control (transposition ratio); negative values play the loop back in reverse
Example 320.
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. Play flooper.csd and fox.wav
Example 321.
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 -odac ;;;realtime audio out ;-iadc ;;;uncomment -iadc if realtime audio input is needed too ; For Non-realtime ouput leave only the line below: ; -o flooper.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> sr = 44100 ksmps = 32 nchnls = 2 0dbfs = 1 instr 1 kpitch line 1, p3, .9 ;lower pitch a bit during the note aout flooper .9, kpitch, 1, .53, 0.05, 1 ; loop starts at 1 sec, for .53 secs, 0.05 crossfade outs aout, aout endin </CsInstruments> <CsScore> ;table size is deferred, ; and format taken from the soundfile header f 1 0 0 1 "fox.wav" 0 0 0 i 1 0 8.2 e </CsScore> </CsoundSynthesizer>