Re: [PD] fft beginner question

2007-12-21 Thread Mathieu Bouchard

On Fri, 23 Nov 2007, Martin Peach wrote:


So how do you measure the kinetic energy without calculating?
You could measure the displacement of a spring that absorbs the 
collision.


By doing that, you are converting kinetic energy to potential energy in 
order to measure it! You are assuming that specific displacements 
correspond to specific amounts of potential energy that exist once there 
is no kinetic energy left, at one point during the action of measuring, 
when the object is stationary and the displacement is at its biggest.


So, where is the potential energy that allows atoms to fall apart? 
Apparently it's stored as extra mass in the nucleus. If you snap a 
uranium235 with a neutron, it becomes a krypton92, a baryum141 and 
three neutrons. If you account the masses more precisely, which are not 
the above numbers, you get:

So, you can't measure the potential energy except by converting it to
kinetic energy...


No, I'm saying exactly the opposite, it can be weighted, as it's part of 
mass. Of course, weighting eventually involves some motion, but it doesn't 
have to be like throwing something at high speed.



Which is 0.186033... some fraction of a particle. Why is it?

You're forgetting the neutrinos which probably have a very small mass.


If scientists have that much trouble figuring out the mass of the 
neutrino, it might be because it's so small that it possibly can't account 
for any significant amount of this reaction. Anyway, a nuclear fission 
reaction is very much known to emit *plenty* of energy :) which you can't 
think of as being embodied by neutrinos because they very seldom interact 
with any matter at all. Neutrino detection equipment is all buried deep in 
the ground because the instruments are too sensitive, and they really need 
to be that sensitive, because neutrinos are so close to undetectable.


 _ _ __ ___ _  _ _ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-23 Thread Martin Peach
Mathieu Bouchard wrote:
 On Wed, 21 Nov 2007, Martin Peach wrote:

 Only the kinetic energy can be measured directly.
 The potential energy can only be calculated.

 So how do you measure the kinetic energy without calculating?

You could measure the displacement of a spring that absorbs the collision.


 There is no real instrument that can measure the potential energy

 So, where is the potential energy that allows atoms to fall apart? 
 Apparently it's stored as extra mass in the nucleus. If you snap a 
 uranium235 with a neutron, it becomes a krypton92, a baryum141 and 
 three neutrons. If you account the masses more precisely, which are 
 not the above numbers, you get:
So, you can't measure the potential energy except by converting it to 
kinetic energy...


   235.043930 + 1.008665 - 91.926156 - 140.914411 - 3*1.008665

 Which is 0.186033... some fraction of a particle. Why is it? It's 
 because that energy weighs something! 0.308915 
 gram of matter (above numbers were in nuclear units), times the square 
 of the base lightspeed (299792458 metres/second), is about 
 0.0002776 joule of energy, according to Einstein's most famous 
 equation. This can't be an (ordinary) particle, because nucleons are 
 all around 1 unit each, and electrons are all below 0.001 unit each.

You're forgetting the neutrinos which probably have a very small mass. A 
stationary electron has a mass equivalent to a photon of 5ll thousand 
electron-volts. A photon of red light is about 1eV. Photons have kinetic 
energy too, they can move dust about in space and lasers are used in the 
lab to move atoms. The equation E=mc^2 is equivalent to E=hv where h is 
(Planck's) constant and v is the photon frequency. Fundamentally, energy 
is nothing more than a rate of change; the more energy you have the 
faster you can change things.


 Is throwing a ball from a cliff different? (apart from differences of 
 scale!). I don't quite know. I know that Special Relativity says 
 kinetic energy increases mass, but I don't know (or don't remember) 
 what it is about gravitational energy.
Einstein's equivalence principle implies that gravity slows time and 
increases mass in the same way as velocity.

Martin

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-22 Thread Chuckk Hubbard
On Nov 22, 2007 12:33 PM, Chuckk Hubbard [EMAIL PROTECTED] wrote:
 On Nov 22, 2007 1:34 AM, Mathieu Bouchard [EMAIL PROTECTED] wrote:
  FFT can also be defined to only use real numbers, but the formulas are
  more complicated and the data layout is slightly irregular. Pd does not
  support those: it supports real-to-complex hybrids, just to avoid the

 If I run two rfft's from the same signal, and multiply the imaginary
 outputs, do I get negative squares?
 I'll see...

[osc~]
|
[rfft~]
   | \
   [*~]
|
   [tabsend~ foo]

gives all positive results...

-Chuckk

-- 
http://www.badmuthahubbard.com

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-22 Thread marius schebella
Hi,
in the rfft (as opposite to the fft) the missing dataset is supposed to 
be 0, that means if you think of a stereo channel as input, the second 
channel does not contain data/is muted. the missing data it is not 
related to time or index.
the information in both domains (time and frequency) is always exact the 
same.
marius.

