Csound Csound-dev Csound-tekno Search About

[Csnd] pvsanal fundamental / fft size question.

Date2013-12-31 18:29
FromRoger Kelly
Subject[Csnd] pvsanal fundamental / fft size question.
I am trying to understand the relationship between ifftsize and the analysis frequency.

The manual mentions that "The fundamental of analysis (which in principle gives the lowest resolvable frequency) is determined as sr/ifftsize"

I was having trouble getting any amplitude values for higher pitched samples.  When I adjusted ifftsize = sr/Hz(of sample) for strongly pitched samples, I now get the amplitudes.  However the analysis seems to take much longer...not sure why.

Is this in general a good practice for getting the amps of the frequencies with pvsanal?  Always adjust the ifftsize so that the analysis frequency is close to the pitch of the sample?

Thanks.

Date2013-12-31 23:26
FromAdam Puckett
SubjectRe: [Csnd] pvsanal fundamental / fft size question.
This seems sort of like a chicken and egg problem: how would you
adjust ifftsize to match the fundamental without performing an FFT on
the signal first?

On 12/31/13, Roger Kelly  wrote:
> I am trying to understand the relationship between ifftsize and the
> analysis frequency.
>
> The manual mentions that "The fundamental of analysis (which in principle
> gives the lowest resolvable frequency) is determined as *sr/ifftsize"*
>
> I was having trouble getting any amplitude values for higher pitched
> samples.  When I adjusted ifftsize = sr/Hz(of sample) for strongly pitched
> samples, I now get the amplitudes.  However the analysis seems to take much
> longer...not sure why.
>
> Is this in general a good practice for getting the amps of the frequencies
> with pvsanal?  Always adjust the ifftsize so that the analysis frequency is
> close to the pitch of the sample?
>
> Thanks.
>
> Send bugs reports to the Sourceforge bug trackers
> csound6:
>             https://sourceforge.net/p/csound/tickets/
> csound5:
>             https://sourceforge.net/p/csound/bugs/
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>
>
>

Date2013-12-31 23:27
Frompeiman khosravi
SubjectRe: [Csnd] pvsanal fundamental / fft size question.

On 31 December 2013 18:29, Roger Kelly <loraxman@gmail.com> wrote:
I am trying to understand the relationship between ifftsize and the analysis frequency.

Hello, 

FFT size is given in samples so the actual duration of the analysis frame depends on your sampling rate. So at a sampling rate of 44100 and an FFT size of 1024, the duration of the frame is 1024/44100 seconds (naturally an FFT size of 44100 would give you one second). Conversely, to convert period (the duration of the frame) to frequency, you'll have to do 1/(fftsize/sr), which is the same as sr/fftsize. That means that with 44100/1024 you're analysing 43.06640625 windows per second.           

Thus, for lower frequencies you need larger fft sizes because you need to fit at least one cycle of the wave inside the frame. In my experience though you need to have an fft size of at least 2-4 times that of the period of the lowest frequency in your input signal to get a good result. So for bass sounds I use really large windows, otherwise I don't have much clarity in the lowers spectral region and get a muddy bass. Of course, the larger the fft size, the worst the time resolution, so one needs to overlap more windows, which comes with all sorts of weird (but often interesting!) phasing artefacts.  

I hope I'm right! But I'm sure someone will correct me if I've made a stupid mistake in my comments. 

Best,
Peiman  
 
The manual mentions that "The fundamental of analysis (which in principle gives the lowest resolvable frequency) is determined as sr/ifftsize"

I was having trouble getting any amplitude values for higher pitched samples.  When I adjusted ifftsize = sr/Hz(of sample) for strongly pitched samples, I now get the amplitudes.  However the analysis seems to take much longer...not sure why.

Is this in general a good practice for getting the amps of the frequencies with pvsanal?  Always adjust the ifftsize so that the analysis frequency is close to the pitch of the sample?

Thanks.


Date2013-12-31 23:33
Frompeiman khosravi
SubjectRe: [Csnd] pvsanal fundamental / fft size question.
Isn't that why God gave us ears!?



On 31 December 2013 23:26, Adam Puckett <adotsdothmusic@gmail.com> wrote:
This seems sort of like a chicken and egg problem: how would you
adjust ifftsize to match the fundamental without performing an FFT on
the signal first?

On 12/31/13, Roger Kelly <loraxman@gmail.com> wrote:
> I am trying to understand the relationship between ifftsize and the
> analysis frequency.
>
> The manual mentions that "The fundamental of analysis (which in principle
> gives the lowest resolvable frequency) is determined as *sr/ifftsize"*
>
> I was having trouble getting any amplitude values for higher pitched
> samples.  When I adjusted ifftsize = sr/Hz(of sample) for strongly pitched
> samples, I now get the amplitudes.  However the analysis seems to take much
> longer...not sure why.
>
> Is this in general a good practice for getting the amps of the frequencies
> with pvsanal?  Always adjust the ifftsize so that the analysis frequency is
> close to the pitch of the sample?
>
> Thanks.
>
> Send bugs reports to the Sourceforge bug trackers
> csound6:
>             https://sourceforge.net/p/csound/tickets/
> csound5:
>             https://sourceforge.net/p/csound/bugs/
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>
>
>


