Someone is using this algorithm for high, low and band pass filter coefficients and wants to adapt it for band stop filters.
( y% is an integer value that goes from
filter length / 2 to +filter length / 2 )
IF y% = 0 THEN
c = 1
ELSE
IF BandPass THEN
th1 = (fh - fl) * pi * y% ' Fhigh and Flow of passband
th2 = (fh + fl) * pi * y%
c = SIN(th1) * COS(th2) / th1
ELSE
th = y% * 2 * pi * fc
c = SIN(th) / th '
IF HighPass THEN IF y% MOD 2 = 1 THEN c = -c
END IF
END IF
c is the resulting coefficient for each tap in succession
Is there a simple equivalent algorithm for this?
On 07/12/2019 22.46, Rick C wrote:
Someone is using this algorithm for high, low and band pass filter coefficients and wants to adapt it for band stop filters.
( y% is an integer value that goes from
filter length / 2 to +filter length / 2 )
IF y% = 0 THEN
c = 1
ELSE
IF BandPass THEN
th1 = (fh - fl) * pi * y% ' Fhigh and Flow of passband
th2 = (fh + fl) * pi * y%
c = SIN(th1) * COS(th2) / th1
ELSE
th = y% * 2 * pi * fc
c = SIN(th) / th '
IF HighPass THEN IF y% MOD 2 = 1 THEN c = -c
END IF
END IF
c is the resulting coefficient for each tap in succession
Is there a simple equivalent algorithm for this?
I guess that, if bandpass, then 1-bandpass
is band stop.
From that it is possible to compute the
coefficients.
For a filter with odd length, the "1" would be the tap at the center of the delay line. The algorithm above sets the coefficient of odd length filters to 1, so setting this coefficient to zero and inverting all the other taps would accomplish that.
What does the "1" look like for even length filters?
On 08/12/2019 19.21, Rick C wrote:
[...]
For a filter with odd length, the "1" would be the tap at the center of the delay line. The algorithm above sets the coefficient of odd length filters to 1, so setting this coefficient to zero and inverting all the other taps would accomplish that.
I'm not sure this is correct, but it
could be.
I think it is:
1 - filter_equation
or
1 - (ax+...)/(by+....)
Or whatever the filter equation is.
What does the "1" look like for even length filters?
1 is 1, it is the allpass filter.
I do not think it's relevant to be
as Dirac with same length.
But again, it was long time ago, I'm
not really sure, I just intended to
give you an hint to search further.
The context is not the basic equation, but rather the filter coefficients. For the odd length filters in this algorithm the center coefficient is 1. I'm asking what the coefficients would be for an even length filter for an allpass.
On 08/12/2019 21.16, Rick C wrote:
[...]
The context is not the basic equation, but rather the filter coefficients. For the odd length filters in this algorithm the center coefficient is 1. I'm asking what the coefficients would be for an even length filter for an allpass.
The coefficients must be applied to
an equation.
What it is?
FIR? IIR?
The rest will be automatically, I guess.
Nevertheless, as wrote before, this was
just an hint.
bye,
--
piergiorgio
Did you not read the first post where I provided the code to produce the coefficients? Was that not clear?
Rick C.Sorry if anyone thought I was rude. I was asking what was not clear about the code.
You're being unreasonable by posting uncommented code here and then expecting someone to "simplify" that code for you. Then as Piergiorgio struggles to try to help, you replied to him in a rude way.
On 09/12/2019 07.59, Rick C wrote:
[...]
Did you not read the first post where I provided the code to produce the coefficients? Was that not clear?
No, I do not usually read code posted
on usenet.
I can try to point you one way which
might, or might not, help in solving
your problem, but I will not debug,
extend, improve or else some code.
For that, you'll have to pay... :-)
Sorry...
On Monday, December 9, 2019 at 1:40:18 PM UTC-5, Piergiorgio Sartor wrote:
On 09/12/2019 07.59, Rick C wrote:
[...]
Did you not read the first post where I provided the code to produce the coefficients? Was that not clear?
No, I do not usually read code posted
on usenet.
I can try to point you one way which
might, or might not, help in solving
your problem, but I will not debug,
extend, improve or else some code.
For that, you'll have to pay... :-)
Sorry...
Ok, that's fine. But I'm not asking you to debug code. In particular this code is working to the best of my knowledge. I only posted it so you could see what is being done presently.
On Monday, December 9, 2019 at 4:27:01 AM UTC-5, Richard (Rick) Lyons wrote= >:
Rick C.to try to help, you replied to him in a rude way.
You're being unreasonable by posting uncommented code here and then expec= >ting someone to "simplify" that code for you. Then as Piergiorgio struggles=
Sorry if anyone thought I was rude. I was asking what was not clear about = >the code.=20
Not sure what you mean about "simplifying" the code. I listed the rather s= >imple and straightforward code so it could be seen how the coefficients are=
being generated. I don't even know what the language is and I was able to= undertstand was it was doing to a large degree. =20
Sorry if my posts are not appropriate. I'm not sure what to say that would=
be better.=20
--=20
Rick C.
-+ Get 1,000 miles of free Supercharging
-+ Tesla referral code - https://ts.la/richard11209
On Mon, 9 Dec 2019 18:46:53 -0800 (PST), Rick C <gnuarm.deletethisbit@gmail.com> wrote:Thanks for the reply.
On Monday, December 9, 2019 at 4:27:01 AM UTC-5, Richard (Rick) Lyons wrote= >:
Rick C.to try to help, you replied to him in a rude way.
You're being unreasonable by posting uncommented code here and then expec= >ting someone to "simplify" that code for you. Then as Piergiorgio struggles=
Sorry if anyone thought I was rude. I was asking what was not clear about = >the code.=20
Not sure what you mean about "simplifying" the code. I listed the rather s= >imple and straightforward code so it could be seen how the coefficients are=
being generated. I don't even know what the language is and I was able to= undertstand was it was doing to a large degree. =20
Sorry if my posts are not appropriate. I'm not sure what to say that would=
be better.=20
--=20
Rick C.
-+ Get 1,000 miles of free Supercharging
-+ Tesla referral code - https://ts.la/richard11209
Your posts are not inappropriate and asking questions, even questions
about code, is fine. There will be a lot of folks, however, like Piergiorgio and myself and many others, who just find reading somebody
else's code a struggle in itself.
Everybody thinks code they've written is straightforward, because they
wrote it, but it's not obvious or easy to everybody else. I don't
even know what language that code is, or at least the syntax isn't immediately obvious to me, and figuring it out and how the
coefficients are generated is just not how I want to spend any of my
time.
It might be easy, but it isn't obvious enough to pass the
investigation threshold for some of us. That said, maybe somebody
else will come along and give it a shot.
But don't be discouraged from asking questions or posting problems.
And don't let the old grumpy guys like me slow you down just because
we're not willing to do something.
On Wednesday, December 11, 2019 at 11:44:36 AM UTC-5, Eric Jacobsen wrote:
On Mon, 9 Dec 2019 18:46:53 -0800 (PST), Rick Cto=3D
<gnuarm.deletethisbit@gmail.com> wrote:
=20
On Monday, December 9, 2019 at 4:27:01 AM UTC-5, Richard (Rick) Lyons wr= >ote=3D
:
Rick C.ting someone to "simplify" that code for you. Then as Piergiorgio strugg= >les=3D
You're being unreasonable by posting uncommented code here and then ex= >pec=3D
to try to help, you replied to him in a rude way.
Sorry if anyone thought I was rude. I was asking what was not clear abo= >ut =3D
the code.=3D20
Not sure what you mean about "simplifying" the code. I listed the rathe= >r s=3D
imple and straightforward code so it could be seen how the coefficients = >are=3D
being generated. I don't even know what the language is and I was able=
undertstand was it was doing to a large degree. =3D20=20
Sorry if my posts are not appropriate. I'm not sure what to say that wo= >uld=3D
be better.=3D20
--=3D20
Rick C.
-+ Get 1,000 miles of free Supercharging
-+ Tesla referral code - https://ts.la/richard11209
Your posts are not inappropriate and asking questions, even questions
about code, is fine. There will be a lot of folks, however, like
Piergiorgio and myself and many others, who just find reading somebody
else's code a struggle in itself.
=20
Everybody thinks code they've written is straightforward, because they
wrote it, but it's not obvious or easy to everybody else. I don't
even know what language that code is, or at least the syntax isn't
immediately obvious to me, and figuring it out and how the
coefficients are generated is just not how I want to spend any of my
time.
=20
It might be easy, but it isn't obvious enough to pass the
investigation threshold for some of us. That said, maybe somebody
else will come along and give it a shot.
=20
But don't be discouraged from asking questions or posting problems.
And don't let the old grumpy guys like me slow you down just because
we're not willing to do something.
Thanks for the reply.=20
I am surprised that anyone would say the code is not immediately obvious. =
On Thu, 12 Dec 2019 11:07:19 -0800 (PST), Rick C <gnuarm.deletethisbit@gmail.com> wrote:I guess some people are more intuitive than others. I don't see how the percent sign is even relevant when reading that comment. The important point is that the variable is stepped through the range of filter length which is a symmetrical range.
On Wednesday, December 11, 2019 at 11:44:36 AM UTC-5, Eric Jacobsen wrote: >> On Mon, 9 Dec 2019 18:46:53 -0800 (PST), Rick C
<gnuarm.deletethisbit@gmail.com> wrote:to=3D
=20
On Monday, December 9, 2019 at 4:27:01 AM UTC-5, Richard (Rick) Lyons wr= >ote=3D
:
Rick C.ting someone to "simplify" that code for you. Then as Piergiorgio strugg= >les=3D
You're being unreasonable by posting uncommented code here and then ex= >pec=3D
to try to help, you replied to him in a rude way.
Sorry if anyone thought I was rude. I was asking what was not clear abo= >ut =3D
the code.=3D20
Not sure what you mean about "simplifying" the code. I listed the rathe= >r s=3D
imple and straightforward code so it could be seen how the coefficients = >are=3D
being generated. I don't even know what the language is and I was able=
undertstand was it was doing to a large degree. =3D20=20
Sorry if my posts are not appropriate. I'm not sure what to say that wo= >uld=3D
be better.=3D20
--=3D20
Rick C.
-+ Get 1,000 miles of free Supercharging
-+ Tesla referral code - https://ts.la/richard11209
Your posts are not inappropriate and asking questions, even questions
about code, is fine. There will be a lot of folks, however, like
Piergiorgio and myself and many others, who just find reading somebody
else's code a struggle in itself.
=20
Everybody thinks code they've written is straightforward, because they
wrote it, but it's not obvious or easy to everybody else. I don't
even know what language that code is, or at least the syntax isn't
immediately obvious to me, and figuring it out and how the
coefficients are generated is just not how I want to spend any of my
time.
=20
It might be easy, but it isn't obvious enough to pass the
investigation threshold for some of us. That said, maybe somebody
else will come along and give it a shot.
=20
But don't be discouraged from asking questions or posting problems.
And don't let the old grumpy guys like me slow you down just because
we're not willing to do something.
Thanks for the reply.=20
I am surprised that anyone would say the code is not immediately obvious. =
Hence the disconnect.
For example, in the leading comment:
y% is an integer value that goes from
filter length / 2 to +filter length / 2 )
The % has specific meaning in some languages, but do those meanings
apply here? I've no idea.
y% can't be an integer value for "filter length/2" for odd filterOf course it can be integer. What is 11/2? 5! I don't know if that is what they are using to calculate the coefficients or not. It may be that this is only for odd length filters. I don't know and I don't really care much.
lengths, so does that mean the intent is to reject all even lengths?
I've no idea, and it's not wise to assume, so many will just pass.That's fine. But assumption is exactly what is needed here, but not about the parts you are having trouble with. Those parts can be ignored at first.
Even if you get past the above, the value runs from:Not clear what you are trying to say. The code does not have any looping construct to increment the value, so the assumption is that that is done in some other aspect of the code or tool that aren't shown here.
filter length / 2
to
+filter length / 2
So, it doesn't run? Or it just has one, singular value?
I've no idea.
So, yeah, it's not obvious, even getting past the very first comment.What mud? You don't even need to look at the code other than to realize they are calculating filter coefficients and the center tap coefficient for the odd length filter is a 1 which I pointed out. At that point I said the coefficients for an odd length allpass filter were all zero except for a 1 at the center tap. I asked what the filter coefficients would be if the allpass filter were even length. No inspection of the code is needed for that.
One could make assumptions, but that's usually not productive.
When it's clear as mud, you need to be willing to wade throug the mud,
and many aren't.
On Thursday, December 12, 2019 at 6:59:49 PM UTC-5, Eric Jacobsen wrote:
On Thu, 12 Dec 2019 11:07:19 -0800 (PST), Rick C>
y% can't be an integer value for "filter length/2" for odd filter
lengths, so does that mean the intent is to reject all even lengths?
Of course it can be integer. What is 11/2? 5! I don't know if that is what they are using to calculate the coefficients or not.
It may be that this is only for odd length filters. I don't know and I don't really care much.
Am 13.12.19 um 04:59 schrieb Rick C:
On Thursday, December 12, 2019 at 6:59:49 PM UTC-5, Eric Jacobsen wrote:
On Thu, 12 Dec 2019 11:07:19 -0800 (PST), Rick C>
y% can't be an integer value for "filter length/2" for odd filter
lengths, so does that mean the intent is to reject all even lengths?
Of course it can be integer. What is 11/2? 5! I don't know if that is what they are using to calculate the coefficients or not.
You can never have an even length filter then. If it runs from -f/2 to
+f/2, there is always the zero in the middle, by definition you create
an odd number of coefficients.
It may be that this is only for odd length filters. I don't know and I don't really care much.
You'll have to understand that we care much less than you abou this problem.
Christian
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 70 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 39:13:28 |
| Calls: | 948 |
| Calls today: | 2 |
| Files: | 1,325 |
| Messages: | 280,644 |