3FMbandOsc

tripple sine wave oscillator with internal frequency modulation. NOTE!!!-> sideband1 and sideband2 are sideband "goal" frequencies created by the FM! So these are not the actual rates of the oscillators!
Author: Remco van der Most
License: BSD
Github: sss/osc/3FMbandOsc.axo

Inlets

frac32 FM1

frac32 FM2

bool32 active

frac32.bipolar pitch1

frac32.bipolar sideband1

frac32.bipolar sideband2

frac32buffer frequency

frac32buffer phase

Outlets

frac32buffer.bipolar sine wave

Parameters

frac32.s.map.pitch pitch1

frac32.s.map.pitch sideband1

frac32.s.map.pitch sideband2

frac32.s.map FM1

frac32.s.map FM2

Declaration
uint32_t Phase1;
uint32_t Phase2;
uint32_t Phase3;
int32_t freq1;
int32_t freq2;
int32_t freq3;
Init
Phase1 = 0;
Phase2 = 0;
Phase3 = 0;
Control Rate
if (inlet_active > 0) {
  MTOFEXTENDED(param_pitch1 + inlet_pitch1, freq1);

  MTOFEXTENDED(param_sideband1 + inlet_sideband1, freq2);

  MTOFEXTENDED(param_sideband2 + inlet_sideband2, freq3);
}
Audio Rate
if (inlet_active > 0) {
  int32_t FM1 = param_FM1 + inlet_FM1;
  int32_t FM2 = param_FM2 + inlet_FM2;

  int32_t freqa = (freq2 - freq1);
  Phase3 += freq3 - (freqa);
  int32_t r3;
  int32_t p3 = Phase3 + (inlet_phase << 4);
  SINE2TINTERP(p3, r3)
  int32_t FMW2 = ___SMMUL((r3 >> 3) + (inlet_freq << 2), FM2);

  Phase2 += freqa + (___SMMUL(freqa << 3, FMW2 << 2) << 5);
  int32_t r2;
  int32_t p2 = Phase2 + (inlet_phase << 4);
  SINE2TINTERP(p2, r2)
  int32_t FMW1 = ___SMMUL((r2 >> 3) + (inlet_freq << 2), FM1);

  Phase1 += freq1 + (___SMMUL(freq1 << 3, FMW1) << 5);
  int32_t r1;
  int32_t p1 = Phase1 + (inlet_phase << 4);
  SINE2TINTERP(p1, r1)
  outlet_wave = (r1 >> 4);
}

Privacy

© 2024 Zrna Research