Converting raw data (headerless) files

Purpose. Converts a file with raw audio data without header (input file) to an audio file (outputfile). Since the format of the input data cannot be derived from the input file, it has to be specified on the command line.


java RawAudioDataConverter -h

java RawAudioDataConverter -l

java RawAudioDataConverter [ [[-s] | [-u]] ] [[-L] | [-B]] {-b sample_size_in_bits } {-c channels } {-r sample_rate } {-t target_type } { input_file } { output_file }



output usage information, then exit


lists the available target file types


data is unsigned


data is signed


data is little-endian


data is big-endian

-b sample_size_in_bits

the size of one (mono) sample in bits. This is typicall 8, 16, 24 or 32.

-c channels

the number of channels

-r sample_rate

the sample rate of the input date

-t target_type

the extension of the target file type that should be converted to (e.g. wav). The available target types can be listed with the -l option.


the file name of the raw data (headerless) file that should be read.


the file name of the audio file that the audio data should be written to.

Bugs, limitations. This program can only process PCM data. Trying to store big-endian data in a wav file with the JDK 1.4.2 results in a file with only the header. Presumably, this is a bug in the JDK.

Source code.,, gnu.getopt.Getopt