noisin

noisy sine wave oscillator
Author: SmashedTransistors
License: LGPL
Github: tiar/osc/noisin.axo

Inlets

frac32.bipolar pitch

frac32.positive noise

frac32.positive amp

Outlets

frac32buffer.bipolar sine wave

Parameters

frac32.s.map.pitch pitch

frac32.u.map noise

frac32.u.map amp

Declaration
uint32_t p, dpr, dp;
int32_t r;
int32_t amp;
Init
amp = 0;
p = 0;
r = 137 + GenerateRandomNumber();
MTOFEXTENDED(0, dp);
dpr = dp;
Control Rate
MTOFEXTENDED(inlet_pitch + param_pitch, dp);
int32_t namp = (inlet_amp + param_amp) << 1;
int32_t mod = (param_noise + inlet_noise) << 3;
Audio Rate
p += dpr;

// change amplitude when value is near zero
if ((p & 0x7FFFFFFFU) < dpr)
  amp = namp;

// change pitch when derivative is near zero(
if (((p + 0x40000000U) & 0x7FFFFFFFU) < dpr)
  dpr = ___SMMLA(dp, ___SMMUL(r = r * 69069 + 1, mod) << 2, dp);

outlet_wave = ___SMMUL(amp, sine2t[p >> 20]);

/*
Phase += freq + inlet_freq;
int32_t r;
int32_t p2 = Phase + (inlet_phase<<4);
SINE2TINTERP(p2,r)
outlet_wave= (r>>4);
*/

Privacy

© 2024 Zrna Research