Frank Barknecht wrote:
 Hallo,
 hard off hat gesagt: // hard off wrote:
 
 cos^2+sin^2=1
 ah!

 so, actually the FFT doesn't HAVE to use imaginary numbersbut they
 are just used because the complex-number system is
 two-dimensional and that signals to be analysed are presumed to be
 two-dimensional. They are decomposable into a sum of circular
 trajectories

 every day a bit more of this falls into place.
 
 An interesting thing to note is that the rfft outputs two signals,
 where seemingly only one signal comes in. How can that be?  Actually
 what comes into the rfft object are two values as well: One is the
 usual signal amplitude visible as a patch cord, and the other is:
 time!
 
 Time is not visible in Pd, it's just there and normally always walks
 on. But inside of a FFT-subpatch, time is frozen for the duration of a
 block (or rather: the current time is assumed to be infinite or
 eternal) to allow calculating a different representation: the
 frequency domain representation. If you think about this freezing of
 time for too long this is actually quite mind-blowing as well.
 
 Ciao


___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-22 Thread Georg Holzmann
marius schebella schrieb:
 Mathieu Bouchard wrote:
 
 this is actually cos^2+sin^2=1 in this context,
 
 these are not unity vextors, if you square the cosine and sine part you 
 don't get one, but a square of the amplitudes, so it is more 
 cos^2+sin^2=amplitude^2

hm, I don't really understand what you try to say here, but cos(x)^2 + 
sin(x)^2 is 1 !

LG
Georg

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-22 Thread marius schebella
Mathieu Bouchard wrote:

 this is actually cos^2+sin^2=1 in this context,

these are not unity vextors, if you square the cosine and sine part you 
don't get one, but a square of the amplitudes, so it is more 
cos^2+sin^2=amplitude^2

marius.

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-22 Thread marius schebella
I try to say, that the results you get from an fft or rfft are the 
cosine and sine portion of the signal (one value per frequency) in the 
frequency domain. (also referred to as real and imag part.
but if you square them, you will not get 1 for each frequency but the 
amplitude.
so cos(f1)^2+sin(f1)^2=amplitude(f1)^2.
marius.

Georg Holzmann wrote:
 marius schebella schrieb:
 Mathieu Bouchard wrote:

 this is actually cos^2+sin^2=1 in this context,

 these are not unity vextors, if you square the cosine and sine part 
 you don't get one, but a square of the amplitudes, so it is more 
 cos^2+sin^2=amplitude^2
 
 hm, I don't really understand what you try to say here, but cos(x)^2 + 
 sin(x)^2 is 1 !
 
 LG
 Georg
 


___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-22 Thread Mathieu Bouchard

On Thu, 22 Nov 2007, marius schebella wrote:


Mathieu Bouchard wrote:

this is actually cos^2+sin^2=1 in this context,
these are not unity vextors, if you square the cosine and sine part you don't 
get one, but a square of the amplitudes, so it is more 
cos^2+sin^2=amplitude^2


i mean cos and sin the functions, not the components. You get the 
component equation by multiplying the whole equation by amplitude^2. I 
said it as cos^2+sin^2=1 because that's the trigonometric identity as 
taught in grade 11 or so.


 _ _ __ ___ _  _ _ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-22 Thread Mathieu Bouchard

On Thu, 22 Nov 2007, Chuckk Hubbard wrote:

If I run two rfft's from the same signal, and multiply the imaginary
outputs, do I get negative squares?
I'll see...


Pd does not support Complex numbers directly, and so any Complex signal is 
represented as two Real signals, in which you have to do all the Real 
operations yourself. It's worth making abstractions that do it for you, 
but you still have to connect twice the cables.


If Pd supported Complex numbers directly, there would be only one inlet 
and one outlet in plain [fft~], and you'd be able to use [*~] or perhaps a 
new [complex*~] to handle this multiplication with one inlet and one 
outlet.


A single-object way to make the complex product is:

  [expr $v1*$v3-$v2*$v4;$v1*$v4+$v2*$v3]

And then you can see that only plugging the same value in both imaginary 
inputs ($v2 and $v4) gives a real output of minus the square, and an 
imaginary output of 0.


 _ _ __ ___ _  _ _ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-22 Thread Mathieu Bouchard

On Wed, 21 Nov 2007, Kyle Klipowicz wrote:


Even more interesting to me is when my physicist friend told me that
the Uncertainty Principle is deeply rooted in the trade off between
time window size and frequency resolution of the FFT. Kinda
demystifies a whole decade of my life...


That's quite true. It's not about FFT in particular, it's about all of 
Fourier methods, and even several other signal decomposition methods than 
Fourier. It's about how you can only begin to know a wave by sampling it 
at least twice, and the lower the frequency you are trying to extract from 
it, the longer the delay between the two samples has to be.


Heisenberg's uncertainty principle is not specific to Quantum Theory, it's 
central to the sampling of all wave-like phenomena and more.


If you modify FFT somewhat, you can blow up blocks into little pieces, in 
which each frequency is updated exactly as fast as the uncertainty 
principle allows it, but I have the impression that it's quite more 
complicated to handle, so I never really looked into it.


 _ _ __ ___ _  _ _ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-22 Thread Mathieu Bouchard

On Wed, 21 Nov 2007, Martin Peach wrote:


Only the kinetic energy can be measured directly.
The potential energy can only be calculated.


So how do you measure the kinetic energy without calculating?


There is no real instrument that can measure the potential energy


So, where is the potential energy that allows atoms to fall apart? 
Apparently it's stored as extra mass in the nucleus. If you snap a 
uranium235 with a neutron, it becomes a krypton92, a baryum141 and three 
neutrons. If you account the masses more precisely, which are not the 
above numbers, you get:


  235.043930 + 1.008665 - 91.926156 - 140.914411 - 3*1.008665

Which is 0.186033... some fraction of a particle. Why is it? It's because 
that energy weighs something! 0.308915 gram of 
matter (above numbers were in nuclear units), times the square of the base 
lightspeed (299792458 metres/second), is about 0.0002776 joule of 
energy, according to Einstein's most famous equation. This can't be an 
(ordinary) particle, because nucleons are all around 1 unit each, and 
electrons are all below 0.001 unit each.


Is throwing a ball from a cliff different? (apart from differences of 
scale!). I don't quite know. I know that Special Relativity says kinetic 
energy increases mass, but I don't know (or don't remember) what it is 
about gravitational energy.


 _ _ __ ___ _  _ _ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-21 Thread hard off
