Additive Synth/Audio analyser phase issues
I'm building an audio waveform analyser with an 8 sine wave additive synth. Basically I'm showing how waveforms change as you add or remove partials. I'm using a dictionary to store frequency multipliers and levels for the oscillators, and that side of things seems to be working fine.
The problem occurs when I recall a particular setting from the dictionary; the levels and frequencies are set, but the phase of the cycle~ objects seems to shift, as the output on the scope isn't what I'd expect to see. Turning DSP off then on again fixes the issue, but I don't know what the root of it is. Can anyone help me?
I've tried resetting the phase of each cycle~ object to 0, but this doesn't fix the problem. Any ideas?
If you want to make sure a bunch of cycle~s stay in phase, drive them from a single phasor~ using rate~.
You may also want to look at controlling the relative phases of the sinusoids - at the moment you're just adding them all in phase, but reversing the phase of a component can radically change the sound, and indeed is necessary for building things like square waves,
Cheers
Roger