# Sawtooth wave

The sawtooth wave (or saw wave) is a kind of non-sinusoidal waveform. It is so named based on its resemblance to the teeth of a plain-toothed saw with a zero rake angle. A single sawtooth, or an intermittently triggered sawtooth, is called a ramp waveform.

Sawtooth wave
A bandlimited sawtooth wave[1] pictured in the time domain (top) and frequency domain (bottom). The fundamental is at 220 Hz (A3).
General information
General definition${\displaystyle x(t)=2\left(t-\left\lfloor t+{\tfrac {1}{2}}\right\rfloor \right),t-{\tfrac {1}{2}}\notin \mathbb {Z} }$
Fields of applicationElectronics, synthesizers
Domain, Codomain and Image
Domain${\displaystyle \mathbb {R} \setminus \left\{n-{\tfrac {1}{2}}\right\},n\in \mathbb {Z} }$
Codomain${\displaystyle \left(-1,1\right)}$
Basic features
ParityOdd
Period1
Specific features
Root${\displaystyle \mathbb {Z} }$
Fourier series${\displaystyle x(t)=-{\frac {2}{\pi }}\sum _{k=1}^{\infty }{\frac {{\left(-1\right)}^{k}}{k}}\sin \left(2\pi kt\right)}$

The convention is that a sawtooth wave ramps upward and then sharply drops. In a reverse (or inverse) sawtooth wave, the wave ramps downward and then sharply rises. It can also be considered the extreme case of an asymmetric triangle wave.[2]

The equivalent piecewise linear functions

${\displaystyle x(t)=t-\lfloor t\rfloor }$
${\displaystyle x(t)=t{\bmod {1}}}$

based on the floor function of time t is an example of a sawtooth wave with period 1.

A more general form, in the range −1 to 1, and with period p, is

${\displaystyle 2\left({\frac {t}{p}}-\left\lfloor {\frac {1}{2}}+{\frac {t}{p}}\right\rfloor \right)}$

This sawtooth function has the same phase as the sine function.

Another sawtooth function in trigonometric terms with period p and amplitude a:

${\displaystyle y(x)=-{\frac {2a}{\pi }}\arctan {\left(\cot {\frac {\pi x}{p}}\right)}}$

While a square wave is constructed from only odd harmonics, a sawtooth wave's sound is harsh and clear and its spectrum contains both even and odd harmonics of the fundamental frequency. Because it contains all the integer harmonics, it is one of the best waveforms to use for subtractive synthesis of musical sounds, particularly bowed string instruments like violins and cellos, since the slip-stick behavior of the bow drives the strings with a sawtooth-like motion.[3]

A sawtooth can be constructed using additive synthesis. For period p and amplitude a, the following infinite Fourier series converge to a sawtooth and a reverse (inverse) sawtooth wave:

${\displaystyle f={\frac {1}{p}}}$
${\displaystyle x_{\text{sawtooth}}(t)=a\left({\frac {1}{2}}-{\frac {1}{\pi }}\sum _{k=1}^{\infty }{(-1)}^{k}{\frac {\sin(2\pi kft)}{k}}\right)}$
${\displaystyle x_{\text{reverse sawtooth}}(t)={\frac {2a}{\pi }}\sum _{k=1}^{\infty }{(-1)}^{k}{\frac {\sin(2\pi kft)}{k}}}$

In digital synthesis, these series are only summed over k such that the highest harmonic, Nmax, is less than the Nyquist frequency (half the sampling frequency). This summation can generally be more efficiently calculated with a fast Fourier transform. If the waveform is digitally created directly in the time domain using a non-bandlimited form, such as y = x  floor(x), infinite harmonics are sampled and the resulting tone contains aliasing distortion.

An audio demonstration of a sawtooth played at 440 Hz (A4) and 880 Hz (A5) and 1,760 Hz (A6) is available below. Both bandlimited (non-aliased) and aliased tones are presented.