# Waveshaper

Last updated

In electronic music waveshaping is a type of distortion synthesis in which complex spectra are produced from simple tones by altering the shape of the waveforms. [1]

Electronic music is music that employs electronic musical instruments, digital instruments and circuitry-based music technology. In general, a distinction can be made between sound produced using electromechanical means, and that produced using electronics only. Electromechanical instruments include mechanical elements, such as strings, hammers, and so on, and electric elements, such as magnetic pickups, power amplifiers and loudspeakers. Examples of electromechanical sound producing devices include the telharmonium, Hammond organ, and the electric guitar, which are typically made loud enough for performers and audiences to hear with an instrument amplifier and speaker cabinet. Pure electronic instruments do not have vibrating strings, hammers, or other sound-producing mechanisms. Devices such as the theremin, synthesizer, and computer can produce electronic sounds.

Distortion synthesis is a group of sound synthesis techniques which modify existing sounds to produce more complex sounds, usually by using non-linear circuits or mathematics.

A spectrum is a condition that is not limited to a specific set of values but can vary, without steps, across a continuum. The word was first used scientifically in optics to describe the rainbow of colors in visible light after passing through a prism. As scientific understanding of light advanced, it came to apply to the entire electromagnetic spectrum.

## Uses

Waveshapers are used mainly by electronic musicians to achieve an extra-abrasive sound. This effect is most used to enhance the sound of a music synthesizer by altering the waveform or vowel. Rock musicians may also use a waveshaper for heavy distortion of a guitar or bass. Some synthesizers or virtual software instruments have built-in waveshapers. The effect can make instruments sound noisy or overdriven.

A synthesizer or synthesiser is an electronic musical instrument that generates audio signals that may be converted to sound. Synthesizers may imitate traditional musical instruments such as piano, flute, vocals, or natural sounds such as ocean waves; or generate novel electronic timbres. They are often played with a musical keyboard, but they can be controlled via a variety of other devices, including music sequencers, instrument controllers, fingerboards, guitar synthesizers, wind controllers, and electronic drums. Synthesizers without built-in controllers are often called sound modules, and are controlled via USB, MIDI or CV/gate using a controller device, often a MIDI keyboard or other controller.

Distortion and overdrive are forms of audio signal processing used to alter the sound of amplified electric musical instruments, usually by increasing their gain, producing a "fuzzy", "growling", or "gritty" tone. Distortion is most commonly used with the electric guitar, but may also be used with other electric instruments such as bass guitar, electric piano, and Hammond organ. Guitarists playing electric blues originally obtained an overdriven sound by turning up their vacuum tube-powered guitar amplifiers to high volumes, which caused the signal to distort. While overdriven tube amps are still used to obtain overdrive in the 2010s, especially in genres like blues and rockabilly, a number of other ways to produce distortion have been developed since the 1960s, such as distortion effect pedals. The growling tone of distorted electric guitar is a key part of many genres, including blues and many rock music genres, notably hard rock, punk rock, hardcore punk, acid rock, and heavy metal music.

In digital modeling of analog audio equipment such as tube amplifiers, waveshaping is used to introduce a static, or memoryless, nonlinearity to approximate the transfer characteristic of a vacuum tube or diode limiter. [2]

In electronics, a vacuum tube, an electron tube, or valve or, colloquially, a tube, is a device that controls electric current flow in a high vacuum between electrodes to which an electric potential difference has been applied.

A diode is a two-terminal electronic component that conducts current primarily in one direction ; it has low resistance in one direction, and high resistance in the other. A diode vacuum tube or thermionic diode is a vacuum tube with two electrodes, a heated cathode and a plate, in which electrons can flow in only one direction, from cathode to plate. A semiconductor diode, the most commonly used type today, is a crystalline piece of semiconductor material with a p–n junction connected to two electrical terminals. Semiconductor diodes were the first semiconductor electronic devices. The discovery of asymmetric electrical conduction across the contact between a crystalline mineral and a metal was made by German physicist Ferdinand Braun in 1874. Today, most diodes are made of silicon, but other materials such as gallium arsenide and germanium are used.

## How it works

A waveshaper is an audio effect that changes an audio signal by mapping an input signal to the output signal by applying a fixed or variable mathematical function, called the shaping function or transfer function, to the input signal (the term shaping function is preferred to avoid confusion with the transfer function from systems theory). [3] The function can be any function at all.

