WAV File Demo: Executable or Text Version
This program enables you to construct a playable WAV Audio file from the 15 notes in two octaves of a Major scale -- but also to add 2 harmonics to the waveform, but on a dual Stereo waveform, with one channel double the frequency of the other. They don't even have to be integer harmonics, so you can produce some odd sounds.
From a mathematical perspective, the interest lies in the fact that you can subsequently view the actual dual Stereo waveforms you've made slide by on screen. During this phase, pressing any key will HALT the wave, and pressing any key again will cause it to re-commence.
For those not aware, since a WAV file is a stream of points on a waveform, sampled in this case at 44.1kHz, the notes in the full even-tempered 12-note standard chromatic scale are each set up as a sine wave with a frequency a multiple of the twelfth root of 2 apart. That is, the fifth note in the scale is the twelfth root of 2 raised to the power 5 times the frequency of the basic key-note, for example A=440Hz. The twelfth note is then the twelfth root of 2 raised to the power 12--or twice- the frequency of the basic note. The next A is therefore 880Hz.