Hi there, I have a patch based on mmb's work [filterplot.mmb]. It plots frequency response from biquad coefficients. I have it attached, as a default, it is plotting the freq response of a bandpass filter.
So, I've been meaning to get the freq response of [vcf~] for a while now and I have the intuition that this patch may be adapted for that. [By the way, [vcf~] is basically a [cpole~] filter with the right coefficients and gain adjustment.
The heart of this freq response patch is the subpatch that deals with the Z-Transform (that's what I believe anyway). In this case, it originally deals with the Z-transform of the biquad filter, but I believe that if we change it to cpole's tranfer function it'll work to plot vcf's frequency response.
Right? Did I nail it?
Well, if so... I've recently succeeded in getting the vcf's coefficients and gain to use them with [cpole~]. If you want you can check my patch attached. I'm generating the cpole's coeficients and everything, but the plotting subpatch still needs biquad coeficients to work. All that'd be missing is adapting the formula for the transfer function to cpole's.
cpole's help file says that its Transfer Function is: H(Z) = 1/(1 - aZ^-1)... so it doesn't seem even hard to do it so. Unfortunately I'm just a geeky musician with no math background and needed help getting down to it. I tried some stuff in the dark and failed.
thanks Alex
the tricky math thingy is that is, well, complex...
worth noting is that the signal input is meant to be real, not complex, and that this still creates two outputs (real and imaginary), in other words, I needed to generate two frequency responses (one for the real and the other for the imaginary part).
I just have no idea how to get there just by knowing [cpole~]'s transfer function is H(Z) = 1/(1 - aZ^-1)
cheers
2014-08-05 15:59 GMT-03:00 Alexandre Torres Porres porres@gmail.com:
Hi there, I have a patch based on mmb's work [filterplot.mmb]. It plots frequency response from biquad coefficients. I have it attached, as a default, it is plotting the freq response of a bandpass filter.
So, I've been meaning to get the freq response of [vcf~] for a while now and I have the intuition that this patch may be adapted for that. [By the way, [vcf~] is basically a [cpole~] filter with the right coefficients and gain adjustment.
The heart of this freq response patch is the subpatch that deals with the Z-Transform (that's what I believe anyway). In this case, it originally deals with the Z-transform of the biquad filter, but I believe that if we change it to cpole's tranfer function it'll work to plot vcf's frequency response.
Right? Did I nail it?
Well, if so... I've recently succeeded in getting the vcf's coefficients and gain to use them with [cpole~]. If you want you can check my patch attached. I'm generating the cpole's coeficients and everything, but the plotting subpatch still needs biquad coeficients to work. All that'd be missing is adapting the formula for the transfer function to cpole's.
cpole's help file says that its Transfer Function is: H(Z) = 1/(1 - aZ^-1)... so it doesn't seem even hard to do it so. Unfortunately I'm just a geeky musician with no math background and needed help getting down to it. I tried some stuff in the dark and failed.
thanks Alex
On Tue, Aug 5, 2014 at 2:24 PM, Alexandre Torres Porres porres@gmail.com wrote:
the tricky math thingy is that is, well, complex...
worth noting is that the signal input is meant to be real, not complex, and that this still creates two outputs (real and imaginary), in other words, I needed to generate two frequency responses (one for the real and the other for the imaginary part).
Frequency response is normally computed in terms of magnitude and phase--because the result of applying a filter is to multiply the magnitudes and shift (add) the phases.
The magnitude can be calculated as the square root of the sum of squares of the real and imaginary parts, and the phase can be calculated as the arc-tan of the imaginary part divided by the real part.
|H(w)| = sqrt( Re(H(w))^2 + Im(H(w))^2)
phase(H(w)) = atan( Im(H(w)) / Re(H(w)))
The units of phase will of course be the same as the units of your arc-tan function (either radians or degrees).
I just have no idea how to get there just by knowing [cpole~]'s transfer function is H(Z) = 1/(1 - aZ^-1)
Z^-1 = e^(-i*w) where w is the angular frequency
This is the basic relationship that defines a unit shift operator. The phase shift is proportional to the frequency.
Notice this is in absolute terms with no mention of sampling frequency (or as though sampled at 1 Hz). The frequency ranges from -pi rad/sec to +pi rad/sec. To put it in terms of 'f' in Hz relative to the sampling frequency, use
w=(2*pi/Fs) * f, with Fs=sampling frequency in Hz
The next problem: you get a complex number in the denominator. Multiply numerator and denominator by the conjugate and split into real and imaginary parts before applying the magnitude and phase calculations to get your spectrum. Your coefficient 'a' is a complex number, so work carefully with the conjugate math to separate the real and imaginary parts.
Chuck
2014-08-05 15:59 GMT-03:00 Alexandre Torres Porres porres@gmail.com:
Hi there, I have a patch based on mmb's work [filterplot.mmb]. It plots frequency response from biquad coefficients. I have it attached, as a default, it is plotting the freq response of a bandpass filter.
So, I've been meaning to get the freq response of [vcf~] for a while now and I have the intuition that this patch may be adapted for that. [By the way, [vcf~] is basically a [cpole~] filter with the right coefficients and gain adjustment.
The heart of this freq response patch is the subpatch that deals with the Z-Transform (that's what I believe anyway). In this case, it originally deals with the Z-transform of the biquad filter, but I believe that if we change it to cpole's tranfer function it'll work to plot vcf's frequency response.
Right? Did I nail it?
Well, if so... I've recently succeeded in getting the vcf's coefficients and gain to use them with [cpole~]. If you want you can check my patch attached. I'm generating the cpole's coeficients and everything, but the plotting subpatch still needs biquad coeficients to work. All that'd be missing is adapting the formula for the transfer function to cpole's.
cpole's help file says that its Transfer Function is: H(Z) = 1/(1 - aZ^-1)... so it doesn't seem even hard to do it so. Unfortunately I'm just a geeky musician with no math background and needed help getting down to it. I tried some stuff in the dark and failed.
thanks Alex
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Frequency response is normally computed in terms of
magnitude and phase--because the result of applying
a filter is to multiply the magnitudes and shift (add) the
phases.
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.
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.
To put it in terms of 'f' in Hz relative to the sampling frequency, use w=(2*pi/Fs) * f, with Fs=sampling frequency in Hz
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.
Now, as I said before, I know the transfer function of [cpole~] is 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.
The next problem: you get a complex number in the denominator.
I guess you mean what I just said :)
Multiply numerator and denominator by the conjugate and split into
real and imaginary parts before applying the magnitude and phase
calculations to get your spectrum. Your coefficient 'a' is a complex
number, so work carefully with the conjugate math to separate the
real and imaginary parts.
well, if this is the solution to my problem, I don’t think I could follow what you meant.
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.
Thanks
Alex
This may help... [online draft of Puckette's book]:
http://msp.ucsd.edu/techniques/latest/book-html/node105.html
"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]"
On Tue, Aug 12, 2014 at 5:34 PM, Alexandre Torres Porres porres@gmail.com wrote:
Frequency response is normally computed in terms of
magnitude and phase--because the result of applying
a filter is to multiply the magnitudes and shift (add) the
phases.
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.
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.
To put it in terms of 'f' in Hz relative to the sampling frequency, use w=(2*pi/Fs) * f, with Fs=sampling frequency in Hz
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.
Now, as I said before, I know the transfer function of [cpole~] is 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.
The next problem: you get a complex number in the denominator.
I guess you mean what I just said :)
Multiply numerator and denominator by the conjugate and split into
real and imaginary parts before applying the magnitude and phase
calculations to get your spectrum. Your coefficient 'a' is a complex
number, so work carefully with the conjugate math to separate the
real and imaginary parts.
well, if this is the solution to my problem, I don’t think I could follow what you meant.
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.
Thanks
Alex
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
this is actually some very basic knowledge of complex numbers that I've already comprehended a while ago. Like I said, I know how to get mag & phase with real/Imaginary parts, but that is not the heart of the issue. I still can't realize how to adapt the patch to plot the frequency response of a complex pole. There's more info in the patch I just uploaded.
thanks
2014-08-12 22:06 GMT-03:00 forrest curo treegestalt@gmail.com:
This may help... [online draft of Puckette's book]:
http://msp.ucsd.edu/techniques/latest/book-html/node105.html
"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]"
On Tue, Aug 12, 2014 at 5:34 PM, Alexandre Torres Porres <porres@gmail.com
wrote:
Frequency response is normally computed in terms of
magnitude and phase--because the result of applying
a filter is to multiply the magnitudes and shift (add) the
phases.
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.
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.
To put it in terms of 'f' in Hz relative to the sampling frequency, use w=(2*pi/Fs) * f, with Fs=sampling frequency in Hz
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.
Now, as I said before, I know the transfer function of [cpole~] is 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.
The next problem: you get a complex number in the denominator.
I guess you mean what I just said :)
Multiply numerator and denominator by the conjugate and split into
real and imaginary parts before applying the magnitude and phase
calculations to get your spectrum. Your coefficient 'a' is a complex
number, so work carefully with the conjugate math to separate the
real and imaginary parts.
well, if this is the solution to my problem, I don’t think I could follow what you meant.
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.
Thanks
Alex
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list