Audio signal processing is a subfield of signal processing that is concerned with the electronic manipulation of audio signals. Audio signals are electronic representations of sound waves—longitudinal waves which travel through air, consisting of compressions and rarefactions. The energy contained in audio signals is typically measured in decibels. As audio signals may be represented in either digital or analog format, processing may occur in either domain. Analog processors operate directly on the electrical signal, while digital processors operate mathematically on its digital representation.

In engineering, a transfer function of an electronic or control system component is a mathematical function which theoretically models the device's output for each possible input. In its simplest form, this function is a two-dimensional graph of an independent scalar input versus the dependent scalar output, called a transfer curve or characteristic curve. Transfer functions for components are used to design and analyze systems assembled from components, particularly using the block diagram technique, in electronics and control theory.

Mathematically, the operation is defined by the waveshaper equation

${\displaystyle y=f(a(t)x(t))}$

where f is the shaping function, x(t) is the input function, and a(t) is the index function, which in general may vary as a function of time. [4] This parameter a is often used as a constant gain factor called the distortion index. [5] In practice, the input to the waveshaper, x, is considered on [-1,1] for digitally sampled signals, and f will be designed such that y is also on [-1,1] to prevent unwanted clipping in software.

## Commonly used shaping functions

Sin, arctan, polynomial functions, or piecewise functions (such as the hard clipping function) are commonly used as waveshaping transfer functions. It is also possible to use table-driven functions, consisting of discrete points with some degree of interpolation or linear segments.

### Polynomials

A polynomial is a function of the form

${\displaystyle f(x)=a_{n}x^{n}+a_{n-1}x^{n-1}+\cdots +a_{2}x^{2}+a_{1}x+a_{0}=\sum _{n=0}^{N}a_{n}x^{n}}$

Polynomial functions are convenient as shaping functions because, when given a single sinusoid as input, a polynomial of degree N will only introduce up to the Nth harmonic of the sinusoid. To prove this, consider a sinusoid used as input to the general polynomial.

${\displaystyle \sum _{n=0}^{N}a_{n}(\alpha \cos(\omega t+\phi ))^{n}}$

Next, use the inverse Euler's formula to obtain complex sinusoids.

Euler's formula, named after Leonhard Euler, is a mathematical formula in complex analysis that establishes the fundamental relationship between the trigonometric functions and the complex exponential function. Euler's formula states that for any real number x:

${\displaystyle \sum _{n=0}^{N}a_{n}{\Bigg (}\alpha {\frac {e^{j(\omega t+\phi )}+e^{-j(\omega t+\phi )}}{2}}{\Bigg )}^{n}=a_{0}+\sum _{n=1}^{N}{\frac {a_{n}\alpha ^{n}}{2^{n-1}}}{\frac {(e^{j(\omega t+\phi )}+e^{-j(\omega t+\phi )})^{n}}{2}}}$

Finally, use the binomial formula to transform back to trigonometric form and find coefficients for each harmonic.

${\displaystyle a_{0}+\sum _{n=1}^{N}{\Bigg [}{{\frac {a_{n}\alpha ^{n}}{2^{n-1}}}\sum _{k=0}^{n}{{n \choose k}{\frac {e^{j(n-k)(\omega t+\phi )}e^{-jk(\omega t+\phi )}}{2}}}{\Bigg ]}}=a_{0}+\sum _{n=1}^{N}{\Bigg [}{{\frac {a_{n}\alpha ^{n}}{2^{n-1}}}\sum _{k=0}^{n}{{n \choose k}{\frac {e^{j(n-2k)(\omega t+\phi )}}{2}}}{\Bigg ]}}}$

${\displaystyle =a_{0}+\sum _{n=1}^{N}{\Bigg [}{{\frac {a_{n}\alpha ^{n}}{2^{n-1}}}\sum _{k=0}^{\lfloor n/2\rfloor }{{n \choose k}\cos {((n-2k)(\omega t+\phi ))}}{\Bigg ]}}}$

From the above equation, several observations can be made about the effect of a polynomial shaping function on a single sinusoid:

