Csound Csound-dev Csound-tekno Search About

[Csnd] Question about fft and zero pad

Date2011-04-06 10:51
FromOrazio Brancati
Subject[Csnd] Question about fft and zero pad
Hi list,
working with fft and csound I'm studing zero-pad as well.
I know zero-pad consists in append "zeroes" in the analysis window, 
in order to improve spectrum resolution. 

So, I'm wonder, why increasing the window size with zeroes instead of, more simply, 
increasing the window size (without append zeroes)?

I hope someone could help me. 
Thanks
OB

 



Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2011-04-06 14:39
FromConor Dempsey
SubjectRe: [Csnd] Question about fft and zero pad

Hi Orazio,


As you can see in the link below, there are many reasons why zero padding is used 
1. bring the data range for fft(ing) up to a power of 2 size (which many algorithms are optimized for)
2. reduce the amount of spectral leakage across bins in conjunction with windowing sytems.

There appears to be a lot of misconceptions about the increase in spectral resolution which are pointed out 
along the way and in the comments section at the bottom


As with everything google is your friend..
I particularly like DSP guru and wolfram mathworld

Kind regards,

Conor

On Wed, Apr 6, 2011 at 10:51 AM, Orazio Brancati <oraziobrancati@gmail.com> wrote:
Hi list,
working with fft and csound I'm studing zero-pad as well.
I know zero-pad consists in append "zeroes" in the analysis window,
in order to improve spectrum resolution.

So, I'm wonder, why increasing the window size with zeroes instead of, more simply,
increasing the window size (without append zeroes)?

I hope someone could help me.
Thanks
OB





Send bugs reports to the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




--
music moves more than the maker

Date2011-04-06 14:52
FromOrazio Brancati
SubjectRe: [Csnd] Question about fft and zero pad

Thanks Conor,
my question, more precisely, is:

why increasing the window size with zeroes instead of, more simply, 
increasing the window size (without append zeroes)?

I think a window size of 8 samples + 8 zeroes is not much more different than a 
16 samples window size which have not zeroes. The only difference between these 
two windows should be that a 16 sample window size without 
zeroes contains more signal than the one with the same size containing zeroes. 
So, a 16 samples window containing only signal without zeroes should be 
better than a 16 samples signal containings 8 sample + 8 zeroes. 

So, I don't understand why this zero-padding technique is chosen instead of
increasing the window size.

Thanks
OB









Il giorno 06/apr/2011, alle ore 15.39, Conor Dempsey ha scritto:

Hi Orazio,

As you can see in the link below, there are many reasons why zero padding is used 
1. bring the data range for fft(ing) up to a power of 2 size (which many algorithms are optimized for)
2. reduce the amount of spectral leakage across bins in conjunction with windowing sytems.

There appears to be a lot of misconceptions about the increase in spectral resolution which are pointed out 
along the way and in the comments section at the bottom


As with everything google is your friend..
I particularly like DSP guru and wolfram mathworld

Kind regards,

Conor

On Wed, Apr 6, 2011 at 10:51 AM, Orazio Brancati <oraziobrancati@gmail.com> wrote:
Hi list,
working with fft and csound I'm studing zero-pad as well.
I know zero-pad consists in append "zeroes" in the analysis window,
in order to improve spectrum resolution.

So, I'm wonder, why increasing the window size with zeroes instead of, more simply,
increasing the window size (without append zeroes)?

I hope someone could help me.
Thanks
OB





Send bugs reports to the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




--
music moves more than the maker


Date2011-04-06 15:03
FromVictor Lazzarini
SubjectRe: [Csnd] Question about fft and zero pad
One of the reasons is because you might only have so much data. Say you have N samples, if you want to
take a 2N DFT, then you need to pad in with zeros. If you have 2N samples, then of course you can do as
you please. This is typically what you would do when padding up to pow-of-two (in which case you have
N samples and want to pad up to N+M samples which is a pow of two).

