 # Normalice a wave already established!

I have an audio wave already established. I want to normalize it or have the value control from -1 to +1 in the sample editor.

Does anyone have information of what mathematical formula or what procedure should I do to solve these operations?

At the moment, I know how to get the maximum positive and negative value. Therefore, with a subtraction I have the maximization value.

But how do you maximize a wave? Maximize allows you to preserve the wave pattern, but larger. It is not the same as styling it up and down.

The API gives us access to the position of the frames and the value of the sample between -1 and +1. By iteration it is possible to modify all the points as you like.

1 Like

Using multiplication is not a bad idea. By how much do you need to multiply the maxvalue to reach 1? Multiply all values with that…

``````if min < 0.0 && -min > max then max = -min
factor = 1.0 / max
multiply_whole_waveform_with(factor)``````

hth

2 Likes

make negative values also positive with math.abs(), then get the maximum of all. 1/maximum is your desired multiplicator. edit: nvm

1 Like

Ok, I will try this.

I know that with a simple sum I am stretching the wave, but this is not maximizing.

Yes, I have all this already present. Not only is there the maximum positive and negative value, but they are two audio waves if they are stereo. It’s time to compare 4 numbers.

I will try to find the fastest way. If multiplication is appropriate, I will apply it like this, that is, iterate all the frames multiplying the x value by the value of each sample.

Thank you very much for the help!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.