ah cheers frank, thanks for clearing a lot of that up.  you do really
good explainations.


The main reason we use complex numbers in electronic music is
 because they magically automate trigonometric calculations. We
 frequently have to add angles together in order to talk about the
 changing phase of an audio signal as time progresses (or as it is
 shifted in time, as in this chapter). It turns out that, if you
 multiply two complex numbers, the argument of the product is the sum
 of the arguments of the two factors.

so, is that where 'fast' fourier transform comes from then?

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-21 Thread Thomas Mayer
hard off wrote:
 ah cheers frank, thanks for clearing a lot of that up.  you do really
 good explainations.
 
 
 The main reason we use complex numbers in electronic music is
  because they magically automate trigonometric calculations. We
  frequently have to add angles together in order to talk about the
  changing phase of an audio signal as time progresses (or as it is
  shifted in time, as in this chapter). It turns out that, if you
  multiply two complex numbers, the argument of the product is the sum
  of the arguments of the two factors.
 
 so, is that where 'fast' fourier transform comes from then?

Not really, as multiplication is one mathematical operation. 'Fast' in
FFT means reducing the number of mathematical operation from O(N²) to
O(N log N), where N is the number of analyzed frequencies, e.g. for 64
frequencies from (a constant factor times) 64²=4096 to (another constant
factor times) 64 * log(64)~116 operations.

cu Thomas
-- 
Prisons are needed only to provide the illusion that courts and police
are effective. They're a kind of job insurance.
(Leto II. in: Frank Herbert, God Emperor of Dune)
http://thomas.dergrossebruder.org/

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-21 Thread Georg Holzmann
Hallo!

 The main reason we use complex numbers in electronic music is
  because they magically automate trigonometric calculations. We
  frequently have to add angles together in order to talk about the
  changing phase of an audio signal as time progresses (or as it is
  shifted in time, as in this chapter). It turns out that, if you
  multiply two complex numbers, the argument of the product is the sum
  of the arguments of the two factors.
 
 so, is that where 'fast' fourier transform comes from then?

No - the term fast fourier transform comes from the special algorithm 
how the DFT (discrete fourier transform) is calculated (see e.g. 
http://en.wikipedia.org/wiki/Fft)

LG
Georg

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-21 Thread cristiano figueirÿfffff3
Hi, thanks for help everyone. Now it's much more
clear. I downloaded the Beginner's Guide to the
FFT-objects in Pd from Frank
(http://footils.org/pkg/fft-tut.tgz). And have some
more questions:


- working on patch fft-up-close.pd:
I have a blocksize=8 and a samplerate=44100 and all
analysis have been printed here:

orig:
0.13004  0.26951  0.40352  0.52934  0.64446  0.74649 
0.83341  0.90344 
img:
01.0317   0.41678  0.17191  00   
00   
re:
4.4602   -0.58717 -0.46243 -0.44167 -0.43735 0   
00   
amp:
4.4602   1.1871   0.62253  0.47395  0.43735  0   
00   
amp-normal:
0.27876  0.074192 0.038908 0.029622 0.027334 0   
00   
after-fft:
0.13004  0.26951  0.40352  0.52934  0.64446  0.74649 
0.83341  0.90344 


= Ok, with a block of 8 i have data control over 4
partials from the incoming signal rigth? The
frequencies are given by multiples of
Samplerate/blocksize, starting on F0= 0hz , that's
rigth?
So, my question is about the normalized
amplitudes(amp-normal):

1) Why the first is so loud? This is not the F0 (0
hz)?

2) With the normalized amplitudes i can estimate wich
partials are more relevants to the resynthesis (wich
partials are more louder in a particular
spectrum/audio)? Is this rigth?

