I'm really looking forward to testing the dynamic waveshaping opcodes. It is something I've thought about trying to do in csound, but never gotten around to actually coding. Nice. Oeyvind 2007/12/5, Anthony Kozar : > > Victor.Lazzarini@nuim.ie wrote on 12/5/07 2:54 AM: > > > PD seem useful. UDOs are also good because they're didactical, can you > > do both? > > Thanks. I wrote the phase dist. opcodes (and powershape below) a while > ago > but I will make UDOs too. > > > How do the waveshaping opcodes you mention > > differ from simply building them with oscillator and table > > lookup? > > They allow for _dynamic_ waveshaping where the transfer function varies > over > time. I have written the following opcodes so far and hope to come up > with > some more: > > aout powershape ain, kShapeAmount [, ifullscale] > aout polynomial ain, ka0 [, ka1 [, ka2 [...]]] > aout chebyshevpoly ain, ka0 [, ka1 [, ka2 [...]]] > > polynomial efficiently calculates any single-variable polynomial with > k-rate > coefficients. chebyshevpoly does the same but each coefficient is a > multiplier for an nth-order chebyshev polynomial. With a sine wave input, > this allows precise time-varying control over any number of > harmonically-tuned partials, but requires only one oscillator. > > Manual description for powershape: > > This opcode is very similar to the pow unit generators that already exist > in > Csound for calculating the mathematical "power of" operation. However, it > introduces a couple of twists which I think make it much more useful for > waveshaping audio-rate signals. The kShapeAmount parameter is the > exponent > to which the input signal is raised. > > Normally, unless the exponent is an odd integer, the pow() of a negative > input is a complex number, so the Csound ugens simply return zero in those > cases. This will turn a bipolar audio signal into a unipolar signal with > large portions of the output pinned to zero. The powershape opcode > instead > treats all input values as positive but preserves their sign in the output > signal. This allows for smooth shaping of any input signal while varying > the exponent over any range. (Powershape also (hopefully) deals > intelligently with discontinuities that could arise when the exponent and > input are both zero. Note though that negative exponents will usually > cause > the signal to exceed the maximum amplitude specified by the ifullscale > parameter and should normally be avoided). > > The other adaptation involves the ifullscale parameter. The input signal > is > divided by ifullscale before being raised to kShapeAmount and then > multiplied by ifullscale before being output. This normalizes the input > signal to the interval [-1,1], guaranteeing that the output will also be > within this range. Also, the pow() function provides a smoothly evolving > transfer function when its input is in this range. Values of kShapeAmount > between (0,1) will make the signal more "convex" while values greater than > 1 > will make it more "concave" and a value of exactly 1.0 will produce no > change in the input signal. > > > Anthony Kozar > anthonykozar AT sbcglobal DOT net > http://anthonykozar.net/ > > > ------------------------------------------------------------------------- > 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 >