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.<br>Ill take a deep look into your explanation of fft and ifft. It gives me the complete picture.
<br><br>dan<br><br><div><span class="gmail_quote">2006/9/5, Charles Henry &lt;<a href="mailto:czhenry@gmail.com">czhenry@gmail.com</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
to use the ifft for synthesis, you need to know the amplitude and<br>phase for each frequency, and you need to express it as a complex<br>number.<br><br>z=a+b*i, a=Amp*cos(phase)&nbsp;&nbsp;and b=Amp*sin(phase)<br><br>fft~ gives two outlets, the left is the real part of the fourier
<br>transform, the right is the imaginary part.<br>next thing is, the second half of your fourier coefficients are<br>complex conjugates of your first half (when dealing with real-valued<br>signals) according to the following pattern
<br><br>F(0) is real (the imaginary part is zero) and so is F(N/2)<br>F(1)=F(N-1)*&nbsp;&nbsp; where * denotes conjugate<br>F(2)=F(N-2)*<br>...<br>F(N/2-1)=F(N/2+1)*<br><br>for a block size of 64,<br>you've got 33 distinct real values (0 to N/2)
<br>and 31 distinct imaginary values (1 to N/2-1)<br>to calculate before packing them all up into signals<br><br>and there's some limitations.&nbsp;&nbsp;To do things cleanly all of your<br>frequencies need to be ingeter multiples of (sampling freq. fs/ N),
<br>the lowest frequency you can achieve with Fourier series on N points<br><br>Luckily, your sawtooth and square waves are made up of frequencies in<br>just this way.&nbsp;&nbsp;But you're still limited to JUST the frequencies in<br>
your fourier transform (fs/N, 2*fs/N, 3*fs/N, ..., N/2 * fs/N)<br><br>It's probably not the best way to do it, for what you're describing.<br>You want to be able to continuously mix different levels of your saw,<br>sine and squares as a function of time, right?
<br>I think you'll have better luck by just sync'ing up a phasor~ and an<br>osc~, and creating your square wave (in phase) by using &gt;~ and &lt;~ on<br>osc~ and summing the outputs together like<br>[osc~]<br>|&nbsp;&nbsp;&nbsp;&nbsp; \<br>
[&gt;~][&lt;~]<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[*~] [sig~ -1]<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>[+~]<br>output square wave<br><br>then just mix your signals together.<br><br>Chuck<br><br>_______________________________________________<br><a href="mailto:PD-list@iem.at">
PD-list@iem.at</a> mailing list<br>UNSUBSCRIBE and account-management -&gt; <a href="http://lists.puredata.info/listinfo/pd-list">http://lists.puredata.info/listinfo/pd-list</a><br></blockquote></div><br>