- working on specgate~.pd

1) My Pd (vanilla 0-40.2, on debian) don't recognize
the [~] object, isn't a native object? Case not where
i download this object?

thanks for all.

cristiano


  Abra sua conta no Yahoo! Mail, o único sem limite de espaço para 
armazenamento!
http://br.mail.yahoo.com/

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-21 Thread Mathieu Bouchard

On Wed, 21 Nov 2007, hard off wrote:

and so on...always until you reach half the sample rate.  ..i think you 
also get info on 0hz, and i guess that is also somehow important when it 
comes to resynthesis, but i'm not too sure if or how or why.


it may seem like 0hz is useless, as it is inaudible, but that's only if 
you keep it constant. at a block size of 64 and CD quality, you can make 
a 344hz square wave just by toggling the value of the 0hz component.


in any decomposition in which the first harmonic is 689hz, any frequency 
between 0hz and 689hz needs to make waves in the history of the 0hz 
component to make it sound like the desired number of hz. Any frequency 
that is not a harmonic will also use pretty much all of the spectrum 
(usually at least a little of each frequency) in order to simulate 
whatever piece of wave happens to be in the current block.


but i think the reason why you get a real part and an imaginary part is 
because the analysis finds the angle between one sample and the next 
one.  ..if it's a steep angle, then that's a high frequency...if it's a 
flatter angle, then that's a lower frequency.


No. Real stands for Cosine and Imaginary stands for Sine, as those 
coefficients are those of an Euler (complex-number) exponential. Those 
values are made by multiplying the amplitude by the cosine and sine of the 
phase.



and the way to find an angle is derived from pythagoras' equationa^2+b^2=c^2


this is actually cos^2+sin^2=1 in this context, and it helps getting back 
to the amplitude by removing the phase (angle).


To get the phase, you need to use atan2 or atan or a complex-number 
logarithm.



so...that works fine when the samples lie above the zero axis...but
when they go below the zero axis, then to get the angle you have to
take the square route of a negative number.  hence the imaginary part.


The imaginary numbers are because the complex-number system is 
two-dimensional and that signals to be analysed are presumed to be 
two-dimensional. They are decomposable into a sum of circular 
trajectories. In complex-numbers, circles are made by giving an imaginary 
argument to an exponential (this is one of the most mind-blowing and most 
useful parts of calculus, at the same time).


 _ _ __ ___ _  _ _ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-21 Thread hard off
cos^2+sin^2=1

ah!

so, actually the FFT doesn't HAVE to use imaginary numbersbut they
are just used because the complex-number system is
two-dimensional and that signals to be analysed are presumed to be
two-dimensional. They are decomposable into a sum of circular
trajectories

every day a bit more of this falls into place.

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-21 Thread Mathieu Bouchard

On Tue, 20 Nov 2007, Frank Barknecht wrote:


I still don't exactly understand why one couldn't just use (x, y)
vectors;

You *are* just using (x,y) rsp. (angle, radius) vectors. You can
completely ignore the meaning of i as sqrt(-1) and just view i as
the funny name of the second axis in a 2d-coordinate system.


You can see i as a 90-degree rotation, that turns x-axis values into 
y-axis values, and y-axis values into negated x-axis values, and so on.


 _ _ __ ___ _  _ _ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-21 Thread Frank Barknecht
Hallo,
hard off hat gesagt: // hard off wrote:

 cos^2+sin^2=1
 
 ah!
 
 so, actually the FFT doesn't HAVE to use imaginary numbersbut they
 are just used because the complex-number system is
 two-dimensional and that signals to be analysed are presumed to be
 two-dimensional. They are decomposable into a sum of circular
 trajectories
 
 every day a bit more of this falls into place.

An interesting thing to note is that the rfft outputs two signals,
where seemingly only one signal comes in. How can that be?  Actually
what comes into the rfft object are two values as well: One is the
usual signal amplitude visible as a patch cord, and the other is:
time!

Time is not visible in Pd, it's just there and normally always walks
on. But inside of a FFT-subpatch, time is frozen for the duration of a
block (or rather: the current time is assumed to be infinite or
eternal) to allow calculating a different representation: the
frequency domain representation. If you think about this freezing of
time for too long this is actually quite mind-blowing as well.

Ciao
-- 
 Frank Barknecht _ __footils.org__

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-21 Thread Martin Peach
Frank Barknecht wrote:
hard off hat gesagt: // hard off wrote:

 
  so, actually the FFT doesn't HAVE to use imaginary numbersbut they
  are just used because the complex-number system is
  two-dimensional and that signals to be analysed are presumed to be
  two-dimensional. They are decomposable into a sum of circular
  trajectories
 
  every day a bit more of this falls into place.

