shape filter

Using Nyquist scripts in Audacity.
Post and download new plug-ins.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
DERF
Posts: 217
Joined: Sun Jun 13, 2010 12:37 pm
Operating System: Please select

shape filter

Post by DERF » Wed Feb 14, 2018 3:19 pm

Hello.
Among Nyquist filters, there is filter "shape"?.
I would like to ask a question:
Is this filter a pulse shaping filter like "Sinc shaped filter" or "Gaussian filter"?
Thank you.

steve
Site Admin
Posts: 47281
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu
Contact:

Re: shape filter

Post by steve » Wed Feb 14, 2018 3:24 pm

9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

DERF
Posts: 217
Joined: Sun Jun 13, 2010 12:37 pm
Operating System: Please select

Re: shape filter

Post by DERF » Thu Feb 15, 2018 6:06 am

Hello.
Yes. It is strange. "shape" is presented like a function ("....A waveshaping function.")

steve
Site Admin
Posts: 47281
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu
Contact:

Re: shape filter

Post by steve » Thu Feb 15, 2018 9:09 am

Yes, it's a function. Think of the verb "to shape something" rather than a noun "a shape".
The function "shapes" the waveform that it is applied to - in other words it "modifies the shape" of the waveform.

The "table" argument provides a lookup table. The function takes the value of each sample in turn, and looks up the output value in the table.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

DERF
Posts: 217
Joined: Sun Jun 13, 2010 12:37 pm
Operating System: Please select

Re: shape filter

Post by DERF » Thu Feb 15, 2018 5:23 pm

Thank you.
I wrote this code:

Code: Select all

(defun mytable ()
(amosc (hz-to-step 440) (hzosc 1)))

(stretch-abs 4 (shape  (osc 55) (mytable) 3.0))
I don't know if the obtained effect corresponds to an usual use of this function (SHAPE). The result is strange. There are too many harmonics sounds.
Can you indicate to me if the code is correct?
Beforehand thank you.

steve
Site Admin
Posts: 47281
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu
Contact:

Re: shape filter

Post by steve » Thu Feb 15, 2018 5:47 pm

There are no code errors in that, but I've no idea what you are trying to do.

Normally the "shape" table would be very simple, for example:

Code: Select all

(abs-env (pwlv -1 0.5 -0.8 1.5 0.8 2 1 2.1 1))
which you would then use with an offset of 1.

Try applying that to a sine wave with amplitude 1.0, using this code:

Code: Select all

(setf shape-table (abs-env (pwlv -1 0.5 -0.8 1.5 0.8 2 1 2.1 1)))
(shape *track* shape-table 1)
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

DERF
Posts: 217
Joined: Sun Jun 13, 2010 12:37 pm
Operating System: Please select

Re: shape filter

Post by DERF » Fri Feb 16, 2018 9:56 am

Thank you.
I try to understand the following point.
In the presentation of the shape function, R.B. Dannenberg specifies that this function is a waveshaping function.
In this case, it is about synthesis by not linear distortion? If it is the case, the waveshaping should add to the sound of origin complementary harmonics sounds.
But, look at this code:

Code: Select all

(defun mytone ()
(amosc (hz-to-step 195.997) (hzosc 1.5)))
(defun envshaper ()
  (mult (sum 1 (hzosc (const (/ 1.0 2.0) 2) *table* 270)) 0.5))
(stretch-abs 4 (shape (mytone) (envshaper) 1))
I used the function(ENVSHAPER) by borrowing it from R.B. Dannenberg (Shepard Tones Exemple).
The problem is the following one: the wave generated by this code is hardly richer in harmonics than a sinusoidal wave.

My question is the following one: how we can to strengthen the intensity of the harmonics sounds which are created?
Beforehand thank you for your answer.

On the image to the right the wave distorted by the SHAPE function, to the left a sinusoïdal wave.
Attachments
shape 01.jpg
shape 01.jpg (153.99 KiB) Viewed 676 times

steve
Site Admin
Posts: 47281
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu
Contact:

Re: shape filter

Post by steve » Fri Feb 16, 2018 1:58 pm

For an example of using SHAPE, see here:
http://forum.audacityteam.org/viewtopic ... 96#p237796
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

DERF
Posts: 217
Joined: Sun Jun 13, 2010 12:37 pm
Operating System: Please select

Re: shape filter

Post by DERF » Sat Feb 17, 2018 8:20 pm

Thank you.
The plug- in is interesting to understand how to use the function SHAPE.
I try to understand this passage of Nyquist Reference Manual (shape signal table origin) [LISP]:
"... The output at time t is: table(origin + clip(signal(t)) where clip(x) = max(1, min(-1, x))."
It seems to me that it is written in SAL. Thus my question is the following one: could you rewrite in LISP this passage?
Beforehand thank you.

steve
Site Admin
Posts: 47281
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu
Contact:

Re: shape filter

Post by steve » Sat Feb 17, 2018 8:48 pm

It's not SAL. It is describing the behaviour mathematically.

It is saying, that for each input value 'x", clipped to a range of +/- 1,
the output is looked up from the table, offset by the stated amount.

For example:

If the length of the table waveform = 2, and the "origin" (as in the origin of a graph is where the aces cross) is at 1,
then for an input sample "x" = -0.4, the output value will be read from the table at (offset - 0.4) = 0.6. So the output value is read from the table at time = 0.6
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Post Reply