Converting audio files to different encodings, sample size, channels, sample rate

Purpose. Converts audio files, changing the sample rate of the audio data.


java AudioConverter -h

java AudioConverter -l

java AudioConverter [ -c channels ] [ -s sample_size ] [ -e encoding ] [ -f sample_rate ] [ -t file_type ] [[ -B ] | [ -L ]] [ -D ] sourcefile targetfile



prints usage information


lists available file types


the number of channels to convert to, for instance 1 for mono or 2 for stereo


the sample size in bits to convert to, for instance 8 for 8 bit samples


the encoding name to convert to, for instance PCM_SIGNED, ULAW or VORBIS


the sample rate to convert to, for instance 44100 or 8000. Fractional values are allowed, for instance 8192.76


the file type to write the target file, for instance WAVE or AU.


the file name of the audio file that should be read to get the source audio data


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

Bugs, limitations. Sample rate conversion can only be handled natively by Tritonus. If you want to do sample rate conversion with the Sun jdk1.3/1.4/1.5, you have to install Tritonus' sample rate converter. Converting number of channels and sample size is only partly supported by the Sun JDK. To get more options, install Tritonus's PCM2PCM converter. Both are part of the 'Tritonus miscellaneous' plug-in. See Tritonus Plug-ins.

Source code.,, gnu.getopt.Getopt