Victor

On 6 Apr 2011, at 14:52, Orazio Brancati wrote:


Thanks Conor,
my question, more precisely, is:

why increasing the window size with zeroes instead of, more simply, 
increasing the window size (without append zeroes)?

I think a window size of 8 samples + 8 zeroes is not much more different than a 
16 samples window size which have not zeroes. The only difference between these 
two windows should be that a 16 sample window size without 
zeroes contains more signal than the one with the same size containing zeroes. 
So, a 16 samples window containing only signal without zeroes should be 
better than a 16 samples signal containings 8 sample + 8 zeroes. 

So, I don't understand why this zero-padding technique is chosen instead of
increasing the window size.

Thanks
OB









Il giorno 06/apr/2011, alle ore 15.39, Conor Dempsey ha scritto:

Hi Orazio,

As you can see in the link below, there are many reasons why zero padding is used 
1. bring the data range for fft(ing) up to a power of 2 size (which many algorithms are optimized for)
2. reduce the amount of spectral leakage across bins in conjunction with windowing sytems.

There appears to be a lot of misconceptions about the increase in spectral resolution which are pointed out 
along the way and in the comments section at the bottom


As with everything google is your friend..
I particularly like DSP guru and wolfram mathworld

Kind regards,

Conor

On Wed, Apr 6, 2011 at 10:51 AM, Orazio Brancati <oraziobrancati@gmail.com> wrote:
Hi list,
working with fft and csound I'm studing zero-pad as well.
I know zero-pad consists in append "zeroes" in the analysis window,
in order to improve spectrum resolution.

So, I'm wonder, why increasing the window size with zeroes instead of, more simply,
increasing the window size (without append zeroes)?

I hope someone could help me.
Thanks
OB





Send bugs reports to the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




--
music moves more than the maker


Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2011-04-06 15:23
FromConor Dempsey
SubjectRe: [Csnd] Question about fft and zero pad

I tend to pad up the data frame before windowing to ensure that it adds up to a power of two 
This has the effect of making my window function always have zeros at either end which makes
me happy that there will be no wrap around, leakage or any other stuff like that.

I may have been working under misconceptions in doing that though?


On Wed, Apr 6, 2011 at 3:03 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
One of the reasons is because you might only have so much data. Say you have N samples, if you want to
take a 2N DFT, then you need to pad in with zeros. If you have 2N samples, then of course you can do as
you please. This is typically what you would do when padding up to pow-of-two (in which case you have
N samples and want to pad up to N+M samples which is a pow of two).

Victor

On 6 Apr 2011, at 14:52, Orazio Brancati wrote:


Thanks Conor,
my question, more precisely, is:

why increasing the window size with zeroes instead of, more simply, 
increasing the window size (without append zeroes)?

I think a window size of 8 samples + 8 zeroes is not much more different than a 
16 samples window size which have not zeroes. The only difference between these 
two windows should be that a 16 sample window size without 
zeroes contains more signal than the one with the same size containing zeroes. 
So, a 16 samples window containing only signal without zeroes should be 
better than a 16 samples signal containings 8 sample + 8 zeroes. 

So, I don't understand why this zero-padding technique is chosen instead of
increasing the window size.

Thanks
OB









Il giorno 06/apr/2011, alle ore 15.39, Conor Dempsey ha scritto:

Hi Orazio,

As you can see in the link below, there are many reasons why zero padding is used 
1. bring the data range for fft(ing) up to a power of 2 size (which many algorithms are optimized for)
2. reduce the amount of spectral leakage across bins in conjunction with windowing sytems.

There appears to be a lot of misconceptions about the increase in spectral resolution which are pointed out 
along the way and in the comments section at the bottom


As with everything google is your friend..
I particularly like DSP guru and wolfram mathworld

Kind regards,

Conor

