yokemura / Magical8bitPlug2

GNU General Public License v3.0
301 stars 19 forks source link

[BUG] Phase Interference when playing Triangle wave and Square wave (50% pwm) together #37

Open MattBJ opened 1 year ago

MattBJ commented 1 year ago

Describe the bug Additive synthesis between the Triangle wave and Square wave is resulting in phase interference.

To Reproduce

  1. Open up the DAW you use (I use ableton live)
  2. Create two instances of this plugin, one for the Triangle wave and one for the Square wave
  3. Make sure: Their output power is the same, and your MIDI signal is going to both of them
  4. Alternate between soloing one instance, and the other, then play the two together

Expected behavior I would expect when doing additive synthesis, the power (at least at the fundamental frequency) would add up and be stronger, but it is actually weaker!

Screenshots Playing only the triangle wave image Playing only the square wave image Playing the two simultaneously (notice the fundamental frequency power being lower image

Audio https://user-images.githubusercontent.com/40750771/199121477-5f4a2f17-1381-45b6-88e4-982421070b61.mp4

Your environment (please complete the following information):

MattBJ commented 1 year ago

image Thanks to talking with somebody else, I believe I have found the issue. Inverting the triangle wave (or inverting the square wave?) will remove this interference. This begs the question - should the user have some more sophisticated control over the phase of the basic shape signals?