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.

Usage. 

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 }

Parameters. 

-h

output usage information, then exit

-l

lists the available target file types

-u

data is unsigned

-s

data is signed

-L

data is little-endian

-B

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.

input_file

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

output_file

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.  RawAudioDataConverter.java, AudioCommon.java, gnu.getopt.Getopt