An interesting thing to note is that the rfft outputs two signals,
where seemingly only one signal comes in. How can that be?  Actually
what comes into the rfft object are two values as well: One is the
usual signal amplitude visible as a patch cord, and the other is:
time!

Time is not visible in Pd, it's just there and normally always walks
on. But inside of a FFT-subpatch, time is frozen for the duration of a
block (or rather: the current time is assumed to be infinite or
eternal) to allow calculating a different representation: the
frequency domain representation. If you think about this freezing of
time for too long this is actually quite mind-blowing as well.


I think it's more like:
The real part represents the energy you can measure and the imaginary part 
is the part you can't measure. They oscillate back and forth but combine to 
make a constant as long as the amplitude is constant. That way the energy of 
the system is conserved and doesn't periodically magically disappear and 
reappear. It's the same as the idea that total energy is conserved but is 
made up of kinetic and potential components. Only the kinetic energy can be 
measured directly. The potential energy can only be calculated. Say if you 
stand at the top of a cliff you have a potential energy that is equal to the 
kinetic energy you would have if you fell to the bottom. There is no real 
instrument that can measure the potential energy so it's imaginary in a 
sense, but the kinetic energy can be measured directly, so it's real.

Martin



___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-21 Thread Kyle Klipowicz
Even more interesting to me is when my physicist friend told me that
the Uncertainty Principle is deeply rooted in the trade off between
time window size and frequency resolution of the FFT. Kinda
demystifies a whole decade of my life...

~Kyle

On Nov 21, 2007 12:21 PM, Frank Barknecht [EMAIL PROTECTED] wrote:


 Time is not visible in Pd, it's just there and normally always walks
 on. But inside of a FFT-subpatch, time is frozen for the duration of a
 block (or rather: the current time is assumed to be infinite or
 eternal) to allow calculating a different representation: the
 frequency domain representation. If you think about this freezing of
 time for too long this is actually quite mind-blowing as well.

-- 
-

 -
  - --
http://perhapsidid.wordpress.com
http://myspace.com/kyleklipowicz

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-21 Thread Mathieu Bouchard

On Thu, 22 Nov 2007, hard off wrote:


cos^2+sin^2=1

ah!
so, actually the FFT doesn't HAVE to use imaginary numbersbut they
are just used because the complex-number system is
two-dimensional and that signals to be analysed are presumed to be
two-dimensional. They are decomposable into a sum of circular
trajectories


FFT can also be defined to only use real numbers, but the formulas are 
more complicated and the data layout is slightly irregular. Pd does not 
support those: it supports real-to-complex hybrids, just to avoid the 
irregularity (I mean: DC and Nyquist are special; and you'd have to put 
both cosines and sines in the same block in order to really have only 
one signal input). Because of the irregularity, you'd need to have 
FFT-specific signal objects that understand the FFT blocks and can handle 
their values correctly.


So, in the end, complex numbers may be complex, but real numbers are 
complicated.


 _ _ __ ___ _  _ _ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-21 Thread Mathieu Bouchard

On Wed, 21 Nov 2007, Frank Barknecht wrote:

Actually what comes into the rfft object are two values as well: One is 
the usual signal amplitude visible as a patch cord, and the other is: 
time!


I don't think that you can think of the time dimension as a value of what 
comes into the object: I'd say that it is the index of the amplitude. Only 
amplitude is transmitted: time is part of the structure of the actual 
transmission, not the content.


Anyway, that idea would make the complex fft take three inputs: real, 
imaginary, and time.


What [rfft~] does is assume a zero imaginary part. There's a special 
version of the FFT algorithm that is only a slight optimisation because it 
can assume that the imaginary input is zero. [rifft~] can assume that the 
imaginary output is zero or maybe just not wanted, so it can make 
different optimisations.


 _ _ __ ___ _  _ _ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-21 Thread Mathieu Bouchard

On Tue, 20 Nov 2007, cristiano figueirÿf3 wrote:


-39.604  00000


It's -39.604 because you changed the frequency of [osc~] while it was 
running, so it froze in whichever position it was. If you want to get a 
true 0 Hz at the amplitude you want, you have to reset the phase. This 
behaviour is normal and wanted, as it allows to remove the clicks from 
changes between any pair of nonzero frequencies.


 _ _ __ ___ _  _ _ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-21 Thread Mathieu Bouchard

On Wed, 21 Nov 2007, Thomas Mayer wrote:


Not really, as multiplication is one mathematical operation. 'Fast' in
FFT means reducing the number of mathematical operation from O(N²) to
O(N log N), where N is the number of analyzed frequencies, e.g. for 64
frequencies from (a constant factor times) 64²=4096 to (another constant
factor times) 64 * log(64)~116 operations.


When computing orders, multiplication constants are ignored, so log bases 
don't matter. However, if you want to know the exact number of operations, 
you have to know that the FFT for powers-of-two needs 2*log2(64)*64 
operations, which is 768.


