sine harmonics

sine wave oscillator with 7 additional harmonics: sub octave, 2nd, 3rd, 4th, 5th, 6th and major 7th (2 octaves up). The intervals are pure intervals and not equally tempered.
Author: Peter Witzel
License: CC0
Github: cpwitz/osc/sine harmonics.axo

Inlets

frac32 mod level sub

frac32 mod level fundamental

frac32 mod level 2nd

frac32 mod level 3rd

frac32 mod level 4th

frac32 mod level 5th

frac32 mod level 6th

frac32 mod level 7th

frac32.bipolar pitch

Outlets

frac32buffer.bipolar harmonics

Parameters

frac32.u.map sub

frac32.u.map fundamental

frac32.u.map 2nd

frac32.u.map 3rd

frac32.u.map 4th

frac32.u.map 5th

frac32.u.map 6th

frac32.u.map 7th

Declaration
uint32_t phasesub, phasefund, phase1, phase2, phase3, phase4, phase5, phase6;
uint32_t incsub, incfund, inc1, inc2, inc3, inc4, inc5, inc6;
uint32_t levelsub, levelfund, level1, level2, level3, level4, level5, level6;
Init
phasesub = 0;
phasefund = 0;
phase1 = 0;
phase2 = 0;
phase3 = 0;
phase4 = 0;
phase5 = 0;
phase6 = 0;
Control Rate
uint32_t freq;
MTOF(inlet_pitch, freq);
incsub = freq >> 1;
incfund = freq;
inc1 = freq << 1;
inc2 = inc1 + freq;
inc3 = freq << 2;
inc4 = inc3 + freq;
inc5 = inc4 + freq;
inc6 = inc5 + freq + incsub;
levelsub = __SSAT((param_sub + inlet_sub) >> 4, 28);
levelfund = __SSAT((param_fundamental + inlet_fund) >> 4, 28);
level1 = __SSAT((param_2nd + inlet_2nd) >> 4, 28);
level2 = __SSAT((param_3rd + inlet_3rd) >> 4, 28);
level3 = __SSAT((param_4th + inlet_4th) >> 4, 28);
level4 = __SSAT((param_5th + inlet_5th) >> 4, 28);
level5 = __SSAT((param_6th + inlet_6th) >> 4, 28);
level6 = __SSAT((param_7th + inlet_7th) >> 4, 28);
Audio Rate
phasefund += incfund;
phasesub += incsub;
phase1 += inc1;
phase2 += inc2;
phase3 += inc3;
phase4 += inc4;
phase5 += inc5;
phase6 += inc6;
int32_t r;
SINE2TINTERP(phasefund, r);
int32_t accum = ___SMMUL(r, levelfund);
SINE2TINTERP(phasesub, r);
accum = ___SMMLA(r, levelsub, accum);
SINE2TINTERP(phase1, r);
accum = ___SMMLA(r, level1, accum);
SINE2TINTERP(phase2, r);
accum = ___SMMLA(r, level2, accum);
SINE2TINTERP(phase3, r);
accum = ___SMMLA(r, level3, accum);
SINE2TINTERP(phase4, r);
accum = ___SMMLA(r, level4, accum);
SINE2TINTERP(phase5, r);
accum = ___SMMLA(r, level5, accum);
SINE2TINTERP(phase6, r);
accum = ___SMMLA(r, level6, accum);
outlet_out = __SSAT((accum << 3), 28);

Privacy

© 2024 Zrna Research