While finalizing an update of our synth, I have been facing some pops in some MIDI clips. They seem to happen when there’s a sharp attack after a slow piece. You’ll probably guess I’m not an expert in the physics of sound, so I would appreciate any feedback on how to tackle such situations.
I can imagine, adding a longer attack time would help, but how much should be added, and would this solve any such situations? Or should I add some process (I imagine on the mixed output) that detects such peaks and fades them? Is that even possible? Or desirable?
I’m attaching here one part that is popping, along with a zoomed view that shows the sine to be continuous.
I think we’d need to have more information on how your synth is structured and maybe then we could look at specific code that might be at fault. Usually 5-20ms fades are enough to avoid pops, but it really depends how you’re implementing it.
Thanks for the feedback. Delving deeper into the issue, it seems the pop is mainly due to the irregular peak right before the attack. This seems to be caused by some mixing at non zero-crossing, so I need to look into that.
The attack still needs a slightly longer fade, but as you say, even 5-10 ms should be fine.
Attacks smaller than the wave size can produce these noises. The lower the note, the more it is appreciated. Here you can see that a 1ms attack on a 220hz wave produces a peak at the beginning.
The problem with setting the attack to several milliseconds is that you hurt the attack of the high notes that do not need that margin. So I have solved it by limiting the attack time to the size of the wave of the note, simply by obtaining and limit the attack when played, in this way
Another perspective on this would be to think about it like amplitude modulation (AM). If you go beyond 20 Hz the sidebands, producing frequencies that were not there, become audible. So as a general rule for mixed signals with arbitrary frequencies is to not go beyond 20 Hz
Typically we (producers) avoid that by starting the sine wave with sum up to the desired wave form at phase 0, so there is natural smooth start. However since people like gating, that setup their wave to cosine / (-90) and thus have these attacks where harmonics occur. The least thing to limit that is to slow down the steepness to the rise time given by the half of nyquist. The best thing is a 1-cosine fade in according to the given frequency, because higher pitched note require more steepness than e.g. basses.
This all depends further on the filter of your chain and the AA-filter of your sound card. (overshoot issue with IIRs).