• All of the sinusoids generated are harmonically related to the original input.
• The frequency never exceeds ${\displaystyle N\omega }$.
• All odd monomial terms ${\displaystyle x^{n}}$ generate odd harmonics from n down to the fundamental, and all even monomial terms generate even harmonics from n down to DC (0 frequency).
• The shape of the spectrum produced by each monomial term is fixed and determined by the binomial coefficients .
• The weight of that spectrum in the overall output is determined solely by its ${\displaystyle a_{n}}$ coefficient and the amplitude of the input by ${\displaystyle {\frac {a_{n}\alpha ^{n}}{2^{n-1}}}}$

## Problems associated with waveshapers

The sound produced by digital waveshapers tends to be harsh and unattractive, because of problems with aliasing. Waveshaping is a non-linear operation, so it's hard to generalize about the effect of a waveshaping function on an input signal. The mathematics of non-linear operations on audio signals is difficult, and not well understood. The effect will be amplitude-dependent, among other things. But generally, waveshapers—particularly those with sharp corners (e.g., some derivatives are discontinuous) -- tend to introduce large numbers of high frequency harmonics. If these introduced harmonics exceed the nyquist limit, then they will be heard as harsh inharmonic content with a distinctly metallic sound in the output signal. Oversampling can somewhat but not completely alleviate this problem, depending on how fast the introduced harmonics fall off.

With relatively simple, and relatively smooth waveshaping functions (sin(a*x), atan(a*x), polynomial functions, for example), this procedure may reduce aliased content in the harmonic signal to the point that it is musically acceptable. But waveshaping functions other than polynomial waveshaping functions will introduce an infinite number of harmonics into the signal, some which may audibly alias even at the supersampled frequency.

## Sources

1. Charles Dodge and Thomas A. Jersey (1997). Computer Music: Synthesis, Composition, and Performance, "Glossary", p.438. ISBN   0-02-864682-7.
2. Yeh, David T. and Pakarinen, Jyri (2009). "A Review of Digital Techniques for Modeling Vacuum-Tube Guitar Amplifiers", Computer Music Journal, 33:2, pp. 89-90
3. Le Brun, Marc (1979). "Digital Waveshaping Synthesis", Journal of the Audio Engineering Society, 27:4, p. 250

## Related Research Articles

In mechanics and physics, simple harmonic motion is a special type of periodic motion or oscillation where the restoring force is directly proportional to the displacement and acts in the direction opposite to that of displacement.

In signal processing, group delay is the time delay of the amplitude envelopes of the various sinusoidal components of a signal through a device under test, and is a function of frequency for each component. Phase delay, in contrast, is the time delay of the phase as opposed to the time delay of the amplitude envelope.

The quantum harmonic oscillator is the quantum-mechanical analog of the classical harmonic oscillator. Because an arbitrary potential can usually be approximated as a harmonic potential at the vicinity of a stable equilibrium point, it is one of the most important model systems in quantum mechanics. Furthermore, it is one of the few quantum-mechanical systems for which an exact, analytical solution is known.

In mathematics and physical science, spherical harmonics are special functions defined on the surface of a sphere. They are often employed in solving partial differential equations in many scientific fields. The spherical harmonics are a complete set of orthogonal functions on the sphere, and thus may be used to represent functions defined on the surface of a sphere, just as circular functions are used to represent functions on a circle via Fourier series. Like the sines and cosines in Fourier series, the spherical harmonics may be organized by (spatial) angular frequency, as seen in the rows of functions in the illustration on the right. Further, spherical harmonics are basis functions for SO(3), the group of rotations in three dimensions, and thus play a central role in the group theoretic discussion of SO(3).

Bruun's algorithm is a fast Fourier transform (FFT) algorithm based on an unusual recursive polynomial-factorization approach, proposed for powers of two by G. Bruun in 1978 and generalized to arbitrary even composite sizes by H. Murakami in 1996. Because its operations involve only real coefficients until the last computation stage, it was initially proposed as a way to efficiently compute the discrete Fourier transform (DFT) of real data. Bruun's algorithm has not seen widespread use, however, as approaches based on the ordinary Cooley–Tukey FFT algorithm have been successfully adapted to real data with at least as much efficiency. Furthermore, there is evidence that Bruun's algorithm may be intrinsically less accurate than Cooley–Tukey in the face of finite numerical precision.

