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:
Mac OS X
GNU/Linux and Unix-like
Post Reply
Posts: 217
Joined: Sun Jun 13, 2010 12:37 pm
Operating System: Please select


Post by DERF » Tue Feb 06, 2018 6:00 pm

My question concerns the optional parameter of the function (osc-pulse .
Is there a document on the Internet which explains how we use this parameter (R B Dannenberg: ...but other shapes may be used to achieve non-square pulses...)?
Beforehand, thank you for your help.

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

Re: [compare-shape]

Post by steve » Tue Feb 06, 2018 6:36 pm

The only other "documentation" that I'm aware of is the code:

Code: Select all

; bias is [-1, 1] pulse width.  sound or scalar.
; hz is a sound or scalar
(defun osc-pulse (hz bias &optional (compare-shape *step-shape*))
  (compare bias (osc-tri hz) compare-shape))

Code: Select all

; compare-shape is a shape table -- origin 1.
(defun compare (x y &optional (compare-shape *step-shape*))
  (let ((xydiff (diff x y)))
    (shape xydiff compare-shape 1)))
So in the function: (osc-pulse hz bias [compare-shape])
the optional parameter compare-shape is a sound that shapes the pulse with the shape function (http://www.cs.cmu.edu/~rbd/doc/nyquist/ ... l#index453)

Example: If you want pulses with sloped sides, you could do it like this:

Code: Select all

(setf trapezium  (abs-env (pwlv -1 0.7 -1 1.3 1)))
(osc-pulse 100 0 trapezium)
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Post Reply