Artificial intelligent assistant

Waveform filter - what's in the black box? I'm trying to come up with an algorithm or filter that has the i/o characteristics in the image below (waveform plotted from audio data) .. I input a sine wave or saw and the resulting graphic is an area filled wave. I've been trying different filters like a moving average and gaussian smooth, but it's not right. The idea is to go from the raw data input waveform and generate an area filled and smooth graphic like the output. I'm interested in the 'smoothed' data points. By looking at the input and output, can anybody see what tranformations would be in the black box to create the resulting data set? The only one I'm sure of is the waveform is inversed and added to the original - but what else happens? Thanks for your help! (i can upload more examples if a specific input waveform would help) y-axis data min/max is -1 to 1

It appears that the filled area lies between curves proportional to either $\pm\sqrt{|f|}$ or $\pm\log|f|$, where $f$ is proportional to the input signal. The logarithmic version would require some cutoff to avoid large negative values near $f=0$. Since such waves are usually digitally sampled, this could be done by taking the logarithm of the integer sample value, which would be $0$ for an input of $1$, and then defining the output to also be $0$ for an input of $0$. You can see in this plot that it's hard to tell with the naked eye which of the two it is. From what I know about audio, I'd expect that the logarithm would make more sense. If you can, you should apply both of those functions to the input you gave as an example and then compare the outputs in detail.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 28a2a402009ff48a39dea46e231805de