On Wed, Apr 6, 2011 at 10:51 AM, Orazio Brancati <oraziobrancati@gmail.com> wrote:
Hi list,
working with fft and csound I'm studing zero-pad as well.
I know zero-pad consists in append "zeroes" in the analysis window,
in order to improve spectrum resolution.

So, I'm wonder, why increasing the window size with zeroes instead of, more simply,
increasing the window size (without append zeroes)?

I hope someone could help me.
Thanks
OB





Send bugs reports to the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




--
music moves more than the maker


Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie






--
music moves more than the maker

Date2011-04-06 15:33
FromOrazio Brancati
SubjectRe: [Csnd] Question about fft and zero pad
Il giorno 06/apr/2011, alle ore 16.03, Victor Lazzarini ha scritto:

> Say you have N samples, if you want to
> take a 2N DFT, then you need to pad in with zeros. If you have 2N samples, then of course you can do as
> you please. 


Thanks Victor, 
so you are saying if we pad a signal with zeros is not the same as add samples on it. 
That is, a window size made up of 8 sample + 8 zeroes is different than a window size
made up of 8 samples + 8 samples. It is right?

So why zeroes are not considered as "data" in a window? I'm asking this question 
because when I add "silence" into an audio file (using whatever wave editor) it becomes 
bigger. If, for example, I add some silence in a 1 Mb file, I add more data in it... so the 
file results to be bigger (2 Mb or whatever).  Thus, in this case, adding zeroes means 
adding data into a file. Please tell me if I'm wrong.



 

Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2011-04-06 15:34
FromVictor Lazzarini
SubjectRe: [Csnd] Question about fft and zero pad
Sorry, I meant that you'd pad up with M zeros to get to a N+M pow of two size. My comment
about 2N samples is that you can either take a N or a 2N DFT as you please, because you
have enough data to do whatever you'd like up to 2N samples.

Victor
On 6 Apr 2011, at 15:23, Conor Dempsey wrote:


I tend to pad up the data frame before windowing to ensure that it adds up to a power of two 
This has the effect of making my window function always have zeros at either end which makes
me happy that there will be no wrap around, leakage or any other stuff like that.

I may have been working under misconceptions in doing that though?


On Wed, Apr 6, 2011 at 3:03 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
One of the reasons is because you might only have so much data. Say you have N samples, if you want to
take a 2N DFT, then you need to pad in with zeros. If you have 2N samples, then of course you can do as
you please. This is typically what you would do when padding up to pow-of-two (in which case you have
N samples and want to pad up to N+M samples which is a pow of two).

Victor

On 6 Apr 2011, at 14:52, Orazio Brancati wrote:


Thanks Conor,
my question, more precisely, is:

why increasing the window size with zeroes instead of, more simply, 
increasing the window size (without append zeroes)?

I think a window size of 8 samples + 8 zeroes is not much more different than a 
16 samples window size which have not zeroes. The only difference between these 
two windows should be that a 16 sample window size without 
zeroes contains more signal than the one with the same size containing zeroes. 
So, a 16 samples window containing only signal without zeroes should be 
better than a 16 samples signal containings 8 sample + 8 zeroes. 

So, I don't understand why this zero-padding technique is chosen instead of
increasing the window size.

Thanks
OB









Il giorno 06/apr/2011, alle ore 15.39, Conor Dempsey ha scritto:

Hi Orazio,

As you can see in the link below, there are many reasons why zero padding is used 
1. bring the data range for fft(ing) up to a power of 2 size (which many algorithms are optimized for)
2. reduce the amount of spectral leakage across bins in conjunction with windowing sytems.

There appears to be a lot of misconceptions about the increase in spectral resolution which are pointed out 
along the way and in the comments section at the bottom


As with everything google is your friend..
I particularly like DSP guru and wolfram mathworld

Kind regards,

Conor

