CY3

cymbalesque percussion
Author: Remco van der Most
License: BSD
Github: sss/edrum/CY3.axo

Inlets

frac32.bipolar pitch

frac32buffer frequency

frac32buffer phase

bool32 gate

Outlets

frac32buffer.bipolar sine wave

Parameters

frac32.s.map pitch2

frac32.u.map Penv

frac32.u.map Pdec

frac32.u.map Vdec

frac32.s.map.pitch pitch1

Declaration
uint32_t Phase1;
uint32_t Phase2;
int32_t ad1;
int32_t ad2;
int32_t ad3;
int32_t freq;
int32_t decay1;
int32_t decay2;
int32_t decay3;
int ttrig;
int32_t r1;
int32_t r2;
Init
Phase1 = 0;
Phase2 = 0;
Control Rate
decay1 = (1 << 27) - param_Pdec;
decay1 = ___SMMUL(decay1 << 3, decay1 << 2);
decay1 = ___SMMUL(decay1 << 3, decay1 << 2);
decay1 = (1 << 27) - decay1;
decay2 = (1 << 27) - param_Vdec;
decay2 = ___SMMUL(decay2 << 3, decay2 << 2);
decay2 = ___SMMUL(decay2 << 3, decay2 << 2);
decay2 = (1 << 27) - decay2;
Audio Rate
if ((inlet_gate > 0) && (!(ttrig))) {
  Phase1 = 0;
  // Phase2=0;
  ad1 = (1 << 27);
  ad2 = (1 << 27);
  ad3 = (1 << 27);
}
ad1 = ___SMMUL(ad1 << 3, decay1 << 2);
ad2 = ___SMMUL(ad2 << 3, decay2 << 2);
ad3 = ___SMMUL(ad3 << 3, decay3 << 2);
MTOFEXTENDED(param_pitch1 + inlet_pitch + ___SMMUL(ad1 << 3, param_Penv << 2),
             freq);
Phase1 += freq + inlet_freq + (outlet_wave >> 3);
Phase2 += freq + inlet_freq +
          ___SMMUL(param_pitch2 << 3, (freq + inlet_freq) << 5) +
          (outlet_wave >> 1);

int32_t p1 = Phase1 + (inlet_phase << 4);
int32_t p2 = Phase2 + (inlet_phase << 4);
SINE2TINTERP(p1, r1)
SINE2TINTERP(p2, r2)
outlet_wave = ___SMMUL(ad2 << 3, ((r1 >> 3) + (r2 >> 3)));

Privacy

© 2024 Zrna Research