Triangle Wave Explorer

a JavaScript music demo

Call to action!

Press the button to play the waveform, and adjust the controls to alter its shape.

Downward Bias Upward Bias
Negative Bias Positive Bias
Deämping Bias Amping Bias
Low Pitch High Pitch
Low Amplitude High Amplitude

What is this?

This is an audio generator tool to explore the timbral quality of the triangle wave family of waveforms, including both symmetric and asymmetric variants. The top box is an oscilloscope view which visualizes the waveform, and the bottom box is a harmonic spectrum view.

Three different symmetries of the wave are parameterized and can be controlled to "bias" the wave away from symmetrical. These symmetries / biases are:

In addition, you can change the pitch (frequency) and total amplitude of the note being played. Adjusting these can help discern the various patterns of the displays.

See the source.

Items of note

At many frequencies, you can observe harmonics that are not even multiples of the fundamental frequency. For example, if you ramp up the pitch slowly, you can see these harmonics "bounce off the wall." These are aliasing artifacts which are produced because the period (single cycle) of the waveform isn't a whole number of samples. The demo code reduces — but does not eliminate — this effect by oversampling, that is, by producing samples at a higher rate than the output sample rate. In this case, those samples are simply averaged together, a tactic which serious audio engineers would probably scoff at but which is both effective and efficient for the current use case.


Copyright 2015 the Mimu Authors (Dan Bornstein et alia). Licensed AS IS and WITHOUT WARRANTY under the Apache License, Version 2.0. Details: