Hello list,
I was curious about the following math issue: when defining a waveform
using "sinesum 0.8 0.2 0.1", what would be the formula to normalize the
wave to 1?
I tried adding all the values (=1.1 in this case), getting the inverse
value and multiplying the list with that. Although the sum of the values
is 1, the resulting wave isn't normalized to 1 the same way the "normalize
1" command would do it. So I imagine some higher math is required?
Also, is the process the same if the wave components are harmonic or not
(that is, multiples of the base frequency)?
Best,
jmmmp
Hi Joao, you need to find the peak amplitude, max(abs(x)), and divide all samples by that.
On Apr 29, 2018 7:55 PM, "João Pais" jmmmpais@gmail.com wrote:
Hello list,
I was curious about the following math issue: when defining a waveform using "sinesum 0.8 0.2 0.1", what would be the formula to normalize the wave to 1? I tried adding all the values (=1.1 in this case), getting the inverse value and multiplying the list with that. Although the sum of the values is 1, the resulting wave isn't normalized to 1 the same way the "normalize 1" command would do it. So I imagine some higher math is required?
Also, is the process the same if the wave components are harmonic or not (that is, multiples of the base frequency)?
Best,
jmmmp
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Hi William,
Hi Joao, you need to find the peak amplitude, max(abs(x)), and divide
all samples by that.
I'm not sure: if I use the amplitudes 1 0.5 0.25, the peak amplitude is 1,
and the wave is clearly outside of the 1/-1 boundaries.
Basically what I'm trying to do is to find out what is the formula that
does the "normalize" function.
Best,
Joao
On Apr 29, 2018 7:55 PM, "João Pais" jmmmpais@gmail.com wrote:
Hello list,
I was curious about the following math issue: when defining a waveform
using "sinesum 0.8 0.2 0.1", what would be the formula to normalize the
wave to 1? I tried adding all the values (=1.1 in this case), getting the inverse
value and multiplying the list with that. Although the sum of the
values is 1, the resulting wave isn't normalized to 1 the same way the
"normalize 1" command would do it. So I imagine some higher math is
required?Also, is the process the same if the wave components are harmonic or
not (that is, multiples of the base frequency)?Best,
jmmmp
On 2018-04-30 10:25, João Pais wrote:
Hi William,
Hi Joao, you need to find the peak amplitude, max(abs(x)), and divide all samples by that.
I'm not sure: if I use the amplitudes 1 0.5 0.25, the peak amplitude is 1, and the wave is clearly outside of the 1/-1 boundaries.
then you are doing something wrong. why do you think the maximum of abs(sin(t)+½sin(2t)+¼sin(4t)) is "1"?
to analytically get the maxima of this function, you probably have to recall your high-school maths (get the derivative of the function (without the abs()), set it to "0" and solve it for every t to find the positions of the extrema; use these t's to get the values of the extrema)
Basically what I'm trying to do is to find out what is the formula that does the "normalize" function.
however, the "formula" of "normalize is very simple:
(absolute) you find in there
the just found maximum.
gfmasdr IOhannes
I'm not sure: if I use the amplitudes 1 0.5 0.25, the peak amplitude is 1, and the wave is clearly outside of the 1/-1 boundaries.
then you are doing something wrong. why do you think the maximum of abs(sin(t)+½sin(2t)+¼sin(4t)) is "1"?
to analytically get the maxima of this function, you probably have to recall your high-school maths (get the derivative of the function (without the abs()), set it to "0" and solve it for every t to find the positions of the extrema; use these t's to get the values of the extrema)
since I almost flunked at math in high school, that's probably why I
didn't know what the peak amplitude was.
One thing about that context that I didn't explain: I'm not using an array
to read the waveshape, but adding the individual waves separately, so that
I can change the amplitudes dinamically each time the phase of each
partial is 0 (if I do it with sinesum+normalize, there's always clicks). I
was hoping to apply the formula of normalize directly, but now it seems
that the easiest way is to use sinesum+normalize in parallel as a fast way
to get the peak amplitude.
Best,
Joao
Basically what I'm trying to do is to find out what is the formula that does the "normalize" function.
however, the "formula" of "normalize is very simple:
- take a table
- iterate over all the elements of the table and get the maximum value
(absolute) you find in there
- iterate over all the elements of the table and divide each element by
the just found maximum.
gfmasdr IOhannes
Maybe I'm misunderstanding what you're asking, but if the waveform is visually outside of the +1/-1 table bounds, the peak amplitude has to be greater than 1.0 too. Peak amplitude is the maximum of the absolute value of a waveform...max(abs(x)). When I run
sinesum 512 1 0.5 0.25;
I get a peak amplitude of 1.38751. Dividing all samples in the table by that value makes the new peak 1.0, and all other values scaled proportionally. So if you want to normalize without using the built-in "normalize" function, you can safely do it this way.
On Mon, Apr 30, 2018 at 4:25 AM, João Pais jmmmpais@gmail.com wrote:
Hi William,
Hi Joao, you need to find the peak amplitude, max(abs(x)), and divide all samples by that.
I'm not sure: if I use the amplitudes 1 0.5 0.25, the peak amplitude is 1, and the wave is clearly outside of the 1/-1 boundaries.
Basically what I'm trying to do is to find out what is the formula that does the "normalize" function.
Best,
Joao
On Apr 29, 2018 7:55 PM, "João Pais" jmmmpais@gmail.com wrote:
Hello list,
I was curious about the following math issue: when defining a waveform using "sinesum 0.8 0.2 0.1", what would be the formula to normalize the wave to 1? I tried adding all the values (=1.1 in this case), getting the inverse value and multiplying the list with that. Although the sum of the values is 1, the resulting wave isn't normalized to 1 the same way the "normalize 1" command would do it. So I imagine some higher math is required?
Also, is the process the same if the wave components are harmonic or not (that is, multiples of the base frequency)?
Best,
jmmmp
Hello list,
I was curious about the following math issue: when defining a waveform using "sinesum 0.8 0.2 0.1", what would be the formula to normalize the wave to 1? I tried adding all the values (=1.1 in this case), getting the inverse value and multiplying the list with that. Although the sum of the values is 1, the resulting wave isn't normalized to 1 the same way the "normalize 1" command would do it. So I imagine some higher math is required?
Or send the message ; mytable normalize to normalize the data in the table after you defined the waveform.