I’m not sure I understand what you mean by distort. It will currently return results of > 1 with linearity. If you mean won’t let audio distort your sound card by clipping the output to 1, then you’ll be distorting the audio before it reaches your sound card, and in much the same way.

If you want a +~ that will stop not allow output of that excedes 1 or -1 then just put a [tanh~ ] after a standard [+~ ] object. This will soft-clip and sound less like digital clipping.

You can just put a [clip~ -1 1 ] after your [+~ ] to get the behaviour you desire……however if you use this with audio it *will* distort if your addition exceeds +/-1.

If you go to the download section you can get the Max5 SDK, which will walk you through writing externals, and I imagine it has code examples for standard objects.

1) There seems to be a fundamental misunderstanding of how MSP works. MSP works with 32-bit floating point samples, giving you a range FARFARFARFARFARFARFARFAR greater than [-1 .. 1] to work with intermediate calculations. You can +~, *~, -~ and anything else to your heart’s content. As long as you scale it back to [-1 .. 1] before going to the DACs, you’re fine.

What you want to do will *add* distortion to a signal.

2) The SDK for coding objects in C is available on this very web site. But I’d get point #1 sorted out before starting coding in C.

peter: that was not what he meant, but adding 2 signals with 25 bits integer would
still give him a higher precision than remaining in 32 bits float. of course noone
needs to use only integer overflow bits for summing, because all audio software
uses float somwehere anywhere (last but not least when dithering down to 16 bits)