amPulse

Saw/Sine & Sine AM oscillator. frequency response of the sine can be made non-linear by adding gain, this simulates as if the signal is spinning into a black-hole, the closer the saw gets to zero. This response can be inverted with the "dir" button. "Damp" dampens the signal (1st order LP filter) "mix1" mixes from an 1st order exponential response to a next order exponential response->see "mix2" "mix2" sets the "next" response, between 2nd order and 3rd order exponential. "mix3" mixes between saw and sine response for the AM part, softening overtones with the sine-variant.
Author: Remco van der Most
License: BSD
Github: sss/osc/amPulse.axo

Inlets

frac32 pitch

frac32 gain

frac32 damp

frac32 mix1

frac32 mix2

frac32 mix3

frac32buffer phase increment

Outlets

frac32buffer.positive phasor wave

frac32buffer phase

Parameters

bool32.tgl dir

frac32.s.map.pitch pitch

frac32.s.map.pitch damp

frac32.s.map FM

frac32.u.map gain

frac32.u.map mix1

frac32.u.map mix2

frac32.u.map mix3

Declaration
uint32_t Phase;
int32_t val;
int i;
int j;
Init
Phase = 0;
Control Rate
uint32_t freq;
MTOFEXTENDED(param_pitch + inlet_pitch, freq);
freq = freq >> 1;
int32_t FM = ___SMMUL(freq, param_FM << 3) << 2;
int32_t f;
MTOF(param_damp + inlet_damp, f)
f = f >> 1;
int32_t gain = inlet_gain + param_gain;
int32_t mix1 = __USAT(inlet_mix1 + param_mix1, 27);
int32_t mix3 = __USAT(inlet_mix2 + param_mix2, 27);
int32_t mix2 = __USAT(inlet_mix3 + param_mix3, 27);
Audio Rate
int32_t phase;
uint32_t phose;
for (i = 0; i < 2; i++) {
  Phase += (freq >> 0) + (___SMMUL(inlet_freq << 4, FM) << 3);
  int32_t sine;
  uint32_t PHASE = Phase >> 5;
  if (param_dir > 0) {
    PHASE = (1 << 27) - PHASE;
  }
  PHASE = ___SMMUL(PHASE << 3, PHASE << 2);
  uint32_t PHase = ___SMMUL(PHASE << 3, PHASE << 2);
  // PHase=___SMMUL(PHase<<3,PHase<<2);
  PHase = ___SMMUL((1 << 27) - mix3 << 3, PHase << 2) +
          ___SMMUL(mix3 << 3, ___SMMUL(PHase << 3, PHase << 2) << 2);
  PHase = ___SMMUL((1 << 27) - mix1 << 3, PHASE << 2) +
          ___SMMUL(mix1 << 3, PHase << 2);
  SINE2TINTERP((Phase << 0) + (___SMMUL(gain << 3, PHase) << 10), sine)
  phose = (1 << 32) - Phase >> 5;
  SINE2TINTERP(Phase - (1 << 30), phase)
  phase = (phase >> 5) + (1 << 26);
  phase = ___SMMUL((1 << 27) - mix2 << 3, phose << 2) +
          ___SMMUL(mix2 << 3, phase << 2);
  val = ___SMMLA((___SMMUL(phase, sine) - val) << 1, f, val);
}
outlet_phasor = val;
outlet_phase = phase - (1 << 26);

Privacy

© 2024 Zrna Research