Using the same trick of algorithm for non-powers of two, you can realise 
that log2 was only a special case: in general, the number of passes is 
the sum of the prime factors of the block size, so for size 63 you 
need 13*64 steps and for size 65 you need 18*64 steps, and various other 
numbers vary immensely. There are some other variants of FFT that are 
better for some of the worst cases of size, but not all of them.


And then those operations are just the complex multiplications: you 
also have to do complex additions, and those operations also have 
sub-operations.


 _ _ __ ___ _  _ _ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-20 Thread Frank Barknecht
Hallo,
cristiano figueirÿf3 hat gesagt: // cristiano figueirÿf3 wrote:

 Hi list, i'm trying to study fft in Pd and still don't
 understand the numbers produced by the analysis.

You maybe want to start with my Beginner's Guide to the FFT-objects
in Pd at http://footils.org/cms/show/60 for a very informal
introduciton, and then also read the URLs linked from there. And
Miller's Techniques ... book is good as well, but a bit more
advanced.

Ciao
-- 
 Frank Barknecht _ __footils.org__

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-20 Thread hard off
http://www.vlf.it/fft_beginners/fft_beginners.html

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-20 Thread hard off
actually, that didn't help much at all...sorry.

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-20 Thread hard off
so, i don't know too much about fft, but here's what i can gather.
hopefully some people who actually understand it can explain where i
am wrong:

fft analyzes a 'block' of samples.  a block is just a section of
consecutive samples.  pd's default block size is 64 samples, which is
why you get 64 numbers for each FFT analysis in pd with default block
size.

the maximum frequency fft analysis will give you is half of your
sampling rate.

for a block size of 2, the only frequency FFT tells you about is half
the samplerate (SR/2)

for a block size of 4, FFT can then tell you about SR/4 and
2xSR/4..so, for a sampling rate of 44100hz, you'd get info on 11025
and 22050 hz

for a block size of 8, you can now find out about 4 frequencies:
SR/8, 2xSR/8, 3xSR/8, 4xSR/8   (ie, 5512, 11025, 16538, 22050)

for a block size of 16, you can find out about SR/16, 2xSR/16,
3xSR/16, 4xSR/16, 5xSR/16, 6xSR/16, 7xSR/16, and 8xSR/16

and so on...always until you reach half the sample rate.  ..i think
you also get info on 0hz, and i guess that is also somehow important
when it comes to resynthesis, but i'm not too sure if or how or why.


once you get up to a block of 64 or 128 samples or more, you start to
get pretty good info on the basic waves which make up that block of
samples.




i'm really not sure about this next bit...but i think the reason why
you get a real part and an imaginary part is because the analysis
finds the angle between one sample and the next one.  ..if it's a
steep angle, then that's a high frequency...if it's a flatter angle,
then that's a lower frequency.

and the way to find an angle is derived from pythagoras' equationa^2+b^2=c^2

so...that works fine when the samples lie above the zero axis...but
when they go below the zero axis, then to get the angle you have to
take the square route of a negative number.  hence the imaginary part.




i could be way off the mark here,.,,,but that's just what i could guess.

pd uber pro's.. how wrong am I?

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-20 Thread Chuckk Hubbard
On Nov 20, 2007 5:39 PM, Frank Barknecht [EMAIL PROTECTED] wrote:
 For some calculations polar, for others cartesian coordinates are
 easier to use. To quote Miller:

   The main reason we use complex numbers in electronic music is
   because they magically automate trigonometric calculations. We
   frequently have to add angles together in order to talk about the
   changing phase of an audio signal as time progresses (or as it is
   shifted in time, as in this chapter). It turns out that, if you
   multiply two complex numbers, the argument of the product is the sum
   of the arguments of the two factors.

I still don't exactly understand why one couldn't just use (x, y)
vectors; why the y value has to be multiplied by something imaginary.
I mean, i/j is *defined as* the square root of -1, but it can't really
*be* the square root of -1...  I've accepted it and moved on to more
practical questions, but that is still mysterious for me.

-Chuckk
-- 
http://www.badmuthahubbard.com

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-20 Thread Frank Barknecht
Hallo,
hard off hat gesagt: // hard off wrote:

 i'm really not sure about this next bit...but i think the reason why
 you get a real part and an imaginary part is because the analysis
 finds the angle between one sample and the next one.  ..if it's a
 steep angle, then that's a high frequency...if it's a flatter angle,
 then that's a lower frequency.

That's not quite correct. The data, that the FFT gives you, not only
has the frequency content of a block encoded, but also the phase. In
my little tutorial I compare it to a bank of [osc~] objects that are
tuned in fixed integer multiples of SR/blocksize from 0 to SR/2, where
FFT gives you the amplitude of each osc~ plus its phase (second inlet
of [osc~]).