On Wed, Apr 6, 2011 at 10:51 AM, Orazio Brancati <oraziobrancati@gmail.com> wrote:
Hi list,
working with fft and csound I'm studing zero-pad as well.
I know zero-pad consists in append "zeroes" in the analysis window,
in order to improve spectrum resolution.

So, I'm wonder, why increasing the window size with zeroes instead of, more simply,
increasing the window size (without append zeroes)?

I hope someone could help me.
Thanks
OB





Send bugs reports to the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




--
music moves more than the maker


Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie






--
music moves more than the maker

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2011-04-06 15:51
FromVictor Lazzarini
SubjectRe: [Csnd] Question about fft and zero pad
yes, because unless your 8 samples are zero, the two are different  
signals. Thus they will yield two
different spectra; and by the way the 8 samples on their own are a  
third different signal, whose
spectrum is going to be different from padded and longer signals.

Sure, zeros are data; but they are different data than non-zero samples.

Victor
On 6 Apr 2011, at 15:33, Orazio Brancati wrote:

> so you are saying if we pad a signal with zeros is not the same as  
> add samples on it.
> That is, a window size made up of 8 sample + 8 zeroes is different  
> than a window size
> made up of 8 samples + 8 samples. It is right?

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-04-06 16:01
FromOrazio Brancati
SubjectRe: [Csnd] Question about fft and zero pad
> 
> Sure, zeros are data; but they are different data than non-zero samples.
> 

You mean that zeroes required less calculation (o no calculation?) 
respect to non-zero datas. It is right? 

Thank you very much for your kind attention.





Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-04-06 16:08
FromVictor Lazzarini
SubjectRe: [Csnd] Question about fft and zero pad
No, I don't mean that. I mean one reason to use zeros is when you want  
to
have a larger transform size, but don't have enough samples for that.


On 6 Apr 2011, at 16:01, Orazio Brancati wrote:

>>
>> Sure, zeros are data; but they are different data than non-zero  
>> samples.
>>
>
> You mean that zeroes required less calculation (o no calculation?)
> respect to non-zero datas. It is right?
>
> Thank you very much for your kind attention.
>
>
>
>
>
> Send bugs reports to the Sourceforge bug tracker
>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
> "unsubscribe csound"
>

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-04-06 16:30
FromOrazio Brancati
SubjectRe: [Csnd] Question about fft and zero pad
> No, I don't mean that. I mean one reason to use zeros is when you want to
> have a larger transform size, but don't have enough samples for that.

Indeed... this is the main point of my first question: you don't have samples,
but zeroes are samples, so how you can append zeros into the window???

Moreover, I know that zero pad is used also when you have enough samples.
It is used always, for example, in some programs who perform convolution...
In those cases you work at least with 44100 Hz and with windows sizes made up 
4096 samples or similars. 





















> 
> 
> On 6 Apr 2011, at 16:01, Orazio Brancati wrote:
> 
>>> 
>>> Sure, zeros are data; but they are different data than non-zero samples.
>>> 
>> 
>> You mean that zeroes required less calculation (o no calculation?)
>> respect to non-zero datas. It is right?
>> 
>> Thank you very much for your kind attention.
>> 
>> 
>> 
>> 
>> 
>> Send bugs reports to the Sourceforge bug tracker
>>           https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>> 
> 
> Dr Victor Lazzarini
> Senior Lecturer
> Dept. of Music
> NUI Maynooth Ireland
> tel.: +353 1 708 3545
> Victor dot Lazzarini AT nuim dot ie
> 
> 
> 
> 
> 
> Send bugs reports to the Sourceforge bug tracker
>           https://sourceforge.net/tracker/?group_id=81968&atid=564599
> 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 tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2011-04-06 16:40
FromVictor Lazzarini
SubjectRe: [Csnd] Question about fft and zero pad
I think appending zeros just means making sure the rest of the data is  
zero not something else that
would compromise your analysis.

For convolution, say your impulse is N size, then the size of the  
convolution output is 2N - 1. You
will need to zero pad to that length (at least) or to the next pow of  
two size (then discard any extra
samples beyong 2N - 1).

