# Saw wave

A saw wave is a periodic function that increases linearly from a minimum to a maximum and then drops suddenly back to the minimum. An inverted saw wave is similar, but decreases from a maximum to a minimum and then jumps back to the maximum.

In discrete time, for example, if N is the period of the function, then the function

$$x(k)=2\,(\frac{k}{N}+\mathrm{floor}(\frac{k}{N}+0.5))$$

is a saw wave. It increases to 1 over N samples, then drops to -1, and again starts increasing back to 1. Its period is N samples. The "floor" function returns the closest integer that is smaller than its argument.

The function

$$x(k)=-2\,(\frac{k}{N}+\mathrm{floor}(\frac{k}{N}+0.5))$$

is an inverted saw wave.

If, for example, N = 40, then the saw wave will be as follows. The inverted saw wave is shown below. The following are two 5 second samples of a saw wave and an inverted saw wave, both with the frequency of middle C.

Click Play to hear a saw wave. Click Play to hear an inverted saw wave. ## Using saw waves

Much like square waves, saw waves are rich in harmonics. The following is the discrete Fourier transform of 500 components of the example saw wave in the graph above. Because of these harmonics – the evenly spaced notches in the graph above – saw waves are used in synthesizers. To simulate the sound of an instrument, saw waves (as well as square waves and other) with the desired harmonics can be combined and the result filtered (e.g., through a low pass filter).

### Filtered HTML

• Freelinking helps you easily create HTML links. Links take the form of [[indicator:target|Title]]. By default (no indicator): Click to view a local node. 