[Csnd] rfft > rect2pol/mags - maximum amplitude?

Hi,

What is the maximum magnitude that can be returned by rect2pol or mags after rfft, assuming a rectangular window?

I am performing the analysis on a ftable converted to array. I was expecting the maximum amplitude to be N/2 (that is the case for a sine wave), but some waveforms (such as a naive square) return values up to 2607 for an array of 4096 points.

Thanks,

Pierre

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        Issues · csound/csound · GitHub
Discussions of bugs and features can be posted here

The normalisation factor is N/2. I guess if you are analysing things like a naive non\-bandlimited square wave
you might get some mag results going over 1.0.

Note that this is what you’d also get if you used Python & numpy

import numpy as np
a = np.zeros4096
a[0:2048] = 1
a[2048:4096] = -1
s = np.fft.rffta
abss\[1\]

2607.5948432810956

Makes sense. Thanks!