Victor

On 6 Apr 2011, at 16:30, Orazio Brancati wrote:

>
>> No, I don't mean that. I mean one reason to use zeros is when you  
>> want to
>> have a larger transform size, but don't have enough samples for that.
>
> Indeed... this is the main point of my first question: you don't  
> have samples,
> but zeroes are samples, so how you can append zeros into the window???
>
> Moreover, I know that zero pad is used also when you have enough  
> samples.
> It is used always, for example, in some programs who perform  
> convolution...
> In those cases you work at least with 44100 Hz and with windows  
> sizes made up
> 4096 samples or similars.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>>
>>
>> On 6 Apr 2011, at 16:01, Orazio Brancati wrote:
>>
>>>>
>>>> Sure, zeros are data; but they are different data than non-zero  
>>>> samples.
>>>>
>>>
>>> You mean that zeroes required less calculation (o no calculation?)
>>> respect to non-zero datas. It is right?
>>>
>>> Thank you very much for your kind attention.
>>>
>>>
>>>
>>>
>>>
>>> Send bugs reports to the Sourceforge bug tracker
>>>          https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>> Discussions of bugs and features can be posted here
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
>>> "unsubscribe csound"
>>>
>>
>> Dr Victor Lazzarini
>> Senior Lecturer
>> Dept. of Music
>> NUI Maynooth Ireland
>> tel.: +353 1 708 3545
>> Victor dot Lazzarini AT nuim dot ie
>>
>>
>>
>>
>>
>> Send bugs reports to the Sourceforge bug tracker
>>          https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> 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 tracker
>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
> "unsubscribe csound"
>

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-04-06 19:04
FromOrazio Brancati
SubjectRe: [Csnd] Question about fft and zero pad
Just for information... this article says the zero padding requires 
more samples: http://zone.ni.com/devzone/cda/tut/p/id/4880

As you can see, the duration of a sample is extended, giving
more data to the window (so more samples, more memory...).

You have to increase the input signal with zeros adding more samples.
So if you have an 8 samples input signal, you append zeros in its window
getting a windows size of 16 samples. 

Now, having 16 samples you can use a larger N of the probe phasor e^-iωkn/N.
This is vey important because when you have a larger N you can get lower
frequencies in you probe phasor. 

But it is also important living the input signal at 8 samples... I trying to 
explain it whit the following examples:


Example A)
Input signal: sine wave made up of 8 sample. 
So, the probe phasor will be also 8 sample long, thus its larger
period could be the same of the input signal.  


Example B)
Input signal: sine wave made up of 8 sample + 8 zeroes (16 samples in total).
So the probe phasor will be 16 sample long, thus its period could be
two times the ones of the input signal (it means a frequency lower by 1/2).

In the case of this last example B), you could multiply an input signal made of 8 
sample by a probe phasor which is 16 samples long. This causes an output
spectrum with better resolution. BUT....

...if you have a 16 samples input signal (without zeros) the result will be
different, because:


Example C)
Input signal: sine wave made up of 16 samples. So the probe phasor will be 16 sample 
long, thus its lower frequency it is THE SAME of the input signal. 


Making some calculation, I discover that those analysis in which the probe phasor
has a period twice longer than the input signal (which means with a frequency
lower than 1/2) are better.  

Please tell me what do you think about.
Thanks
OB  










Il giorno 06/apr/2011, alle ore 17.40, Victor Lazzarini ha scritto:

