Main Group 40: Waveshaping


Return to main index
01 Function Table Implementation
1 variable transfer function
02 Waveshaper with Conditional Branch for Envelope
1 clarinet-like
03 Inline Polynomial Implementation
1 ring modulating a waveshaped signal
60 Chebychev Coefficients Implementation
1 GEN 13 polynomial

Overview

An input signal is rotated by 90 degrees counter clockwise so that its time axis is parallel to the ordinate of the transfer function. The ordinate of the transfer function represents the OUT values and its abscissa stands for the IN values. In this manner all amplitude values of an incoming signal are mapped to new amplitude values, in strict correspondence with the transfer function.

A diagonal transfer function (x=y) gives no distortion at all. The larger the deviations in the slope of a transfer function, the more radical the spectral changes. An even transfer function will produce only even harmonics in the output, while odd transfer functions yield odd harmonics in the distorted signal. Discontinuities like abrupt jumps or sharp points lead to harmonically richer spectra than smooth transfer functions. (Dodge 1985: pp. 128-141)

To calculate specific spectra, the transfer function is represented as a polynomial of the general form:

           F(x) = d0 + d1x + d2x2 + ... + dNxN
For an input sinus at amplitude 1, amplitude values for the harmonics belonging to each algebraic term of the polynomial are obtained by multiplying the divisor with the table value(s) for hj. Summing these coefficients for the corresponding power of x will compute the value of dj.

Suggested Reading

Arfib, D. 1978.
"Digital Synthesis of Complex Spectra by Means of Multiplication of Non-Linear Distorted Sine Waves."
Proceedings of the 1978 International Computer Music Conference.
San Francisco: International Computer Music Association, pp. 70-84.
Reprinted in Journal of the Audio Engineering Society 27(10):757-768.

Beauchamp, J.W. 1975.
"Analysis and Synthesis of Cornet Tones Using Non-Linear Interharmonic Relationships."
Journal of the Audio Engineering Society 23(6):778-795.

Beauchamp, James 1979. "Brass-Tone Synthesis by Spectrum Evolution Matching with Non-Linear Functions."
Computer Music Journal 3(2):35-43.
Reprinted in C. Roads and J. Strawn, eds. 1985.
Foundations of Computer Music.
MIT Press, pp. 95-113.

Dodge, C. and T.A. Jerse. 1985.
"Synthesis by Waveshaping."
Computer Music: Synthesis, Composition, and Performance.
Schirmer Books, pp. 128-149.

LeBrun, Marc 1979.
"Digital Waveshaping Synthesis."
Journal of the Audio Engineering Society 27(4):250-266.

Moore, F.R. 1990.
"Nonlinear Waveshaping."
Elements of Computer Music.
Prentice-Hall, pp. 332-337.

Roads, C. 1979.
"A Tutorial on Nonlinear Distortion or Waveshaping Synthesis."
Computer Music Journal 3(2):29-34.
Reprinted in C. Roads and J. Strawn, eds. 1985.
Foundations of Computer Music.
MIT Press, pp. 83-94.

Schaffer R.A. 1970.
"Electronic Musical Tone Production by Non-Linear Waveshaping."
Journal of the Audio Engineering Society 18(2):413-417.

Suen,C.Y. 1970.
"Derivation of Harmonic Equations in Non-Linear Circuits."
Journal of the Audio Engineering Society 18(6):675-676.


40_01_1

additional parameters: itf

The sinus which is applied to the transfer function oscillates between the values of +255 and -255. The maximum amplitude value is in general half the table length of the transfer function.

The incoming sinus is translated according to the transfer function. For a strict 1:1 linear mapping, the GEN functions in this example should have been set to maximum ordinate value of 256 (instead of 1), plus (not to forget) inhibiting rescaling of the table. Preceding the GEN routine number by a minus sign inhibits normalization of the values. In this example, the ordinate is in a range +-1, so the translation will produce a normalized signal. Finally, the multiplier will scale the signal to the desired maximum amplitude.

The first section plays 5 different transfer functions at the same pitch and amplitude.

The three linear ones are shown in the flow chart, a parabolic (diabolic ?) and a cubic function follow.

The most interesting tone is produced by f33. In the end of the notes, one hears how the timbre melts. The remaining two section play a dominant 7th chord 'on' that transfer function. (Dodge 1985: pp. 130-132)

[flowchart]

Orchestra and Score

WAV and mp3


40_02_1

additional parameters: none

This instrument uses the duration of a note to choose between two different envelopes. For notes exceeding .75 sec in duration, the right-hand envelope in the figure is applied.

The amount of distortion, i.e. the harmonicity of the spectrum is dependent on the maximum amplitude value specified for LINEN: for 56 or less there is no distortion, and the transfer function will simply return a sinus.

Here the odd linear transfer function produces odd harmonics, increasing in strength and number as the LINEN value exceeds 56. (Risset 1969: #150; Dodge 1985: pp. 141-142; Vercoe 1993: morefiles/risset1.orc)

[flowchart]

Orchestra and Score

WAV and mp3


40_03_1

additional parameters: none

This waveshaping instrument uses a ring modulation to produce a pitched noise instrument. There are separate envelopes for the distortion index (LINSEG) and the amplitude (f31).

The waveshaping part of the instrument runs at ifq*.7071, producing inharmonic partials. As LINSEG drops sharply, so does the richness of the spectrum. Short after the beginning of the tone, the spectral bandwidth of the waveshaper has reached zero and all that is left to hear is a simple sinus.

The instrument is designed for short durations (.2 sec).

In the low frequency range it sounds quite drum like (first section), while it gets more pitched in the high frequency range (second section). (Dodge 1985: pp. 141-142; Vercoe 1993: morefiles/risset1.orc)

[flowchart]

Orchestra and Score

WAV and mp3


40_60_1

additional parameters:

We have implemented GEN 13 in this simple waveshaping instrument. GEN 13 will generate a polynomial weighted transfer function table in accordance with a series of Chebychev coefficients. In this example, one can listen to the results produced by f88, f89 and f90.

For linear mapping, it is necessary to use the same table sizes for the input (here: 8193 for sinus f1) to the waveshaper and the transfer function (here: 8193 for the tables f88-f90).

For GEN 13, the parameter p6 of the f-statement needs to be set to int(table length/2).

[flowchart]

Orchestra and Score

WAV and mp3


Return to main index