Csound Csound-dev Csound-tekno Search About

[Csnd] statevar source questions.

Date2009-09-13 00:50
From"Steven Cook"
Subject[Csnd] statevar source questions.
Hi,

I've been looking at the Csound source code (v5.05) and am confused by 
statevar. This implementation of a state variable filter appears to store 
three state variables, lpd, bpd & lp, but I *think* only two are needed. The 
first line of the process loop:

hp = in[i] - q*bpd - lp;

...uses lp when it should use lpd. Lp (is it right to capitalize here!?) 
could be a temporary variable. While I'm here, the frequency setting line 
should be:

f = 2.0*sin(pi*freq*(double)csound->pidsr/ostimes);

...with added pi.

Of course, it's getting very late, so all of the above could be flawed...

Regards,

Steven Cook.
http://www.spcplugins.com/
+44(0)1271 867288



Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2009-09-13 01:46
FromMichael Gogins
Subject[Csnd] Re: statevar source questions.
You could test your theory by implementing your version of the filter
as a user-defined opcode, filter the right channel of a sound with the
builtin opcode and the left channel with yours, and compare them in an
editor.

Regards,
Mike

On 9/12/09, Steven Cook  wrote:
> Hi,
>
> I've been looking at the Csound source code (v5.05) and am confused by
> statevar. This implementation of a state variable filter appears to store
> three state variables, lpd, bpd & lp, but I *think* only two are needed. The
> first line of the process loop:
>
> hp = in[i] - q*bpd - lp;
>
> ...uses lp when it should use lpd. Lp (is it right to capitalize here!?)
> could be a temporary variable. While I'm here, the frequency setting line
> should be:
>
> f = 2.0*sin(pi*freq*(double)csound->pidsr/ostimes);
>
> ...with added pi.
>
> Of course, it's getting very late, so all of the above could be flawed...
>
> Regards,
>
> Steven Cook.
> http://www.spcplugins.com/
> +44(0)1271 867288
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>

Date2009-09-13 04:58
FromSteven Yi
Subject[Csnd] Re: statevar source questions.
I'm curious about statevar, as last I checked it sounded quite
different from svfilter and sounded a bit off to me at the time.

On Sat, Sep 12, 2009 at 7:50 PM, Steven Cook
 wrote:
> Hi,
>
> I've been looking at the Csound source code (v5.05) and am confused by
> statevar. This implementation of a state variable filter appears to store
> three state variables, lpd, bpd & lp, but I *think* only two are needed. The
> first line of the process loop:
>
> hp = in[i] - q*bpd - lp;
>
> ...uses lp when it should use lpd. Lp (is it right to capitalize here!?)
> could be a temporary variable. While I'm here, the frequency setting line
> should be:
>
> f = 2.0*sin(pi*freq*(double)csound->pidsr/ostimes);
>
> ...with added pi.
>
> Of course, it's getting very late, so all of the above could be flawed...
>
> Regards,
>
> Steven Cook.
> http://www.spcplugins.com/
> +44(0)1271 867288
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2009-09-13 09:34
Fromvictor
Subject[Csnd] Re: statevar source questions.
No, it shouldn't 
 csound->pidsr  is   2pi/sr

if that was the case, the filter would not work at all!

> 
> f = 2.0*sin(pi*freq*(double)csound->pidsr/ostimes);
> 

about the other things I need to look over. It's possible
there is a bug.

Victor


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2009-09-13 09:40
Fromvictor
Subject[Csnd] Re: Re: statevar source questions.
yes, it looks like we can spare a variable there.
The code is otherwise correct. I guess it will sound
different than svfilter, otherwise there was no point to
it. It should be more stable too.

Victor

----- Original Message ----- 
From: "victor" 
To: 
Sent: Sunday, September 13, 2009 9:34 AM
Subject: [Csnd] Re: statevar source questions.


> No, it shouldn't csound->pidsr  is   2pi/sr
>
> if that was the case, the filter would not work at all!
>
>>
>> f = 2.0*sin(pi*freq*(double)csound->pidsr/ostimes);
>>
>
> about the other things I need to look over. It's possible
> there is a bug.
>
> Victor
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
> csound" 



Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"