> I think appending zeros just means making sure the rest of the data is zero not something else that
> would compromise your analysis.
> 
> For convolution, say your impulse is N size, then the size of the convolution output is 2N - 1. You
> will need to zero pad to that length (at least) or to the next pow of two size (then discard any extra
> samples beyong 2N - 1).
> 
> Victor
> 
> On 6 Apr 2011, at 16:30, Orazio Brancati wrote:
> 
>> 
>>> No, I don't mean that. I mean one reason to use zeros is when you want to
>>> have a larger transform size, but don't have enough samples for that.
>> 
>> Indeed... this is the main point of my first question: you don't have samples,
>> but zeroes are samples, so how you can append zeros into the window???
>> 
>> Moreover, I know that zero pad is used also when you have enough samples.
>> It is used always, for example, in some programs who perform convolution...
>> In those cases you work at least with 44100 Hz and with windows sizes made up
>> 4096 samples or similars.
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> 
>>> 
>>> On 6 Apr 2011, at 16:01, Orazio Brancati wrote:
>>> 
>>>>> 
>>>>> Sure, zeros are data; but they are different data than non-zero samples.
>>>>> 
>>>> 
>>>> You mean that zeroes required less calculation (o no calculation?)
>>>> respect to non-zero datas. It is right?
>>>> 
>>>> Thank you very much for your kind attention.
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Send bugs reports to the Sourceforge bug tracker
>>>>         https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>>> Discussions of bugs and features can be posted here
>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>>> 
>>> 
>>> Dr Victor Lazzarini
>>> Senior Lecturer
>>> Dept. of Music
>>> NUI Maynooth Ireland
>>> tel.: +353 1 708 3545
>>> Victor dot Lazzarini AT nuim dot ie
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Send bugs reports to the Sourceforge bug tracker
>>>         https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>> 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 tracker
>>           https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>> 
> 
> Dr Victor Lazzarini
> Senior Lecturer
> Dept. of Music
> NUI Maynooth Ireland
> tel.: +353 1 708 3545
> Victor dot Lazzarini AT nuim dot ie
> 
> 
> 
> 
> 
> Send bugs reports to the Sourceforge bug tracker
>           https://sourceforge.net/tracker/?group_id=81968&atid=564599
> 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 tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2011-04-06 20:13
FromConor Dempsey
SubjectRe: [Csnd] Question about fft and zero pad
What you are saying is correct Orazio.. 
Essentially the amount of samples in your window directly determines the frequency resolution
When you pad with zeros it has the effect of distributing the data across the fft output differently 
meaning that correlation algorithms must know where to look in the output bins to find the relevant data.

Generally, when programming with a library such as fftw you will have to decide on which variables of the fourier transform 
algorithm you are using will remain constant for that pass of the probe phasor e.g. a standard window size.

Many algorithms for pitch detection or correlation that use the fourier transform will perform more than one pass of the fourier
transform to account for the data loss between consecutive windows and also to allow for different frequency resolution in the bins.

Check this out

Hope this helps,
Conor

On Wed, Apr 6, 2011 at 7:04 PM, Orazio Brancati <oraziobrancati@gmail.com> wrote:

Just for information... this article says the zero padding requires
more samples: http://zone.ni.com/devzone/cda/tut/p/id/4880

As you can see, the duration of a sample is extended, giving
more data to the window (so more samples, more memory...).

You have to increase the input signal with zeros adding more samples.
So if you have an 8 samples input signal, you append zeros in its window
getting a windows size of 16 samples.

Now, having 16 samples you can use a larger N of the probe phasor e^-iωkn/N.
This is vey important because when you have a larger N you can get lower
frequencies in you probe phasor.

But it is also important living the input signal at 8 samples... I trying to
explain it whit the following examples:


Example A)
Input signal: sine wave made up of 8 sample.
So, the probe phasor will be also 8 sample long, thus its larger
period could be the same of the input signal.


Example B)
Input signal: sine wave made up of 8 sample + 8 zeroes (16 samples in total).
So the probe phasor will be 16 sample long, thus its period could be
two times the ones of the input signal (it means a frequency lower by 1/2).

In the case of this last example B), you could multiply an input signal made of 8
sample by a probe phasor which is 16 samples long. This causes an output
spectrum with better resolution. BUT....

