Csound Csound-dev Csound-tekno Search About

[Csnd] Assumptions about FFT in Csound

Date2018-06-26 19:07
From"Jeanette C."
Subject[Csnd] Assumptions about FFT in Csound
Hey hey,
I am currently working with FFTs a lot and would like to know if a few of my 
assumptions are true.

Frequency distribution: an FFT is linear in distribution, bands have roughly 
the same width all over the spectrum.

Looking for a certain frequency (freq), I can assume that it will be very 
close to the bin:
round(freq / binwidth)
binwidth = (sr/2) / (ifftsize / 2 + 1)
= Nyquist_frequency / number_of_bins
if the frequency is present at all?

Using pvsanal (or similar) can I assume that amps for the bins don't exceed 
the range of 0-1?

Best wishes and thanks,

Jeanette

--------
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

Ain't no way I'll be lonely <3
(Britney Spears)

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

Date2018-06-26 20:28
FromMichael Gogins
SubjectRe: [Csnd] Assumptions about FFT in Csound
What you say is true (except I don't know about the amplitudes) but can be very misleading. In computer music we normally are dealing with the short time FT with overlapping windows (STFT). More about this later. 

For a single FT with one time bin for the entire duration of the signal, the frequencies of individual frequency bins cannot represent all the frequencies in the signal. The FT represents the other frequencies in the signal by combining frequency bins using complex numbers, negative frequencies, and so on such that most frequencies in the signal are represented by adding or subtracting energies from several FT bins at different frequencies, e.g. to produce interference,  beating, etc.

This also is true in the STFT. In addition each time bin is further analyzed into "instantaneous frequencies" which seldom coincide with the center frequencies of the FT bins, because they include phase changes that warp the frequencies, but do more or less track the frequencies in the signal. Hence this kind of STFT is used to make the "tracking phase vocoder". 

What exactly are you trying to do?


On Jun 26, 2018 14:07, "Jeanette C." <julien@mail.upb.de> wrote:
Hey hey,
I am currently working with FFTs a lot and would like to know if a few of my
assumptions are true.

Frequency distribution: an FFT is linear in distribution, bands have roughly
the same width all over the spectrum.

Looking for a certain frequency (freq), I can assume that it will be very
close to the bin:
round(freq / binwidth)
binwidth = (sr/2) / (ifftsize / 2 + 1)
= Nyquist_frequency / number_of_bins
if the frequency is present at all?

Using pvsanal (or similar) can I assume that amps for the bins don't exceed
the range of 0-1?

Best wishes and thanks,

Jeanette

--------
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

Ain't no way I'll be lonely <3
(Britney Spears)

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

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

Date2018-06-26 20:53
From"Jeanette C."
SubjectRe: [Csnd] Assumptions about FFT in Csound
Jun 26 2018, Michael Gogins has written:
...
> What exactly are you trying to do?
Hi Michael,
this is basically how my process graph will look:
fsig pvsanal monophonic audio-in ...
pitchtrack (either audio or fsig, depending on best opcode)
pvsftw fsig ...
Search frequency content from pvsftw to find "near" matches for
   fundamental and harmonics (make them exact matches, if desired)
manipulate corresponding amplitudes

So muc for the frequency part.

The amplitude part: somehow correlate two FFTs. I might need two ways to
process the input bin-amplitudes, so how to do it? Choose positive
numbers for method one and negative numbers to signify method two. This
only works if pvsftw of a "simple" fsig will only produce positive
amplitude values. Otherwise, a different method will have to be chosen,
possibly involving an extra table with values per bin denoting the
required method.

I hope this doesn't sound too convoluted, though "convolution" isn't too
far away. :)
...

Best wishes,

Jeanette

--------
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

Ain't no way I'll be lonely <3
(Britney Spears)

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