<div dir="ltr">This may help... [online draft of Puckette's book]:<br><br><a href="http://msp.ucsd.edu/techniques/latest/book-html/node105.html">http://msp.ucsd.edu/techniques/latest/book-html/node105.html</a><br><br>"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. [etc]" <br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Aug 12, 2014 at 5:34 PM, Alexandre Torres Porres <span dir="ltr"><<a href="mailto:porres@gmail.com" target="_blank">porres@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="">
















<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial;background-image:initial;background-repeat:initial">> Frequency response is
normally computed in terms of</span></p>

<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial;background-image:initial;background-repeat:initial">> magnitude and</span><span style="font-size:9.5pt;font-family:Arial"> <span style="background-image:initial;background-repeat:initial">phase--because the result of
applying</span></span></p>

<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial;background-image:initial;background-repeat:initial">> a filter is to multiply
the</span><span style="font-size:9.5pt;font-family:Arial"> <span style="background-image:initial;background-repeat:initial">magnitudes and
shift (add) the</span></span></p>

<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial;background-image:initial;background-repeat:initial">> phases.</span><span style="font-size:9.5pt;font-family:Arial"><br>
<br>
</span></p>

</div><p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial">That seems clear for me. I know how to get
both mag/phase but my patch is simplified to get the magnitude only. I also
know how to get mag & phase with real/Imaginary parts too. Where I get
stuck is the z transform deal. More precisely, adapting the patch to a complex
version. <br>
<br>
For instance, it works on plotting the freq response of a real pole with an
input of the filter coefficient. But I’d like to plot the freq response of
complex pole, from the real and imaginary part of the coefficient.</span></p><div class="">

<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial"> </span></p>

<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial;background-image:initial;background-repeat:initial">> To put it in terms of
'f' in Hz relative to the</span><span style="font-size:9.5pt;font-family:Arial"> <span style="background-image:initial;background-repeat:initial">sampling frequency, use</span><br>
<span style="background-image:initial;background-repeat:initial">> w=(2*pi/Fs) * f,  with Fs=sampling
frequency in Hz</span></span></p>

<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial"> </span></p>

</div><p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial">Yeah, the patch already calculates frequency
in rad/sample. More over, it uses complex frequencies, which are the cosine and
sine of the freq in rad/sample.</span></p>

<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial"> </span></p>

<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial">Now, as I said before, I know the transfer
function of [cpole~] is </span><span style="font-size:9.5pt;font-family:Arial;color:rgb(80,0,80)">is H(Z) = 1/(1 -
aZ^-1) – just like the [rpole~] by the way – but that is not clear on how to
deal with a complex coefficient.</span></p><div class="">

<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial"> <br>
<span style="background-image:initial;background-repeat:initial">> The next problem: you get a complex number
in the denominator.</span></span><span style="font-size:9.5pt;font-family:Arial;color:rgb(80,0,80)"></span></p>

<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial;background-image:initial;background-repeat:initial"> </span></p>

</div><p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial;background-image:initial;background-repeat:initial">I guess you mean what I just
said :)</span></p><div class="">

<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial"><br>
<span style="background-image:initial;background-repeat:initial">> Multiply numerator and denominator by the
conjugate and split into</span></span></p>

<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial;background-image:initial;background-repeat:initial">> real and imaginary parts
before applying the magnitude and phase</span></p>

<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial">> <span style="background-image:initial;background-repeat:initial">calculations
to get your spectrum.  Your coefficient 'a'  is a complex</span></span></p>

<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial;background-image:initial;background-repeat:initial">> number, so work
carefully with the conjugate math to separate the</span></p>

</div><p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial;background-image:initial;background-repeat:initial">> real</span><span style="font-size:9.5pt;font-family:Arial"> <span style="background-image:initial;background-repeat:initial">and imaginary parts.</span><br>


<br>
<span style="background-image:initial;background-repeat:initial">well, if this is the solution to my problem, I
don’t think I could follow what you meant.</span></span></p>

<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial;background-image:initial;background-repeat:initial"> </span></p>

<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial;background-image:initial;background-repeat:initial">Anyway, I’m attaching a much
more objective and simpler version of the patch I’ve sent before. It also has a
descriptive text that explains the patch and the issue. I think I’m really
close to nailing this. I just need a tiny hand with the math.</span></p>

<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial;background-image:initial;background-repeat:initial"> </span></p>

<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial;background-image:initial;background-repeat:initial">Thanks</span></p>

<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial;background-image:initial;background-repeat:initial">Alex</span><span style="font-size:10pt;font-family:Times"></span></p>

</div></div>
<br>_______________________________________________<br>
<a href="mailto:Pd-list@lists.iem.at">Pd-list@lists.iem.at</a> mailing list<br>
UNSUBSCRIBE and account-management -> <a href="http://lists.puredata.info/listinfo/pd-list" target="_blank">http://lists.puredata.info/listinfo/pd-list</a><br>
<br></blockquote></div><br></div>