Chuck! thanks a lot for your explanation, and yes, your solution of mixing is definitely easier. I wanted to take another look at the same issue to begin studying the fft functions.
Ill take a deep look into your explanation of fft and ifft. It gives me the complete picture.
dan
to use the ifft for synthesis, you need to know the amplitude and
phase for each frequency, and you need to express it as a complex
number.
z=a+b*i, a=Amp*cos(phase) and b=Amp*sin(phase)
fft~ gives two outlets, the left is the real part of the fourier
transform, the right is the imaginary part.
next thing is, the second half of your fourier coefficients are
complex conjugates of your first half (when dealing with real-valued
signals) according to the following pattern
F(0) is real (the imaginary part is zero) and so is F(N/2)
F(1)=F(N-1)* where * denotes conjugate
F(2)=F(N-2)*
...
F(N/2-1)=F(N/2+1)*
for a block size of 64,
you've got 33 distinct real values (0 to N/2)
and 31 distinct imaginary values (1 to N/2-1)
to calculate before packing them all up into signals
and there's some limitations. To do things cleanly all of your
frequencies need to be ingeter multiples of (sampling freq. fs/ N),
the lowest frequency you can achieve with Fourier series on N points
Luckily, your sawtooth and square waves are made up of frequencies in
just this way. But you're still limited to JUST the frequencies in
your fourier transform (fs/N, 2*fs/N, 3*fs/N, ..., N/2 * fs/N)
It's probably not the best way to do it, for what you're describing.
You want to be able to continuously mix different levels of your saw,
sine and squares as a function of time, right?
I think you'll have better luck by just sync'ing up a phasor~ and an
osc~, and creating your square wave (in phase) by using >~ and <~ on
osc~ and summing the outputs together like
[osc~]
| \
[>~][<~]
| |
| [*~] [sig~ -1]
| |
[+~]
output square wave
then just mix your signals together.
Chuck
_______________________________________________
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list