...if you have a 16 samples input signal (without zeros) the result will be
different, because:


Example C)
Input signal: sine wave made up of 16 samples. So the probe phasor will be 16 sample
long, thus its lower frequency it is THE SAME of the input signal.


Making some calculation, I discover that those analysis in which the probe phasor
has a period twice longer than the input signal (which means with a frequency
lower than 1/2) are better.

Please tell me what do you think about.
Thanks
OB










Il giorno 06/apr/2011, alle ore 17.40, Victor Lazzarini ha scritto:

> I think appending zeros just means making sure the rest of the data is zero not something else that
> would compromise your analysis.
>
> For convolution, say your impulse is N size, then the size of the convolution output is 2N - 1. You
> will need to zero pad to that length (at least) or to the next pow of two size (then discard any extra
> samples beyong 2N - 1).
>
> Victor
>
> On 6 Apr 2011, at 16:30, Orazio Brancati wrote:
>
>>
>>> No, I don't mean that. I mean one reason to use zeros is when you want to
>>> have a larger transform size, but don't have enough samples for that.
>>
>> Indeed... this is the main point of my first question: you don't have samples,
>> but zeroes are samples, so how you can append zeros into the window???
>>
>> Moreover, I know that zero pad is used also when you have enough samples.
>> It is used always, for example, in some programs who perform convolution...
>> In those cases you work at least with 44100 Hz and with windows sizes made up
>> 4096 samples or similars.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>>
>>>
>>> On 6 Apr 2011, at 16:01, Orazio Brancati wrote:
>>>
>>>>>
>>>>> Sure, zeros are data; but they are different data than non-zero samples.
>>>>>
>>>>
>>>> You mean that zeroes required less calculation (o no calculation?)
>>>> respect to non-zero datas. It is right?
>>>>
>>>> Thank you very much for your kind attention.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Send bugs reports to the Sourceforge bug tracker
>>>>         https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>>> Discussions of bugs and features can be posted here
>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>>>
>>>
>>> Dr Victor Lazzarini
>>> Senior Lecturer
>>> Dept. of Music
>>> NUI Maynooth Ireland
>>> tel.: +353 1 708 3545
>>> Victor dot Lazzarini AT nuim dot ie
>>>
>>>
>>>
>>>
>>>
>>> Send bugs reports to the Sourceforge bug tracker
>>>         https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>> 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 tracker
>>           https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>
>
> Dr Victor Lazzarini
> Senior Lecturer
> Dept. of Music
> NUI Maynooth Ireland
> tel.: +353 1 708 3545
> Victor dot Lazzarini AT nuim dot ie
>
>
>
>
>
> Send bugs reports to the Sourceforge bug tracker
>           https://sourceforge.net/tracker/?group_id=81968&atid=564599
> 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 tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




--
music moves more than the maker

Date2011-04-11 08:16
FromAndres Cabrera
SubjectRe: [Csnd] Question about fft and zero pad
Hi Orazio,

Something important to bear in mind is that as you increase the number
of samples for your window, you are taking a larger slice of time, so
you will have greater time smearing of the spectrum, i.e. you will
have better frequency resolution at the expense of time resolution.
One technique to work with this is to add zero padding to make a
larger fft window, which will give you better resolution in frequency
with less time smearing. This is not a perfect solution as you are not
really getting better resolution, as it is the equivalent of doing
interpolation of the frequency domain spectrum, it won't produce any
additional data.

Cheers,
Andres

On Wed, Apr 6, 2011 at 7:04 PM, Orazio Brancati
 wrote:
