Resonance spike in default synth

I have a problem with the default synth.

I am using this code that I found somewhere:

on = MIDIFunc.noteOn({ |veloc, num, chan, src|
	("ch:" ++ chan ++ " num:" ++ num ++ " val:" ++veloc).postln;
    notes[num] = Synth(\default, [\freq, num.midicps,
        \amp, veloc * 0.00315]);
});

I know why this happens, and there might also be a sensitivity to certain frequencies on my listening device, but:
Are there general rules on how to avoid resonance spikes when synthesizing?

I don’t hear anything unusual from this code. It sounds like the normal default Synth to me. I’m not sure it’s even possible to create a prominent resonance spike using the default SynthDef. Maybe there’s something else in your broader code structure that’s affecting the sound?

My primary approach for avoiding resonance spikes to constrain potentially problematic values within safe ranges, e.g. using value.clip(min,max) inside a SynthDef. This alone doesn’t prevent spikes, e.g. an rq value of 0.0001 with RLPF is considered to be within a “normal” range but is likely to spike, so I might also express amplitude scalars in terms of resonance parameters, using some sort of reciprocal relationship to compensate for gain increases. You can also apply a Limiter or some sort of soft-clipping operation (softclip, distort, tanh) if that flavor is acceptable to you. Generally, the key to avoiding resonance spikes and other undesirable behavior is to be aware and mindful of what you are doing in your synthesis algorithms.

1 Like

So the immediate problem was actually one of my hardware it seems. I actually tried not to fall into this trap and tested the system for resonances with a few sine sweeps. For some reason, my device and the default synth are just not friends.
Thank you very much for all the info! I still have a lot to learn.