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: 220
Joined: Sun Jun 13, 2010 12:37 pm
Operating System: Please select

Re: shape filter

Post by DERF » Sun Feb 18, 2018 5:37 pm

Hello.
Thank you.
From the code of the plugin we can write for example:

Code: Select all

(defun quantable (val)
  (setq val   (round  (- 104 val)))
 (abs-env
  (quantize (pwlv -1 2 1 2.1 1)  val)))

(abs-env
  (shape (osc 55)(quantable 100) 1.0))
We observe that the sound result can be different only by changing the value of "val" one or two units.
But, there is something that I does not understand. What is the utility to use the function ROUND?
If we not use not this function, the sound result, the tone quality of the sound wave is the same.
It is strange.
Beforehand thank you for your answer.

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

Re: shape filter

Post by steve » Sun Feb 18, 2018 5:49 pm

DERF wrote:What is the utility to use the function ROUND?
http://www.cs.cmu.edu/~rbd/doc/nyquist/ ... l#index337

The "steps" argument of "quantize" must be an integer: http://www.cs.cmu.edu/~rbd/doc/nyquist/ ... l#index566
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

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

Re: shape filter

Post by DERF » Mon Feb 19, 2018 7:34 pm

Thank you.
I would like to quote the NYQUIST Reference Manual (chapter: Table-Lookup Oscillator Functions).
R B Danneberg indicates that we can also use functions (snd-... for exemple (snd-fmosc
There is a problem with this function.
I write this code:

Code: Select all

(abs-env (normalize 
(snd-fmosc (osc 69)   *sound-srate*  440 0. 5 90) ))
The manual indicates for this function:(snd-fmosc s step sr hz t0 fm phase)
It is thus necessary to give a value for the parameter "phase".
The problem is the following one: it is impossible to give a value which Nyquist prompt accepts.

Code: Select all

error: bad argument type - 90
Function: #<Subr-SND-FMOSC: #aaca608>
Arguments:
  #<Sound: #b2eb6b8>
  44100
  440
  0
  5
  90
Function: #<FSubr-PROGV: #aacad98>
Arguments:
  (QUOTE (*WARP* *LOUD* *TRANSPOSE* *SUSTAIN* *START* *STOP* *CONTROL-SRATE* *SOUND-SRATE*))
  (LIST (QUOTE (0 1 NIL)) 0 0 1 MIN-START-TIME MAX-STOP-TIME *DEFAULT-CONTROL-SRATE* *DEFAULT-SOUND-SRATE*)
  (NORMALIZE (SND-FMOSC (OSC 69) *SOUND-SRATE* 440 0 5 90))
1> 
My question is the following one: is there a bug?
Beforehand thank you for your help.

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

Re: shape filter

Post by steve » Mon Feb 19, 2018 10:12 pm

The bugs are in your code:

Code: Select all

(snd-fmosc s step sr hz t0 fm phase)
You have missed out the "step" parameter, and "fm" must be a sound.
DERF wrote:R B Danneberg indicates that we can also use functions (snd-...
He also says: "You should use fmosc instead "
http://www.cs.cmu.edu/~rbd/doc/nyquist/ ... l#index788
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

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

Re: shape filter

Post by DERF » Thu Feb 22, 2018 8:08 pm

Hello.
Please read this code.

Code: Select all

(defun wiggle (val)
  (setq val (+ 0.5 (round (/ val 10.0))))
  (abs-env (lfo val 2)))

(abs-env
  (shape (osc 55)(wiggle 100) 1.0)))
This code generates a sound wave with the distortion. I observed the sound wave. It is complex in certain places.
If we zoom a lot, we observe that samples appears in a mess to the passages where the wave is the least regular.
I ask myself this novice's question: why is the generated wave so bitter? Does it come because the generated wave is complex?

Beforehand, thank you for your answer.
Attachments
shape 02.jpg
shape 02.jpg (194.54 KiB) Viewed 607 times
shape 03.jpg
shape 03.jpg (141.03 KiB) Viewed 607 times

Post Reply