sflooper — Plays a SoundFont2 (SF2) sample preset, generating a stereo sound, with user-defined time-varying crossfade looping.


Plays a SoundFont2 (SF2) sample preset, generating a stereo sound, similarly to sfplay. Unlike that opcode, though, it ignores the looping points set in the SF2 file and substitutes them for a user-defined crossfade loop. It is a cross between sfplay and flooper2.


ar1, ar2 sflooper ivel, inotenum, kamp, kpitch, ipreindex, kloopstart, kloopend, kcrossfade, ifn \
      [, istart, imode, ifenv, iskip] 


ivel -- velocity value

inotenum -- MIDI note number value

ipreindex -- preset index

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


kamp -- amplitude scaling

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. If loop start is set beyond the end of the sample, no looping will result.

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

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

sflooper plays a preset, generating a stereo sound.

These opcodes only support the sample structure of SF2 files. The modulator structure of the SoundFont2 format is not supported in Csound. Any modulation or processing to the sample data is left to the Csound user, bypassing all restrictions forced by the SF2 standard.

See Also

sfilist, sfinstr, sfinstrm, sfload, sfpassign, sfplaym, sfplist, sfpreset


Author: Victor Lazzarini;
August 2007

New in Csound Version 5.07