Tests: Discontinuity in PWM
dpwe opened this issue · comments
Looking at tests/ref/TestPWM.wav, there's a big discontinuity in the DC offset at t=0.325 sec.
This looks a lot like similar problems we had at one point in the SAW waveforms resulting from the per-block offset calculation.
Digging in to this, it comes from the jumps in PWM phase as it's modulated. So in one 256 sample block, the delay of the negative-going pulse is a constant, say, 78 samples. Then it's the next block, the duty has been modulated by 0.035 of a cycle, and now the negative pulse is being read from the lookup table with a skip of 4.7 samples before the sample point of the last sample written in the previous block. If we're in the middle of the high-amplitude part of the impulse waveform, we significantly mess up the energy. But that's relatively rare for the highly concentrated impulse waveforms, so much of the time it looks like it's working.