Effects are used to “animate” certain track attributes. Slide effects “slide” their corresponding track attribute to a new value within a given time (e.g. portamento which slides to a new note). Interval effects periodically lower and/or raise their attribute values by a given amount and interval (e.g. tremolo which reduces the volume periodically). Time periods are specified in number of ticks.

Enabling an effect will begin updating the corresponding track attribute over the given time. Setting new values for an effect before its current slide period has finished, will start the new slide period at the current interpolated values.

Disabling an effect before its current slide period has finished will set the slide’s end value immediately. Generally, all effects can be disabled by setting their time argument to 0.

Volume Slide

BK_EFFECT_VOLUME_SLIDE sets the number of ticks in which BK_VOLUME is sliding to its new value.

BKInt ticks = 120;

// Set volume slide
BKTrackSetAttr (& track, BK_EFFECT_VOLUME_SLIDE, ticks);
// Or
BKTrackSetEffect (& track, BK_EFFECT_VOLUME_SLIDE, & ticks, sizeof (ticks));

// BK_VOLUME now slides from its current value to the new value within 120 ticks
BKTrackSetAttr (& track, BK_VOLUME, 0.125 * BK_MAX_VOLUME);

The effect is disabled with 0.

Panning Slide

BK_EFFECT_PANNING_SLIDE sets the number of ticks in which BK_PANNING is sliding to its new value.

BKInt ticks = 120;

// Set panning
BKTrackSetAttr (& track, BK_PANNING, -0.5 * BK_MAX_VOLUME);

// Set panning slide
BKTrackSetAttr (& track, BK_EFFECT_PANNING_SLIDE, ticks);
// Or
BKTrackSetEffect (& track, BK_EFFECT_PANNING_SLIDE, & ticks, sizeof (ticks));

// BK_PANNING now slides from its current value to the new value within 120 ticks
BKTrackSetAttr (& track, BK_PANNING, 0.5 * BK_MAX_VOLUME);

The effect is disabled with 0.

Portamento (Note Slide)

BK_EFFECT_PORTAMENTO sets the number of ticks in which BK_NOTE is sliding to its new value. If no note is set at the moment, the new note is set immediately.

BKInt ticks = 120;

// Set portamento
BKTrackSetAttr (& track, BK_EFFECT_PORTAMENTO, ticks);
// Or
BKTrackSetEffect (& track, BK_EFFECT_PORTAMENTO, & ticks, sizeof (ticks));

// Set note
BKTrackSetAttr (& track, BK_NOTE, BK_G_2 * BK_FINT20_UNIT);

// BK_NOTE now slides from its current value to the new value within 120 ticks
BKTrackSetAttr (& track, BK_NOTE, BK_C_3 * BK_FINT20_UNIT);

The effect is disabled with 0.

Tremolo

BK_EFFECT_TREMOLO reduces the volume periodically by the given amount relatively to the current volume in the given number of ticks.

One tremolo cycle consist of 2 phases, where in the first phase the volume is reduced by the given amount and in the second phase raised up again to the current value.

BKInt tremolo [2] = {24, 0.5 * BK_VOLUME};

BKTrackSetEffect (& track, BK_EFFECT_TREMOLO, tremolo, sizeof (tremolo));

This reduces the volume to 50% of its current value within 24 ticks and raises it up again within another 24 ticks.

Current volume ------\          /---- repeated
                      \        /
             1 sliding \      / 2 sliding
               down     \    /     up
                         \  /
0.5 of current volume ----\/---------

The effect is disabled with a NULL pointer or by setting its first argument to 0.

Sliding to new values

Normally, the effect values are set immediately. However, a third argument sets the number of ticks in which BK_EFFECT_TREMOLO is sliding to its new values.

BKInt tremolo1 [2] = {24, 0.5 * BK_VOLUME};
BKInt tremolo2 [3] = {8, 1.0 * BK_VOLUME, 120};

BKTrackSetEffect (& track, BK_EFFECT_TREMOLO, tremolo1, sizeof (tremolo1));
BKTrackSetEffect (& track, BK_EFFECT_TREMOLO, tremolo2, sizeof (tremolo2));

First, the tremolo effect is set immediately without sliding (tremolo1). Then the effect is set to slide to the new values of tremolo2 within 120 ticks.

When setting a new slide before the current one has finished, the slide is started at the current interpolated values.

Vibrato

BK_EFFECT_VIBRATO raises and lowers the pitch periodically by the given number of halftones relatively to the current note in the given number of ticks.

One vibrato cycle consist of 4 phases. In the first phase the pitch is raised up by the given amount and lowered again to 0 in the second phase. The next two phases are the mirrowed version of the first two, in which the pitch is first lowered by the given amount and the raised up to 0 again.

BKInt vibrato [2] = {12, 0.6 * BK_FINT20_UNIT};

BKTrackSetEffect (& track, BK_EFFECT_VIBRATO, vibrato, sizeof (vibrato));

This first raises the pitch up by 3 halftones within 12 ticks and lowers it again within another 12 ticks; followed by the mirrowed version in which the pitch is lowered by 3 halftones within 12 ticks and raised up again within another 12 ticks.

                      /\
           1 sliding /  \ 2 sliding
              up    /    \   down
                   /      \
 Current note ----/        \        /---- repeated
                            \      /
                   3 sliding \    / 4 sliding
                     down     \  /     up
                               \/

The effect is disabled with a NULL pointer or by setting its first argument to 0.

Sliding to new values

Normally, the effect values are set immediately. However, a third argument sets the number of ticks in which BK_EFFECT_VIBRATO is sliding to its new values.

BKInt vibrato1 [2] = {36, 3 * BK_FINT20_UNIT};
BKInt vibrato2 [3] = {6, 0.6 * BK_FINT20_UNIT, 240};

BKTrackSetEffect (& track, BK_EFFECT_VIBRATO, vibrato1, sizeof (vibrato1));
BKTrackSetEffect (& track, BK_EFFECT_VIBRATO, vibrato2, sizeof (vibrato2));

First, the vibrato effect is set immediately without sliding (vibrato1). Then the effect is set to slide to the new values of vibrato2 within 240 ticks.

When setting a new slide before the current one has finished, the slide is started at the current interpolated values.