Saving waveform data to a file (AudioOutputStream version)

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


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


-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.


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

Bugs, limitations.  Using AudioOutputStreams from Tritons makes this program not portable. Full-scale waves can lead to clipping. It currently not known which component is responsible for this.

Source code.,, gnu.getopt.Getopt, Tritonus