In mathematics and classical mechanics, the Poisson bracket is an important binary operation in Hamiltonian mechanics, playing a central role in Hamilton's equations of motion, which govern the time evolution of a Hamiltonian dynamical system. The Poisson bracket also distinguishes a certain class of coordinate transformations, called canonical transformations, which map canonical coordinate systems into canonical coordinate systems. A "canonical coordinate system" consists of canonical position and momentum variables that satisfy canonical Poisson bracket relations. The set of possible canonical transformations is always very rich. For instance, it is often possible to choose the Hamiltonian itself as one of the new canonical momentum coordinates.

In control theory and signal processing, a linear, time-invariant system is said to be minimum-phase if the system and its inverse are causal and stable.

In mathematics, the Hamilton–Jacobi equation (HJE) is a necessary condition describing extremal geometry in generalizations of problems from the calculus of variations, and is a special case of the Hamilton–Jacobi–Bellman equation. It is named for William Rowan Hamilton and Carl Gustav Jacob Jacobi.

The electromagnetic wave equation is a second-order partial differential equation that describes the propagation of electromagnetic waves through a medium or in a vacuum. It is a three-dimensional form of the wave equation. The homogeneous form of the equation, written in terms of either the electric field E or the magnetic field B, takes the form:

Prony analysis was developed by Gaspard Riche de Prony in 1795. However, practical use of the method awaited the digital computer. Similar to the Fourier transform, Prony's method extracts valuable information from a uniformly sampled signal and builds a series of damped complex exponentials or sinusoids. This allows for the estimation of frequency, amplitude, phase and damping components of a signal.

In many-body theory, the term Green's function is sometimes used interchangeably with correlation function, but refers specifically to correlators of field operators or creation greenand annihilation operators.

The Birnbaum–Saunders distribution, also known as the fatigue life distribution, is a probability distribution used extensively in reliability applications to model failure times. There are several alternative formulations of this distribution in the literature. It is named after Z. W. Birnbaum and S. C. Saunders.

In probability theory and statistics, the skew normal distribution is a continuous probability distribution that generalises the normal distribution to allow for non-zero skewness.

In the mathematical study of rotational symmetry, the zonal spherical harmonics are special spherical harmonics that are invariant under the rotation through a particular fixed axis. The zonal spherical functions are a broad extension of the notion of zonal spherical harmonics to allow for a more general symmetry group.

In mathematics, the Schauder estimates are a collection of results due to Juliusz Schauder concerning the regularity of solutions to linear, uniformly elliptic partial differential equations. The estimates say that when the equation has appropriately smooth terms and appropriately smooth solutions, then the Hölder norm of the solution can be controlled in terms of the Hölder norms for the coefficient and source terms. Since these estimates assume by hypothesis the existence of a solution, they are called a priori estimates.

In fluid dynamics, a flow with periodic variations is known as pulsatile flow, or as Womersley flow. The flow profiles was first derived by John R. Womersley (1907–1958) in his work with blood flow in arteries. The cardiovascular system of chordate animals is a very good example where pulsatile flow is found, but pulsatile flow is also observed in engines and hydraulic systems, as a result of rotating mechanisms pumping the fluid.

In mathematics, the Grunsky matrices, or Grunsky operators, are matrices introduced by Grunsky (1939) in complex analysis and geometric function theory. They correspond to either a single holomorphic function on the unit disk or a pair of holomorphic functions on the unit disk and its complement. The Grunsky inequalities express boundedness properties of these matrices, which in general are contraction operators or in important special cases unitary operators. As Grunsky showed, these inequalities hold if and only if the holomorphic function is univalent. The inequalities are equivalent to the inequalities of Goluzin, discovered in 1947. Roughly speaking, the Grunsky inequalities give information on the coefficients of the logarithm of a univalent function; later generalizations by Milin, starting from the Lebedev–Milin inequality, succeeded in exponentiating the inequalities to obtain inequalities for the coefficients of the univalent function itself. Historically the inequalities were used in proving special cases of the Bieberbach conjecture up to the sixth coefficient; the exponentiated inequalities of Milin were used by de Branges in the final solution. The Grunsky operators and their Fredholm determinants are related to spectral properties of bounded domains in the complex plane. The operators have further applications in conformal mapping, Teichmüller theory and conformal field theory.

The entropy of entanglement is an entanglement measure for a many-body quantum state. If a state is a separable state, then the reduced density matrix is a pure state, thus the entropy of the state is zero. Similar result holds for . The nonzero value of the entropy of the reduced density matrix therefore is a signal of the existence of entanglement.

This article summarizes important identities in exterior calculus.