tone_synth object
The tone_synth object is used to create tunes and store them as PCM wave sounds.
tone_synth()
Parameters:
None.
Remarks:
The idea is to create a tune, as simple or as complicated as you wish. The tune can have chords or single notes, with multiple or single waveform types, and can be any length. When your tune is finished you can then create a wave file of your composition.
Please note that this is not an instrumental synth, but rather a waveform synth. This means that the sound output produced will be similar to that of an older game console. The four basic waveform types supported are sine, square, sawtooth and triangle.
When creating a tune, lengths can either be specified in beats, or in milliseconds by using the ms methods. When specifying the length in beats, the synth will automatically calculate the appropriate milliseconds to use based on the tempo property, which specifies beats per minute.
To specify a length in beats, 1 specifies one beat, 0.5 is half a beat, 0.666 is a swing beat, etc.
Example:

    // Make a simple tune and write it to a wave file.

    tone_synth synth;

    void main()
    {
    synth.tempo=120;
    synth.waveform_type=2;
    synth.note("C4", 4);
    synth.note("E4", 4);
    synth.note("G4", 4);
    synth.waveform_type=3;
    synth.note("C5", 0.666);
    synth.rest(0.666);
    synth.note("E5", 0.666);
    synth.rest(0.666);
    synth.note("G5", 0.666);
    synth.rest(0.666);
    synth.note("C6", 2);
    synth.write_wave_file("synth.wav");
    }