xfade3

This is an equal powered crossfader. The crossfade scaling is based on an offset and limited cosine, using the last 1/4 of the cosine wave to create a smooth crossfade curve, instead of a completely linear crossfader. Stereo version of mix/xfade2.
Author: Jaffasplaffa
License: BSD
Github: jaffa/mix/xfade3.axo

Inlets

frac32buffer input

frac32buffer input

frac32buffer b1

frac32buffer b2

frac32.positive control

Outlets

frac32buffer output

frac32buffer b

Control Rate
// Cosine
int32_t r;
SINE2TINTERP((inlet_c << 3) + (1 << 30), r)
int32_t cosine = (-(r >> 4)) + (1 << 27); // - = inverted cosine

int32_t ccompl = ((128 << 20) - cosine);
// int32_t ccompl = ((128<<20)-cosine);
Audio Rate
{
  int64_t a = (int64_t)inlet_a2 * cosine;
  a += (int64_t)inlet_a1 * ccompl;
  outlet_a = a >> 27;
}

{
  int64_t b = (int64_t)inlet_b2 * cosine;
  b += (int64_t)inlet_b1 * ccompl;
  outlet_b = b >> 27;
}

Privacy

© 2024 Zrna Research