Loud volume crash, typical solutions?

Hey all. Relatively new to csounds and had a question. I noticed when the audio gets very loud when testing that csounds will stop outputting sound at a certain point, so I’m assuming there’s a crash that goes on if the volume clips too hard. Is there a way to prevent this without sacrificing audio quality by always running it through a limiter or something? What’s the standard practice to avoid extreme volume levels when using for instance the svfilter opcode with high user controllable resonance and cutoff (which can cause sudden large increases in volume)?

Thanks for any information in advance

Good day to you,
in the next release there is a new command line --limiter
i build Csound myself and use the command line --limiter=0.95
Check Csound command line

There is also the limit opcode, but i prefer the command line limiter

Does this have any effect on the quality of the output? I noticed using the limit opcode that there was a slight difference in the timbre of output

Hi there. Here are the responses to a similar question I asked a little while ago:

http://csound.1045644.n5.nabble.com/Csnd-Methods-for-protecting-speakers-ears-td5766751.html#a5766752

Another technique I sometimes use is to run the CSD for just a second with my speakers muted and then stop it. Csound will then output a message like overall amps: 0.66628 0.66628. That lets me know if the volume levels are safe. This doesn’t work for every Csound scenario, but it does the trick for some.

Good luck! Let us know if you have any other questions.

Jason

Have you happened to have the experience of csounds ceasing to output audio after it clips a certain threshold or getting strange glitchy artifacts beforehand? I’m wondering if this is actually particular to csound or if it could be related to the fact that I’m using it within the Unity game development engine. Basically I’m curious if this happens within csound or if potentially the ceasing of output could be caused on the Unity side if the volume exceeds a certain threshold

I plan on building this out using cabbage outside of Unity tomorrow but I figured I’d ask if this is something that’s particular to csound

i think what you experienced might have to do more with filters that
with output clipping. a filter is a system which can become unstable,
and then perhaps stop working. i don’t think that clipping itself leads
to the same.

joachim

Ahh that makes sense that it’d be more specific to filters. For something like svfilter is ramping up the scaling as resonance is increased a reliable approach to counter potential clipping? I’m assuming you don’t want to always limit the signal but maybe do it conditionally?

Yes what you’re hearing is the result of a hard threshold filtering applied by CsoundUnity to the overall output, all the samples with a value above 10 are not sent to the output, thus causing glitches. Audio in Unity is always 0-1 based. You should receive several warnings in the Unity console. This is to avoid damages to equipment and ears. We could add a toggle to manage it of course!