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.

## Syntax

    asig 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

asig -- output sig

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 221.

    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 222.

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 flooper2.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>
    sr      =  44100
    ksmps   =  10
    nchnls  =  1

           instr 1
    ; looping back and forth,  0.05 crossfade
    aout	flooper2	16000, 1, 0, 1.6, 0.05, 1, 0, 2
    	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 6.5
    e

    </CsScore>
    </CsoundSynthesizer>

## Credits

Author: Victor Lazzarini
July 2006

New plugin in version 5

July 2006.

Prev | Up | Next
flooper | Home | floor