Send bugs reports to the Sourceforge bug trackers
csound6:
            https://sourceforge.net/p/csound/tickets/
csound5:
            https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Date2013-12-31 23:36
Frompeiman khosravi
SubjectRe: [Csnd] pvsanal fundamental / fft size question.
AttachmentsfreqList.pdf  
One of these days I'm going to have this tattooed on my belly. It helps to EQ stuff, as well as determining the dimensions of a room by simply listening to the standing wave (or feedback frequencies in a live situation). 



On 31 December 2013 23:33, peiman khosravi <peimankhosravi@gmail.com> wrote:
Isn't that why God gave us ears!?



On 31 December 2013 23:26, Adam Puckett <adotsdothmusic@gmail.com> wrote:
This seems sort of like a chicken and egg problem: how would you
adjust ifftsize to match the fundamental without performing an FFT on
the signal first?

On 12/31/13, Roger Kelly <loraxman@gmail.com> wrote:
> I am trying to understand the relationship between ifftsize and the
> analysis frequency.
>
> The manual mentions that "The fundamental of analysis (which in principle
> gives the lowest resolvable frequency) is determined as *sr/ifftsize"*
>
> I was having trouble getting any amplitude values for higher pitched
> samples.  When I adjusted ifftsize = sr/Hz(of sample) for strongly pitched
> samples, I now get the amplitudes.  However the analysis seems to take much
> longer...not sure why.
>
> Is this in general a good practice for getting the amps of the frequencies
> with pvsanal?  Always adjust the ifftsize so that the analysis frequency is
> close to the pitch of the sample?
>
> Thanks.
>
> Send bugs reports to the Sourceforge bug trackers
> csound6:
>             https://sourceforge.net/p/csound/tickets/
> csound5:
>             https://sourceforge.net/p/csound/bugs/
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>
>
>


Send bugs reports to the Sourceforge bug trackers
csound6:
            https://sourceforge.net/p/csound/tickets/
csound5:
            https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"





Date2014-01-05 19:44
FromRoger Kelly
SubjectRe: [Csnd] pvsanal fundamental / fft size question.
I have one last question on this topic. I am trying to use pvsftw to capture the fft results into tables.  It only seems to fill its tables once for the ffts, no matter how long p3 value is.  And it only copies the last frames worth of data from the pvs stream.

Do  you know if that is how it is supposed to operate?  The manual says something about it not updating every k samples.


On Tue, Dec 31, 2013 at 5:36 PM, peiman khosravi <peimankhosravi@gmail.com> wrote:
One of these days I'm going to have this tattooed on my belly. It helps to EQ stuff, as well as determining the dimensions of a room by simply listening to the standing wave (or feedback frequencies in a live situation). 
On 31 December 2013 23:33, peiman khosravi <peimankhosravi@gmail.com> wrote:
Isn't that why God gave us ears!?



On 31 December 2013 23:26, Adam Puckett <adotsdothmusic@gmail.com> wrote:
This seems sort of like a chicken and egg problem: how would you
adjust ifftsize to match the fundamental without performing an FFT on
the signal first?

On 12/31/13, Roger Kelly <loraxman@gmail.com> wrote:
> I am trying to understand the relationship between ifftsize and the
> analysis frequency.
>
> The manual mentions that "The fundamental of analysis (which in principle
> gives the lowest resolvable frequency) is determined as *sr/ifftsize"*
>
> I was having trouble getting any amplitude values for higher pitched
> samples.  When I adjusted ifftsize = sr/Hz(of sample) for strongly pitched
> samples, I now get the amplitudes.  However the analysis seems to take much
> longer...not sure why.
>
> Is this in general a good practice for getting the amps of the frequencies
> with pvsanal?  Always adjust the ifftsize so that the analysis frequency is
> close to the pitch of the sample?
>
> Thanks.
>
> Send bugs reports to the Sourceforge bug trackers
> csound6:
>             https://sourceforge.net/p/csound/tickets/
> csound5:
>             https://sourceforge.net/p/csound/bugs/
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>
>
>


Send bugs reports to the Sourceforge bug trackers
csound6:
            https://sourceforge.net/p/csound/tickets/
csound5:
            https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"






Date2014-01-05 21:23
FromRichard Dobson
SubjectRe: [Csnd] pvsanal fundamental / fft size question.
You need to read the value of the output kflag from pvsftw before doing 
any computation on the data. Of course, at each kflag update previous 
data is replaced with new data, so that at the end of the note, the 
table will contain the data from the final frame. As indicated in my 
previous post, this facility is for diy spectral modification, i.e. 
where the data is used immediately and copied back to an fsig stream.

Richard Dobson


On 05/01/2014 19:44, Roger Kelly wrote:
> I have one last question on this topic. I am trying to use pvsftw to
> capture the fft results into tables.  It only seems to fill its tables
> once for the ffts, no matter how long p3 value is.  And it only copies
> the last frames worth of data from the pvs stream.
>
> Do  you know if that is how it is supposed to operate?  The manual says
> something about it not updating every k samples.
>