So we're dealing not with single numbers here, but with pairs of
numbers that specify how loud and at which phase the osc~ sounds.
Pairs of numbers are like coordinates into a 2-dimensional space. They
could be cartesian (x and y) or polar (angle and radius).  Complex
numbers are just pairs of numbers as well. FFT gives out cartesian
coordinates (re = x, im = y) that are connected to phase and
magnitude, if you view the latter as the respective polar coordinates
for that fft-bin.

To convert from cartesian to polar you can use:

magn = sqrt(re^2 + im^2) -- cf. pythagoras here
phs  = arctan(im/re)

You can convert back as well using similar formula.

Why does FFT give cartesian coordinates? Well, as you can convert
between both representations it could give polar directly as well.
(You could make a little abstractions to get a polar [fft~] object.)
For some calculations polar, for others cartesian coordinates are
easier to use. To quote Miller:

  The main reason we use complex numbers in electronic music is
  because they magically automate trigonometric calculations. We
  frequently have to add angles together in order to talk about the
  changing phase of an audio signal as time progresses (or as it is
  shifted in time, as in this chapter). It turns out that, if you
  multiply two complex numbers, the argument of the product is the sum
  of the arguments of the two factors. 

  http://crca.ucsd.edu/~msp/techniques/latest/book-html/node105.html

Argument is the angle here.

Ciao
-- 
 Frank Barknecht _ __footils.org__

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-20 Thread Thomas Mayer
Chuckk Hubbard wrote:
 On Nov 20, 2007 5:39 PM, Frank Barknecht [EMAIL PROTECTED] wrote:
 For some calculations polar, for others cartesian coordinates are
 easier to use. To quote Miller:

   The main reason we use complex numbers in electronic music is
   because they magically automate trigonometric calculations. We
   frequently have to add angles together in order to talk about the
   changing phase of an audio signal as time progresses (or as it is
   shifted in time, as in this chapter). It turns out that, if you
   multiply two complex numbers, the argument of the product is the sum
   of the arguments of the two factors.
 
 I still don't exactly understand why one couldn't just use (x, y)
 vectors; why the y value has to be multiplied by something imaginary.
 I mean, i/j is *defined as* the square root of -1, but it can't really
 *be* the square root of -1...  I've accepted it and moved on to more
 practical questions, but that is still mysterious for me.

Everything in mathematics *is* so if *definined*. You could define your
own mathematics by saying there are no two straight lines that do not
subtend (no parallels). In fact, Riemann did so, and has created a
geometry different from Euklidean, which is the basis for calculation on
a sphere (straight lines - great circles).

http://en.wikipedia.org/wiki/Non-Euclidean_geometry

It does not matter, if it stresses your personal experience, as long
as it does not contradict other definitions in your mathematics.
Negative numbers were a great problem to mathematicians as well:

European mathematicians however, for the most part, resisted the concept
of negative numbers until the 17th century, although Fibonacci allowed
negative solutions in financial problems where they could be interpreted
as debits (chapter 13 of Liber Abaci, 1202) and later as losses (in
Flos). At the same time, the Chinese were indicating negative numbers by
drawing a diagonal stroke through the right-most non-zero digit. The
first use of negative numbers in a European work was by Chuquet during
the 15th century. He used them as exponents, but referred to them as
“absurd numbers”.

http://en.wikipedia.org/wiki/Negative_and_non-negative_numbers#First_usage_of_negative_numbers

cu Thomas
-- 
Prisons are needed only to provide the illusion that courts and police
are effective. They're a kind of job insurance.
(Leto II. in: Frank Herbert, God Emperor of Dune)
http://thomas.dergrossebruder.org/

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-20 Thread cristiano figueirÿfffff3
Hi, thanks for help, now i'm begining to understand :)


hard off:

pd's default block size is 64 samples, which is
why you get 64 numbers for each FFT analysis in pd
with default block
size.

ok, that i understand, i'll make some tests with this
value...to modify the default i call the block~ object
rigth?

Complex
numbers are just pairs of numbers as well. FFT gives
out cartesian
coordinates (re = x, im = y) that are connected to
phase and
magnitude, if you view the latter as the respective
polar coordinates
for that fft-bin.

So, each pair is one number from real and the
respective from imaginary? (the first from real and
first from imag. for example?).

In my example, when i first select the frequency
0(hertz) for my osc~ (who is gonna be analyzed) why
this number (-39.604) appears?

real:
-39.604  00000   
00   
000000   
00   
000000   
00   
000000   
00   
000000   
00   
000000   
00   
000000   
00   
000000   
00   
imaginary:
0-0   -0   -0   -0   -0  
-0   -0  
-0   -0   -0   -0   -0   -0  
-0   -0  
-0   -0   -0   -0   -0   -0  
-0   -0  
-0   -0   -0   -0   -0   -0  
-0   -0  
000000   
00   
000000   
00   
000000   
00   
000000   
00   

thanks
cristiano


  Abra sua conta no Yahoo! Mail, o único sem limite de espaço para 
armazenamento!
http://br.mail.yahoo.com/

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-20 Thread Frank Barknecht
Hallo,
Chuckk Hubbard hat gesagt: // Chuckk Hubbard wrote:

 I still don't exactly understand why one couldn't just use (x, y)
 vectors; 

You *are* just using (x,y) rsp. (angle, radius) vectors. You can
completely ignore the meaning of i as sqrt(-1) and just view i as
the funny name of the second axis in a 2d-coordinate system. Instead
of calling one axis the x-axis and the other the y-axis you call one
axis the real and the other the imaginary axis. That's all there is to
it. It's nothing complex (pun intended).

Ciao
-- 
 Frank Barknecht _ __footils.org__

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] fft beginner question

2007-11-20 Thread Frank Barknecht
Hallo,
cristiano figueirÿf3 hat gesagt: // cristiano figueirÿf3 wrote:

 ok, that i understand, i'll make some tests with this
 value...to modify the default i call the block~ object
 rigth?

Yes, just use [block~ 8] or so to get less output.

 Complex numbers are just pairs of numbers as well. FFT gives out
 cartesian coordinates (re = x, im = y) that are connected to phase
 and magnitude, if you view the latter as the respective polar
 coordinates for that fft-bin.

 So, each pair is one number from real and the
 respective from imaginary? (the first from real and
 first from imag. for example?).
 
 In my example, when i first select the frequency
 0(hertz) for my osc~ (who is gonna be analyzed) why
 this number (-39.604) appears?

 real:
 -39.604  00000   
 00   
 000000   
 00   
... 
 imaginary:
 0-0   -0   -0   -0   -0  
 -0   -0  
 -0   -0   -0   -0   -0   -0  
...

The number is the real part of your first osc~ with frequency 0,
that is: the DC offset. The first osc~ of the bank actually would
be a sig~ in Pd: it doesn't change over time because its frequency
is 0.

If you would connect a [sig~ 1] to [rfft~] and print it, then you'd
get all zeros everywhere except in the first real value, where you'd
get the blocksize (like 8 or 64 or so). You don't get 1, because the
[rfft~] isn't normalized. If you connect a [sig~ 0.5] you'd get
blocksize/2 in the first real bin, and with [sig~ -1] you get
-(blocksize).

Using amp = sqrt(re^2 + im^2) you can calculate the amplitude of your
signal manually from re and im as well and would get e.g. 8 for [sig~
1] at [block~ 8] (which is unnormalized again). The phase is
arctan(im/re) or arctan(0/bs) = 0, which is okay for a DC signal.

Ciao
-- 
 Frank Barknecht _ __footils.org__

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


[PD] fft beginner question

2007-11-19 Thread cristiano figueirÿfffff3
Hi list, i'm trying to study fft in Pd and still don't
understand the numbers produced by the analysis.
I'm on Pd vanilla 0-40.2 in debian. I just patch
this:

[float]
|\
| \
[osc~] \
|   \
|[bang]
|/
[rfft~] / | 
 \ \  | 
  \   / \ |
   \ /  [print~ imaginary]
[print~ real]

and then type 0 and 1 in float box and this
analysis came to terminal:


real:
-39.604  00000   
00   
000000   
00   
000000   
00   
000000   
00   
000000   
00   
000000   
00   
000000   
00   
000000   
00   
imaginary:
0-0   -0   -0   -0   -0  
-0   -0  
-0   -0   -0   -0   -0   -0  
-0   -0  
-0   -0   -0   -0   -0   -0  
-0   -0  
-0   -0   -0   -0   -0   -0  
-0   -0  
000000   
00   
000000   
00   
000000   
00   
000000   
00   
real:
-39.378  -0.003371 -0.0035941 -0.0035693 -0.0035941
-0.0035851 -0.0035941 -0.0035895
-0.003594 -0.0035913 -0.0035941 -0.0035921 -0.0035932
-0.0035928 -0.003594 -0.0035931
-0.0035944 -0.0035932 -0.0035941 -0.0035934 -0.0035943
-0.0035935 -0.0035942 -0.0035938
-0.0035943 -0.0035935 -0.003594 -0.0035933 -0.0035941
-0.0035936 -0.0035942 -0.0035935
-0.0035934 00000  
 00   
000000   
00   
000000   
00   
000000   
00   
imaginary:
00.07316  0.036492 0.02423  0.018069 0.014348
0.011848 0.010045
0.0086772 0.007599 0.0067242 0.0059963 0.0053794
0.0048461 0.0043795 0.0039655
0.0035944 0.0032576 0.0029496 0.0026656 0.0024016
0.0021543 0.0019211 0.0016999
0.0014889 0.0012859 0.00109  0.00090034 0.00071485
0.00053315 0.00035397 0.00017647
000000   
00   
000000   
00   
000000   
00   
000000   
00  





What this numbers represents ? Where i can study more?
thanks

cristiano 



  Abra sua conta no Yahoo! Mail, o único sem limite de espaço para 
armazenamento!
http://br.mail.yahoo.com/

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list