error in dspprims.lsp re, (allpass2) - or error in manual.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

error in dspprims.lsp re, (allpass2) - or error in manual.

Stevethefiddle
The manual states that for (allpass2) the Q parameter is optional:

"(allpass2 signal hz [q])
    A fixed-parameter, second-order allpass filter based on
snd-biquad. The frequency is given by hz (a FLONUM) and an optional Q
factor is given by q (a FLONUM)."
http://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/manual/part6.html#index346

but the code in dsppims is:

; two-pole allpass.
(defun allpass2 (x hz q)
  (multichan-expand #'nyq:allpass x hz q))

which clearly requires a "Q" argument.

I'm not sure what a 'good' default value would be, but I'd guess it
should be something like

; two-pole allpass.
(defun allpass2 (x hz &optional (q 0.7071))
  (multichan-expand #'nyq:allpass x hz q))

Steve D

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Audacity-nyquist mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-nyquist
rbd
Reply | Threaded
Open this post in threaded view
|

Re: error in dspprims.lsp re, (allpass2) - or error in manual.

rbd
You are right. I must have copied and pasted some text without noticing
only some filters have a default Q. I think I'm going to go with the
code on this one and change the documentation to match. With lowpass and
highpass, I think the default Q is the one you'd normally want (to get a
flat pass band and avoid a resonance at the transition -- please don't
take my word on this if it's important though), whereas with allpass, Q
is not so intuitive. I would assume you are using allpass for some phase
or delay effect, so either deeper understanding or careful listening is
in order.

-Roger

On 11/2/10 2:12 PM, Steve the Fiddle wrote:

> The manual states that for (allpass2) the Q parameter is optional:
>
> "(allpass2 signal hz [q])
>      A fixed-parameter, second-order allpass filter based on
> snd-biquad. The frequency is given by hz (a FLONUM) and an optional Q
> factor is given by q (a FLONUM)."
> http://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/manual/part6.html#index346
>
> but the code in dsppims is:
>
> ; two-pole allpass.
> (defun allpass2 (x hz q)
>    (multichan-expand #'nyq:allpass x hz q))
>
> which clearly requires a "Q" argument.
>
> I'm not sure what a 'good' default value would be, but I'd guess it
> should be something like
>
> ; two-pole allpass.
> (defun allpass2 (x hz&optional (q 0.7071))
>    (multichan-expand #'nyq:allpass x hz q))
>
> Steve D

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Audacity-nyquist mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-nyquist
Reply | Threaded
Open this post in threaded view
|

Re: error in dspprims.lsp re, (allpass2) - or error in manual.

Stevethefiddle
Roger Dannenberg wrote
You are right. I must have copied and pasted some text without noticing
only some filters have a default Q. I think I'm going to go with the
code on this one and change the documentation to match. With lowpass and
highpass, I think the default Q is the one you'd normally want (to get a
flat pass band and avoid a resonance at the transition -- please don't
take my word on this if it's important though), whereas with allpass, Q
is not so intuitive. I would assume you are using allpass for some phase
or delay effect, so either deeper understanding or careful listening is
in order.

-Roger
I was just following up a question by another user (who was actually using the wrong effect), but noticed the discrepancy while checking the syntax.

Steve

On 11/2/10 2:12 PM, Steve the Fiddle wrote:
> The manual states that for (allpass2) the Q parameter is optional:
>
> "(allpass2 signal hz [q])
>      A fixed-parameter, second-order allpass filter based on
> snd-biquad. The frequency is given by hz (a FLONUM) and an optional Q
> factor is given by q (a FLONUM)."
> http://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/manual/part6.html#index346
>
> but the code in dsppims is:
>
> ; two-pole allpass.
> (defun allpass2 (x hz q)
>    (multichan-expand #'nyq:allpass x hz q))
>
> which clearly requires a "Q" argument.
>
> I'm not sure what a 'good' default value would be, but I'd guess it
> should be something like
>
> ; two-pole allpass.
> (defun allpass2 (x hz&optional (q 0.7071))
>    (multichan-expand #'nyq:allpass x hz q))
>
> Steve D
Reply | Threaded
Open this post in threaded view
|

Re: error in dspprims.lsp re, (allpass2) - or error in manual.

edgar-rft
Steve wrote:

 > I'm not sure what a 'good' default value would be, but I'd guess it
 > should be something like
 >
 > ; two-pole allpass.
 > (defun allpass2 (x hz &optional (q 0.7071))
 >   (multichan-expand #'nyq:allpass x hz q))

The Tietze/Schenk "Electronic Circuits Handbook for Design and Applications",
(what is something like the "basic knowlege book for electronic engineers"),
tells that an allpass filter works best with Bessel defaults, where Bessel
filters are known for producing a least-worse overall phase error.

According to the Tietze/Schenk a second-order Bessel filter defaults to:

  a[i] = 1.3617
  b[i] = 0.6180
     q = 0.58    <- q-factor for the Nyquist allpass2

But please be aware that what an electronics engineer calls "works best",
for a musician's ear often sounds "most boring".  :)

An allpass filter produces a frequecy-dependent time-shift and IMO sounds
best if a part of the original signal is added to the allpass output, in
the Audacity Nyquist prompt for example:

(sum (scale wet (allpass2 x hz 0.58))
      (scale dry s))

where 'wet' ist the allpass volume, and 'dry' is the original signal.

For excessive usage of comb and allpass filters see the "Reverb Example":

http://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/examples/rbd/19-reverb.lsp.htm

- edgar






--
The author of this email does not necessarily endorse the following
advertisements, which are the sole responsibility of the advertiser:


------------------------------------------------------------------------------
Achieve Improved Network Security with IP and DNS Reputation.
Defend against bad network traffic, including botnets, malware,
phishing sites, and compromised hosts - saving your company time,
money, and embarrassment.   Learn More!
http://p.sf.net/sfu/hpdev2dev-nov
_______________________________________________
Audacity-nyquist mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-nyquist