AWKward JS Music

a JavaScript music demo

Press the button and bliss out on languid semiharmonic ambient tones.

Waveform

What is this?

This is a rough translation (close but not 100% faithful) from AWK to JavaScript of the musical composition AWK Music by Kyle Keen, with bonus waveform selection and visualization (oscilloscope above and harmonic spectrum below).

Items of note

The basic audio element of this demo is a pair of simple waves of different frequencies, which are played in unison. You can pick among a few options for the basic waveform:

The notes played by this demo are picked randomly from two octaves in an equal-tempered pentatonic scale. This is not a scale that is often encountered in Western music, however it happens to make for note pairs and transitions that are pleasing to human ears.

The waveform is intentionally level-quantized to simulate low bit-depth. You can see this quantization in the oscilloscope as "stair steps" which are most visible in gently-sloping portions of the waveform. (That is, the stair steps are not a visual artifact from the oscilloscope rendering, but rather an accurate reflection of the waveform being generated.) In terms of the sound you hear, this quantization causes a quiet high-pitched "shimmering" effect.

See the source.