Saving waveform data to a file (standard version)

Purpose. Generates waveform data (sine, square, ...) and saves them to a file. This program uses AudioSystem.write() to write the file.

Usage. 

java OscillatorFile [ -t waveformtype ] [ -f signalfrequency ] [ -r samplerate ] [ -a amplitude ] audiofile

Parameters. 

-t waveformtype

the waveform to play. One of sine, sqaure, triangle and sawtooth. Default: sine.

-f signalfrequency

the frequency of the signal to create. Default: 1000 Hz.

-r samplerate

the sample rate to use. Default: 44.1 kHz.

-a amplitude

the amplitude of the generated signal. May range from 0.0 to 1.0. 1.0 means a full-scale wave. Default: 0.7.

audiofile

the name of the audio file to store the resulting waveform in.

Bugs, limitations.  Full-scale waves can lead to clipping. It currently not known which component is responsible for this.

Source code.  OscillatorFile.java, Oscillator.java, gnu.getopt.Getopt