>
> Just for information... this article says the zero padding requires
> more samples: http://zone.ni.com/devzone/cda/tut/p/id/4880
>
> As you can see, the duration of a sample is extended, giving
> more data to the window (so more samples, more memory...).
>
> You have to increase the input signal with zeros adding more samples.
> So if you have an 8 samples input signal, you append zeros in its window
> getting a windows size of 16 samples.
>
> Now, having 16 samples you can use a larger N of the probe phasor e^-iωkn/N.
> This is vey important because when you have a larger N you can get lower
> frequencies in you probe phasor.
>
> But it is also important living the input signal at 8 samples... I trying to
> explain it whit the following examples:
>
>
> Example A)
> Input signal: sine wave made up of 8 sample.
> So, the probe phasor will be also 8 sample long, thus its larger
> period could be the same of the input signal.
>
>
> Example B)
> Input signal: sine wave made up of 8 sample + 8 zeroes (16 samples in total).
> So the probe phasor will be 16 sample long, thus its period could be
> two times the ones of the input signal (it means a frequency lower by 1/2).
>
> In the case of this last example B), you could multiply an input signal made of 8
> sample by a probe phasor which is 16 samples long. This causes an output
> spectrum with better resolution. BUT....
>
> ...if you have a 16 samples input signal (without zeros) the result will be
> different, because:
>
>
> Example C)
> Input signal: sine wave made up of 16 samples. So the probe phasor will be 16 sample
> long, thus its lower frequency it is THE SAME of the input signal.
>
>
> Making some calculation, I discover that those analysis in which the probe phasor
> has a period twice longer than the input signal (which means with a frequency
> lower than 1/2) are better.
>
> Please tell me what do you think about.
> Thanks
> OB
>
>
>
>
>
>
>
>
>
>
> Il giorno 06/apr/2011, alle ore 17.40, Victor Lazzarini ha scritto:
>
>> I think appending zeros just means making sure the rest of the data is zero not something else that
>> would compromise your analysis.
>>
>> For convolution, say your impulse is N size, then the size of the convolution output is 2N - 1. You
>> will need to zero pad to that length (at least) or to the next pow of two size (then discard any extra
>> samples beyong 2N - 1).
>>
>> Victor
>>
>> On 6 Apr 2011, at 16:30, Orazio Brancati wrote:
>>
>>>
>>>> No, I don't mean that. I mean one reason to use zeros is when you want to
>>>> have a larger transform size, but don't have enough samples for that.
>>>
>>> Indeed... this is the main point of my first question: you don't have samples,
>>> but zeroes are samples, so how you can append zeros into the window???
>>>
>>> Moreover, I know that zero pad is used also when you have enough samples.
>>> It is used always, for example, in some programs who perform convolution...
>>> In those cases you work at least with 44100 Hz and with windows sizes made up
>>> 4096 samples or similars.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>>
>>>>
>>>> On 6 Apr 2011, at 16:01, Orazio Brancati wrote:
>>>>
>>>>>>
>>>>>> Sure, zeros are data; but they are different data than non-zero samples.
>>>>>>
>>>>>
>>>>> You mean that zeroes required less calculation (o no calculation?)
>>>>> respect to non-zero datas. It is right?
>>>>>
>>>>> Thank you very much for your kind attention.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Send bugs reports to the Sourceforge bug tracker
>>>>>         https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>>>> Discussions of bugs and features can be posted here
>>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>>>>
>>>>
>>>> Dr Victor Lazzarini
>>>> Senior Lecturer
>>>> Dept. of Music
>>>> NUI Maynooth Ireland
>>>> tel.: +353 1 708 3545
>>>> Victor dot Lazzarini AT nuim dot ie
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Send bugs reports to the Sourceforge bug tracker
>>>>         https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>>> 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 tracker
>>>           https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>> Discussions of bugs and features can be posted here
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>>
>>
>> Dr Victor Lazzarini
>> Senior Lecturer
>> Dept. of Music
>> NUI Maynooth Ireland
>> tel.: +353 1 708 3545
>> Victor dot Lazzarini AT nuim dot ie
>>
>>
>>
>>
>>
>> Send bugs reports to the Sourceforge bug tracker
>>           https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> 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 tracker
>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
> 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 tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"