@hyc i don't think that approach is great because when you are near clipping you're unscaled then suddenly you drop down by 2 once you exceed the peak. i have seen people talk about clamping at the max value but in my test cases that sounds too distorted.
thanks for confirming my intuition about the sum!
@d6 no I meant, scan the entire audio stream. If nothing clips, skip the div for the whole thing.
Clamping just a few samples would distort the hell out of it, yeah.