PD seem useful. UDOs are also good because they're didactical, can you
do both?
 
How do the waveshaping opcodes you mention
differ from simply building them with oscillator and table
lookup?

Victor
----- Original Message -----
From: Anthony Kozar <anthonykozar@sbcglobal.net>
Date: Wednesday, December 5, 2007 2:33 am
Subject: [Cs-dev] New opcodes useful?
To: New Csound Developer list <csound-devel@lists.sourceforge.net>

> I am also planning to add a few new opcodes in the next few days
> for dynamic
> waveshaping and phase distortion.  I am sure that the
> waveshaping opcodes
> will be useful, but I wonder about the phase distortion
> ones.  I am
> considering adding them because two of them would require ksmps
> == 1 to
> emulate with orchestra code.  (pdclip could be emulated
> with the limit
> opcode, I think).  Do you think these opcodes will be
> useful enough or
> should I just make them available as UDOs?
>
> aout    pdhalf      ain,
> kShapeAmount [, ifullscale]
> aout    pdhalfy     ain,
> kShapeAmount [, ifullscale]
> aout    pdclip      ain,
> kWidth, kCenter [, ifullscale]
>
> PDhalf
>
> This opcode is designed to emulate the "classic" phase
> distortion synthesis
> method of the Casio CZ-series of synthesizers from the mid-
> 1980's.  This
> technique reads the first and second halves of a function table
> at different
> rates in order to warp the waveform.  The rates are chosen
> so that the
> overall period of oscillation is preserved.  Thus, phase
> distortion can only
> produce higher partials in a harmonic series.  It does not
> produce sidebands
> which may be inharmonic in the way that frequency modulation does.
>
> pdhalf calculates a transfer function which is composed of two linear
> segments.  (See attached image).  These segments meet
> at a "pivot point"
> which always lies on the x axis (for a bipolar input).  The
> kShapeAmountparameter specifies where on the x axis this point
> falls.  The negative half
> of the input range is mapped linearly between -1.0*ifullscale and
> kShapeAmount.  The positive half is mapped linearly between
> kShapeAmount and
> ifullscale.  A value of zero for kShapeAmount will not have
> any effect on
> the input signal.  If the output is used to index a table,
> values for
> kShapeAmount that are less than zero will cause the first half
> of the table
> to be read more quickly than the second half.  The reverse
> is true for
> values of kShapeAmount greater than zero.
>
> Currently, pdhalf expects a bipolar input signal.  So you
> must scale and
> offset your input (and output!) appropriately if it is a
> unipolar phasor.  I
> will probably add an optional parameter to support unipolar
> signals before
> committing.  kShapeAmount is always between -1 and 1 for
> bipolar operation.
>
> A typical example of the use of pdhalf is
>   aosc  phasor  ifreq
>   apd   pdhalf  2*aosc - 1.0,
> kamount   ; convert aosc to bipolar
>   aout  tablei  0.5*(apd+1.0), 1,
> 1     ; convert apd back to unipolar
>
> PDhalfy
>
> This is a variation on PDhalf that places the pivot point of the phase
> distortion on the y axis instead of the x axis.  Thus, it
> does not read the
> two halves of a table at different rates, but instead divides it
> into two
> segments of different sizes depending upon the kShapeAmount
> parameter.  Each
> of these segments is then mapped to half of the oscillator
> period (or just
> the output range if not being used to distort a phasor). 
> This opcode has a
> milder quality to its distortion in my experience.
>
> PDclip
>
> This opcode performs linear clipping on the input signal ain.
> kwidth is the
> percentage of the signal range that is clipped (must be between
> 0 and 1).
> The rest of the input range is mapped linearly from -ifullscale to
> ifullscale.  kcenter specifies an offset for shifting the
> unclipped window
> of the signal higher or lower in the range (essentially a DC offset).
> ifullscale sets the maximum amplitude of the input and output signals
> (defaults to 1.0).
>
> This amounts to waveshaping the input with the following
> transfer function
> (normalized to ifullscale=1.0) :
>
>         1|  
> _______      width of clipped region is
> kwidth         | 
> /             width of unclipped region is (1-kwidth)
>          |
> /              kcenter shifts the unclipped region
> -1      
> |/        1        left or right (up to kwidth)
> --------------------
>         /|
>        / |
>       /  |
> ------   |-1
>
> This opcode may be used for direct, linear distortion of an
> audio signal.
> Alternatively, you might use it to modify the output of a phasor
> before it
> is used to index a function table, effectively making this a phase
> distortion technique.
>
> > -----------------------------------------------------------------
> --------
> SF.Net email is sponsored by: The Future of Linux Business White Paper
> from Novell.  From the desktop to the data center, Linux is going
> mainstream.  Let it simplify your IT future.
> http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel