flooper2
Prev | Orchestra Opcodes and Operators | Next

## flooper2

flooper2 — Function-table-based crossfading looper.

## Description

This opcode implements a crossfading looper with variable loop parameters and three looping modes, optionally using a table for its crossfade shape. It accepts non-power-of-two tables for its source sounds, such as deferred-allocation GEN01 tables, with one or two channels.

## Syntax

    asig1[,asig2] flooper2 kamp, kpitch, kloopstart, kloopend, kcrossfade, ifn \
          [, istart, imode, ifenv, iskip]

## Initialization

ifn -- sound source function table number, generally created using GEN01

istart -- playback start pos in seconds

imode -- loop modes: 0 forward, 1 backward, 2 back-and-forth [def: 0]

ifenv -- if non-zero, crossfade envelope shape table number. The default, 0, sets the crossfade to linear.

iskip -- if 1, the opcode initialisation is skipped, for tied notes, performance continues from the position in the loop where the previous note stopped. The default, 0, does not skip initialisation

## Performance

asig1[, asig2] -- output sig (mono or stereo).

kamp -- amplitude control

kpitch -- pitch control (transposition ratio); negative values are not allowed.

kloopstart -- loop start point (secs). Note that although k-rate, loop parameters such as this are only updated once per loop cycle.

kloopend -- loop end point (secs), updated once per loop cycle.

kcrossfade -- crossfade length (secs), updated once per loop cycle and limited to loop length.

Mode 1 for imode will only loop backwards from the end point to the start point.

## Examples

Example 313.

    aout flooper2 16000, 1, 1, 5, 0.05, 1  ; loop starts at 1 sec, for 4 secs, 0.05 crossfade
         out      aout

The example above shows the basic operation of flooper2. Pitch can be controlled at the k-rate, as well as amplitude and loop parameters. 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). Looping is in mode 0 (normal forward loop).

Here is another example of the flooper2 opcode. It uses the file flooper2.csd and fox.wav.

Example 314.

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 flooper2.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

    sr = 44100
    ksmps = 32
    nchnls = 2
    0dbfs  = 1

    instr 1
    ; looping back and forth,  0.05 crossfade
    kst  line     .2, p3, 2 ;vary loopstartpoint
    aout flooper2 .8, 1, 0, kst, 0.05, 1, 0, 2
         outs     aout, aout

    endin
    </CsInstruments>
    <CsScore>
    ; Its table size is deferred,
    ; and format taken from the soundfile header
    f 1 0 0 1 "fox.wav" 0 0 0

    i 1 0 12
    e
    </CsScore>
    </CsoundSynthesizer>

## Credits

Author: Victor Lazzarini
July 2006

New plugin in version 5

July 2006.

Prev | Up | Next
flooper | Home | floor